1
0

Standardized setup.py

This commit is contained in:
Jon Michael Aanes 2024-04-08 13:44:47 +02:00
parent 5ada6e20b1
commit c95cca8801
5 changed files with 47 additions and 25 deletions

View File

@ -1,6 +1,8 @@
# Partisia Blockchain ABI client # Partisia Blockchain ABI client
Utility library for parsing and processing the [Partisia Blockchain's ABI format](https://partisiablockchain.gitlab.io/documentation/smart-contracts/smart-contract-binary-formats.html).. Utility library for parsing and processing the Partisia Blockchain ABI Format.
The format is specified here: [Partisia Blockchain's ABI format](https://partisiablockchain.gitlab.io/documentation/smart-contracts/smart-contract-binary-formats.html)..
## Example usage ## Example usage

View File

@ -8,8 +8,7 @@ Follows the ABI specification quite closely. The full ABI specification can be f
import pbcabi.model import pbcabi.model
import pbcabi.binaryreader import pbcabi.binaryreader
from ._version import __version__
__version__ = "0.1.0"
def get_version(): def get_version():
""" """

1
pbcabi/_version.py Normal file
View File

@ -0,0 +1 @@
__version__ = '0.1.1'

1
requirements_test.txt Normal file
View File

@ -0,0 +1 @@
pytest

View File

@ -1,28 +1,47 @@
#!/usr/bin/env python #!/usr/bin/env python
import re
from os import path from setuptools import setup
from io import open
from setuptools import setup, find_packages
from enforce_typing import get_version
HERE = path.abspath(path.dirname(__file__)) PACKAGE_NAME = 'pbcabi'
with open('README.md') as f:
readme = f.read()
with open(PACKAGE_NAME + '/_version.py') as f:
text = f.read()
match = re.match(r'^__version__\s*=\s*(["\'])([\d\.]+)\1$', text)
version = match.group(2)
del match, text
def read_requirements(path: str = 'requirements.txt'):
with open(path) as f:
return f.read().strip().split('\n')
def get_short_description(readme: str):
readme = re.sub(r'#+[^\n]*\n+', '', readme)
m = re.search(r'^\s*(\w+[\w\s,`]+\.)', readme)
try:
return m.group(1)
except AttributeError as err:
msg = 'Could not determine short description'
raise Exception(msg) from err
with open(path.join(HERE, "README.md"), encoding="utf-8") as f:
LONG_DESCRIPTION = f.read()
if __name__ == "__main__":
setup( setup(
name="pbcabi", name=PACKAGE_NAME,
version=get_version(), version=version,
description="Utility library for parsing and processing the Partisia Blockchain's ABI format", description=get_short_description(readme),
long_description=LONG_DESCRIPTION, long_description=readme,
long_description_content_type="text/markdown", long_description_content_type='text/markdown',
author="Jon Michael Aanes", author='Jmaa',
author_email="jonjmaa@gmail.com", author_email='jonjmaa@gmail.com',
url="https://gitfub.space/Jmaa/pbcabi", url='https://gitfub.space/Jmaa/' + PACKAGE_NAME,
packages=find_packages(), packages=[PACKAGE_NAME],
license="MIT", install_requires=read_requirements(),
python_requires=">=3.9", extras_require={
classifiers=[], 'test': read_requirements('requirements_test.txt'),
},
) )