Great videos, thank you. One question though, is there a reason why you don't store the version in the source file and use the attr directive of setuptools? This way you avoid adding a runtime dependency on importlib-metadata in py37 and below. I usually define a `__version__` variable in `mymodule.py` (or `mypackage/__init__.py`) and have `version = attr: mymodule.__version__` (or `mypackage.__version__`) in setup.cfg metadata.
attr requires your module to be importable at *setup* time. it's all-too-easy to write a completely broken package because of this (requiring your *runtime* dependencies at *setup* time)
@@anthonywritescode Good point. The documentation of setuptools however says: "attr: first tries to read the value from the module by examining the module’s AST. If that fails, attr: falls back to importing the module." I didn't have a case where it actually imported the module yet.
Great videos, thank you. One question though, is there a reason why you don't store the version in the source file and use the attr directive of setuptools? This way you avoid adding a runtime dependency on importlib-metadata in py37 and below.
I usually define a `__version__` variable in `mymodule.py` (or `mypackage/__init__.py`) and have `version = attr: mymodule.__version__` (or `mypackage.__version__`) in setup.cfg metadata.
attr requires your module to be importable at *setup* time. it's all-too-easy to write a completely broken package because of this (requiring your *runtime* dependencies at *setup* time)
@@anthonywritescode Good point.
The documentation of setuptools however says: "attr: first tries to read the value from the module by examining the module’s AST. If that fails, attr: falls back to importing the module."
I didn't have a case where it actually imported the module yet.
guess you're getting lucky then!
this is dope!!! Kudos
Explain tox please
already on my list -- I'll be recording a quick intro to tox in a few days!