Skip to content

Conversation

joyceerhl
Copy link

Background

The Python extension for VS Code needs to ensure that users upgrade to the latest version of the torch_tb_profiler module so that users can take advantage of the jump-to-source support being added in v0.2.0.

We currently check version info for Python modules using the __version__ attribute specified in PEP 396 (code pointer here).

However, the __version__ attribute is currently missing from torch_tb_profiler v0.1.0 and 0.2.0rc2:

image

Description of changes

This PR makes __init__.py the single source of truth for version info. Specifically, it moves the version number from version.txt to __init__.py, and setup.py then reads the version number out of __init__.py. This is the first approach described in https://packaging.python.org/guides/single-sourcing-package-version/ and also the approach adopted by pip itself:

image

Test plan

To verify that this change works and doesn't break setup, I did the following:

  1. Made changes to the source
  2. python3 -m pip install /workspaces/kineto/tb_plugin to install the package locally
  3. python3 -c "import torch_tb_profiler; print(torch_tb_profiler.__version__)" now prints out the version number:

image

@facebook-github-bot
Copy link
Contributor

Hi @joyceerhl!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@joyceerhl joyceerhl marked this pull request as ready for review June 2, 2021 05:36
@guotuofeng guotuofeng merged commit 92f3ba9 into pytorch:plugin/0.2 Jun 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants