ppannuto / python-titlecase

Python library to capitalize strings as specified by the New York Times Manual of Style
MIT License
254 stars 38 forks source link

setup.py: Read version from __init__.py to avoid importing the module #55

Closed ppannuto closed 4 years ago

ppannuto commented 4 years ago

The module import happens before setup() is executed, and therefore, none of the modules specified in 'setup_requires' (or 'install_requires', for that matter) are loaded at that moment, causing the import to fail with ModuleNotFoundError.

Following the first recommendation from the 'Single-sourcing the package version' section of the Python Package User Guide 1, in this commit we switch to reading the version string from the 'init.py' file instead of attempting to import the module.


Also includes updates in patch at https://github.com/ppannuto/python-titlecase/pull/54#issuecomment-643048143

ppannuto commented 4 years ago

Closes #50, #54

Thanks @iburago!!

coveralls commented 4 years ago

Coverage Status

Coverage remained the same at 82.927% when pulling 4b7aa31597dda05ac420d3a2c585b0d673b0de31 on how-is-this-the-hard-part into f7ae65c365877e97c3f5abe187d2ef81c6d72ccb on master.