Add PEP 396 __version__ attribute to torch_tb_profiler module#268
Add PEP 396 __version__ attribute to torch_tb_profiler module#268guotuofeng merged 1 commit intopytorch:plugin/0.2from joyceerhl:dev/joyceerhl/add-version
__version__ attribute to torch_tb_profiler module#268Conversation
|
Hi @joyceerhl! Thank you for your pull request and welcome to our community. Action RequiredIn 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. ProcessIn 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 If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
Background
The Python extension for VS Code needs to ensure that users upgrade to the latest version of the
torch_tb_profilermodule 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:Description of changes
This PR makes
__init__.pythe single source of truth for version info. Specifically, it moves the version number fromversion.txtto__init__.py, andsetup.pythen 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 bypipitself:Test plan
To verify that this change works and doesn't break setup, I did the following:
python3 -m pip install /workspaces/kineto/tb_pluginto install the package locallypython3 -c "import torch_tb_profiler; print(torch_tb_profiler.__version__)"now prints out the version number: