Standardized setup.py
This commit is contained in:
parent
5ada6e20b1
commit
c95cca8801
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
1
pbcabi/_version.py
Normal file
|
@ -0,0 +1 @@
|
||||||
|
__version__ = '0.1.1'
|
1
requirements_test.txt
Normal file
1
requirements_test.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
pytest
|
63
setup.py
63
setup.py
|
@ -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(path.join(HERE, "README.md"), encoding="utf-8") as f:
|
with open('README.md') as f:
|
||||||
LONG_DESCRIPTION = f.read()
|
readme = f.read()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
with open(PACKAGE_NAME + '/_version.py') as f:
|
||||||
setup(
|
text = f.read()
|
||||||
name="pbcabi",
|
match = re.match(r'^__version__\s*=\s*(["\'])([\d\.]+)\1$', text)
|
||||||
version=get_version(),
|
version = match.group(2)
|
||||||
description="Utility library for parsing and processing the Partisia Blockchain's ABI format",
|
del match, text
|
||||||
long_description=LONG_DESCRIPTION,
|
|
||||||
long_description_content_type="text/markdown",
|
|
||||||
author="Jon Michael Aanes",
|
|
||||||
author_email="jonjmaa@gmail.com",
|
|
||||||
url="https://gitfub.space/Jmaa/pbcabi",
|
|
||||||
packages=find_packages(),
|
|
||||||
license="MIT",
|
|
||||||
python_requires=">=3.9",
|
|
||||||
classifiers=[],
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
|
setup(
|
||||||
|
name=PACKAGE_NAME,
|
||||||
|
version=version,
|
||||||
|
description=get_short_description(readme),
|
||||||
|
long_description=readme,
|
||||||
|
long_description_content_type='text/markdown',
|
||||||
|
author='Jmaa',
|
||||||
|
author_email='jonjmaa@gmail.com',
|
||||||
|
url='https://gitfub.space/Jmaa/' + PACKAGE_NAME,
|
||||||
|
packages=[PACKAGE_NAME],
|
||||||
|
install_requires=read_requirements(),
|
||||||
|
extras_require={
|
||||||
|
'test': read_requirements('requirements_test.txt'),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user