-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: module did not expose __version__ (#75)
Solution: declare `__version__` in `__init__.py` and parse the file with a regex to determine the version in `setup.py`.
- Loading branch information
Showing
2 changed files
with
50 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from .models import MessagesResponse, parse_message | ||
|
||
__all__ = ["parse_message", "MessagesResponse"] | ||
__version__ = "0.4.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,38 +4,60 @@ | |
""" | ||
|
||
import os | ||
import re | ||
|
||
|
||
def get_version(): | ||
version_file = os.path.join("aleph_message", "__init__.py") | ||
initfile_lines = open(version_file, "rt").readlines() | ||
version = r"^__version__ = ['\"]([^'\"]*)['\"]" | ||
|
||
for line in initfile_lines: | ||
mo = re.search(version, line, re.M) | ||
if mo: | ||
return mo.group(1) | ||
raise RuntimeError(f"Unable to find version string in {version_file}.") | ||
|
||
|
||
from setuptools import setup | ||
|
||
# allow setup.py to be run from any path | ||
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) | ||
|
||
with open('README.md') as file: | ||
with open("README.md") as file: | ||
long_description = file.read() | ||
|
||
setup(name='aleph-message', | ||
version='0.4.0', | ||
description='Aleph.im message specification ', | ||
long_description=long_description, | ||
long_description_content_type='text/markdown', | ||
author='Hugo Herter', | ||
author_email='[email protected]', | ||
url='https://github.com/aleph-im/aleph-message', | ||
packages=['aleph_message', 'aleph_message.models', 'aleph_message.models.execution'], | ||
package_data={"aleph_message": ["py.typed"], | ||
"aleph_message.models": ["py.typed"], | ||
"aleph_message.models.execution": ["py.typed"]}, | ||
data_files=[], | ||
install_requires=[ | ||
'pydantic~=1.10.5', | ||
'typing_extensions~=4.5.0', | ||
], | ||
license='MIT', | ||
platform='any', | ||
keywords="aleph.im message validation specification", | ||
classifiers=['Development Status :: 5 - Production/Stable', | ||
'Programming Language :: Python :: 3', | ||
'Intended Audience :: Developers', | ||
'Topic :: System :: Distributed Computing', | ||
], | ||
) | ||
setup( | ||
name="aleph-message", | ||
version=get_version(), | ||
description="Aleph.im message specification ", | ||
long_description=long_description, | ||
long_description_content_type="text/markdown", | ||
author="Hugo Herter", | ||
author_email="[email protected]", | ||
url="https://github.com/aleph-im/aleph-message", | ||
packages=[ | ||
"aleph_message", | ||
"aleph_message.models", | ||
"aleph_message.models.execution", | ||
], | ||
package_data={ | ||
"aleph_message": ["py.typed"], | ||
"aleph_message.models": ["py.typed"], | ||
"aleph_message.models.execution": ["py.typed"], | ||
}, | ||
data_files=[], | ||
install_requires=[ | ||
"pydantic~=1.10.5", | ||
"typing_extensions~=4.5.0", | ||
], | ||
license="MIT", | ||
platform="any", | ||
keywords="aleph.im message validation specification", | ||
classifiers=[ | ||
"Development Status :: 5 - Production/Stable", | ||
"Programming Language :: Python :: 3", | ||
"Intended Audience :: Developers", | ||
"Topic :: System :: Distributed Computing", | ||
], | ||
) |