diff --git a/.gitea/workflows/package.yml b/.gitea/workflows/package.yml index f62720a..1ec7877 100644 --- a/.gitea/workflows/package.yml +++ b/.gitea/workflows/package.yml @@ -2,8 +2,13 @@ name: Python Package on: [push] jobs: + Test: + uses: jmaa/workflows/.gitea/workflows/python-test.yaml@v6.21 Package: - uses: jmaa/workflows/.gitea/workflows/python-package.yaml@main + uses: jmaa/workflows/.gitea/workflows/python-package.yaml@v6.21 + with: + REGISTRY_DOMAIN: gitfub.space + REGISTRY_ORGANIZATION: jmaa secrets: PIPY_REPO_USER: ${{ secrets.PIPY_REPO_USER }} PIPY_REPO_PASS: ${{ secrets.PIPY_REPO_PASS }} diff --git a/README.md b/README.md index 0d8c37c..512e473 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ +# Datagraph -Utility for working with scheme+ld and other datagraph formats. +Utility for working with scheme+ld and other data-graph and semantic web formats. diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..d8c7a32 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +requests +ratelimit +wikidata diff --git a/requirements_test.txt b/requirements_test.txt new file mode 100644 index 0000000..e079f8a --- /dev/null +++ b/requirements_test.txt @@ -0,0 +1 @@ +pytest diff --git a/setup.py b/setup.py index 8e1b435..2d791a4 100644 --- a/setup.py +++ b/setup.py @@ -1,31 +1,70 @@ - #!/usr/bin/env python -from setuptools import setup +# +# WARNING +# +# THIS IS AN AUTOGENERATED FILE. +# +# MANUAL CHANGES CAN AND WILL BE OVERWRITTEN. + import re +from setuptools import setup + PACKAGE_NAME = 'datagraph' -with open('README.md', 'r') as f: +with open('README.md') as f: readme = f.read() -with open(PACKAGE_NAME+'/_version.py', 'r') as f: - match = re.match(r'^__version__\s*=\s*"([\d\.]+)"$', f.read()) - version = match.group(1) - del match +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 parse_requirements(text: str) -> list[str]: + return text.strip().split('\n') + + +def read_requirements(path: str): + with open(path) as f: + return parse_requirements(f.read()) + + +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 + + +REQUIREMENTS_MAIN = """ +requests +ratelimit +wikidata +""" + +REQUIREMENTS_TEST = """ +pytest +""" + setup( name=PACKAGE_NAME, version=version, - description='Extensions to wikidata library', + 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, + url='https://gitfub.space/Jmaa/' + PACKAGE_NAME, packages=[PACKAGE_NAME], - install_requires=['requests', 'ratelimit', 'wikidata'], - keywords=[], - classifiers=[], - include_package_data=True, - zip_safe=False + install_requires=parse_requirements(REQUIREMENTS_MAIN), + extras_require=dict( + test=parse_requirements(REQUIREMENTS_TEST), + ), + python_requires='>=3.9', )