'Access package version set by setuptools-scm from installed package
I use setuptools-scm to manage my package version and it works great for releasing to PyPI.
Now I'm trying to make the package version available to the installed package at e.g. my_package.__version__. I found the write_to method in setuptools-scm and it creates a version.py file. However, when I install the package I can't import my_package.version and can't access the version stored in that file.
I suppose it's added after setuptools builds the package. How can I make the version available with setuptools-scm?
My current setup.py:
setup(name='my_package',
use_scm_version={
"root": ".",
"relative_to": __file__,
"local_scheme": "node-and-timestamp",
"write_to": "my_package/version.py"
},
setup_requires=['setuptools_scm'],
packages=find_packages()
...
)
When I install with this setup.py I can properly import the package but can't do from my_package import version.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
