diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index 2d026ba1..8a68d2ae 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -19,16 +19,10 @@ jobs: python-version: 3.8 - name: Set Version id: version - run: | - if [[ "${{ github.event_name }}" == "release" && "${{ github.event.action }}" == "published" ]]; then - echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV - else - TIMESTAMP=$(date +'%Y%m%d%H%M%S') - echo "VERSION=0.0.dev${TIMESTAMP}" >> $GITHUB_ENV - fi + run: echo "${GITHUB_REF#refs/tags/}" > polypheny-connector-version.txt + - name: Create MANIFEST.in + run: echo "include polypheny-connector-version.txt" > MANIFEST.in - name: Build package run: python setup.py sdist - env: - VERSION: ${{ env.VERSION }} - name: Publish distribution 📦 to PyPI uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index b62f1686..97188e54 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -32,7 +32,14 @@ jobs: with: distribution: 'temurin' java-version: '17' - + + - name: Set Version + id: version + run: echo "v0.0.0" > polypheny-connector-version.txt + + - name: Create MANIFEST.in + run: echo "include polypheny-connector-version.txt" > MANIFEST.in + - name: Checkout driver uses: actions/checkout@v4 with: @@ -90,6 +97,13 @@ jobs: distribution: 'temurin' java-version: '17' + - name: Set Version + id: version + run: echo "v0.0.0" > polypheny-connector-version.txt + + - name: Create MANIFEST.in + run: echo "include polypheny-connector-version.txt" > MANIFEST.in + - name: Checkout driver uses: actions/checkout@v4 with: @@ -137,6 +151,13 @@ jobs: - name: Checkout driver uses: actions/checkout@v4 + - name: Set Version + id: version + run: echo "v0.0.0" > polypheny-connector-version.txt + + - name: Create MANIFEST.in + run: echo "include polypheny-connector-version.txt" > MANIFEST.in + - name: Install driver dependencies run: pip install -r requirements.txt diff --git a/setup.py b/setup.py index bd0f3654..0149373a 100644 --- a/setup.py +++ b/setup.py @@ -1,27 +1,42 @@ import os -import sys - from setuptools import setup -# Retrieve 'VERSION' environment variable, default to '0.0' if not found. -version = os.getenv('RELEASE_VERSION', '0.0') +version_file = 'polypheny-connector-version.txt' + +if not os.path.exists(version_file): + raise ValueError(f"Version file '{version_file}' not found. Please create the file with the version number.") + +with open(version_file, 'r') as f: + version = f.read().strip() + +print(f"Building version: {version}") + +if not version.startswith('v'): + raise ValueError(f"Invalid version format: {version}. Expected format 'v0.0.0'.") -# Attempt to split the version number, default to '0' for both if it fails -try: - major, minor = version.split('.') -except ValueError: - major, minor = '0', '0' # Default to '0.0' if the version isn't in a 'major.minor' format +# Strip the 'v' prefix for the version +version = version[1:] with open('README.md', 'r', encoding='utf-8') as f: long_description = f.read() -setup(name='polypheny', - version=version, - description='Driver for Polypheny', - long_description=long_description, - long_description_content_type='text/markdown', - packages=['polypheny'], - install_requires=[ - "polypheny-prism-api==1.9", - ], - ) +setup( + name='polypheny', + version=version, + description='Driver for Polypheny', + long_description=long_description, + long_description_content_type='text/markdown', + author="The Polypheny Project", + author_email="mail@polypheny.org", + url="https://polypheny.com/", + project_urls={ + "Documentation": "https://docs.polypheny.com/en/latest/drivers/python/overview", + "Code": "https://github.com/polypheny/Polypheny-Connector-Python", + "Issue tracker": "https://github.com/polypheny/Polypheny-DB/labels/A-python" + }, + license="Apache License, Version 2.0", + packages=['polypheny'], + install_requires=[ + "polypheny-prism-api==1.9", + ], +)