diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml new file mode 100644 index 0000000..0e73d9a --- /dev/null +++ b/.github/workflows/pypi.yml @@ -0,0 +1,112 @@ +name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI + +# on: +# workflow_dispatch: +# inputs: +# branch_name: +# description: 'Branch to build from (default is main)' +# required: false +# default: 'main' +# workflow_run: +# workflows: ["Run Tests"] +# types: +# - completed +# branches: [main, develop] # This ensures it only triggers for these branches + +on: + push: + branches: + - develop + workflow_dispatch: + inputs: + branch_name: + description: 'Branch to build from (default is main)' + required: false + default: 'main' + +env: + TestPyPI_URL: https://test.pypi.org/p/scraibe + PyPI_URL: https://pypi.org/p/scraibe + PyPI_DEV_URL: https://pypi.org/p/scraibe-nightly + ISRELEASED: true +jobs: + + build: + name: Build distribution 📦 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.x" + - name: Install dependencies + run: | + python3 -m pip install --upgrade pip + pip install setuptools wheel + - name: Build source distribution + run: | + python3 -c "import os; print('ISRELEASED' in os.environ)" + python3 setup.py sdist + - name: Store the distribution packages + uses: actions/upload-artifact@v3 + with: + name: python-package-distributions + path: dist/ + + publish-to-testpypi: + name: Publish Python 🐍 distribution 📦 to TestPyPI + needs: build + runs-on: ubuntu-latest + environment: + name: testpypi + url: env.TestPyPI_URL + permissions: + id-token: write + steps: + - name: Download all the dists + uses: actions/download-artifact@v3 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution 📦 to TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ + skip-existing: true + + + test-install: + name: Test Installation from TestPyPI + needs: publish-to-testpypi + runs-on: ubuntu-latest + steps: + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.x" + - name: Install package + run: | + python3 -m pip install setuptools + python3 -m pip install --index-url https://test.pypi.org/simple/ scraibe + + publish-to-pypi: + name: Conditional Publish to PyPI or Dev Repository + needs: [build, test-install] + runs-on: ubuntu-latest + environment: + name: pypi + url: env.PyPI_URL + permissions: + id-token: write + steps: + - name: Download all the dists + uses: actions/download-artifact@v3 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution 📦 to PyPI or Dev Repository + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: ${{ github.ref == 'refs/heads/main' && 'env.PyPI_URL' || ' env.PyPI_DEV_URL' }} + password: ${{ secrets.PYPI_API_TOKEN}} \ No newline at end of file diff --git a/.github/workflows/pytest.yaml b/.github/workflows/pytest.yaml index 8959789..973571f 100644 --- a/.github/workflows/pytest.yaml +++ b/.github/workflows/pytest.yaml @@ -1,11 +1,10 @@ -name: Run tests +name: Run Tests on: #push: pull_request: branches: ['main', 'develop'] - workflow_dispatch: jobs: diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml deleted file mode 100644 index bdaab28..0000000 --- a/.github/workflows/python-publish.yml +++ /dev/null @@ -1,39 +0,0 @@ -# This workflow will upload a Python Package using Twine when a release is created -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries - -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -name: Upload Python Package - -on: - release: - types: [published] - -permissions: - contents: read - -jobs: - deploy: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v3 - with: - python-version: '3.x' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install build - - name: Build package - run: python -m build - - name: Publish package - uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml new file mode 100644 index 0000000..c8a0958 --- /dev/null +++ b/.github/workflows/ruff.yml @@ -0,0 +1,8 @@ +name: Ruff +on: [ push, pull_request ] +jobs: + ruff: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: chartboost/ruff-action@v1 \ No newline at end of file diff --git a/.ruff.toml b/.ruff.toml new file mode 100644 index 0000000..f6be0be --- /dev/null +++ b/.ruff.toml @@ -0,0 +1,2 @@ +[lint.extend-per-file-ignores] +"__init__.py" = ["E402","F403"] diff --git a/MANIFEST.IN b/MANIFEST.in similarity index 50% rename from MANIFEST.IN rename to MANIFEST.in index 6607396..e2cb9a8 100644 --- a/MANIFEST.IN +++ b/MANIFEST.in @@ -1,4 +1,6 @@ recursive-include scraibe *.py recursive-include scraibe *.yaml +recursive-exclude test/* +global-include requirements.txt global-exclude *.pyc -global-exclude __pycache__ \ No newline at end of file +global-exclude __pycache__ diff --git a/scraibe/version.py b/scraibe/version.py index bce39ee..9c4faa5 100644 --- a/scraibe/version.py +++ b/scraibe/version.py @@ -4,8 +4,9 @@ import subprocess as sp MAJOR = 0 MINOR = 1 MICRO = 1 +NANO = 2 ISRELEASED = False -VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO) +VERSION = '%d.%d.%d.%d' % (MAJOR, MINOR, MICRO, NANO) # Return the git revision as a string # taken from numpy/numpy diff --git a/setup.cfg b/setup.cfg index 3e2cac7..7ecab8c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -4,7 +4,8 @@ version = attr: scraibe.__version__ author = Jacob Schmieder author_email = Jacob.Schmieder@dbfz.de description = My package description -long_description = file: README.md, LICENSE +long_description = file: README.md, file: LICENSE +long_description_content_type = text/markdown; charset=UTF-8; variant=GFM platforms = Linux keywords = transcription speech recognition whisper pyannote audio speech-to-text speech-to-text transcription speech-to-text recognition voice-to-speech license = GPL-3.0 diff --git a/setup.py b/setup.py index c2b37d4..3dfc95e 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,4 @@ import os -import re from setuptools import setup, find_packages module_name = "scraibe" @@ -27,30 +26,32 @@ version["ISRELEASED"] = True if "ISRELEASED" in os.environ else False with open(os.path.join(os.path.dirname(__file__), "requirements.txt")) as f: requirements = [line.strip() for line in f if line.strip() and not line.startswith('#')] + +print(f"Launch Version: {version['get_version'](build_version)}") + if __name__ == "__main__": setup( - name=module_name, - version=version["get_version"](build_version), - packages=find_packages(), - python_requires=">=3.8", - readme="README.md", + name = module_name, + version = version["get_version"](build_version), + packages = find_packages(), + python_requires = ">=3.8", + readme = "README.md", install_requires = requirements, - extras_require= { - "app" : "scraibe-webui @ https://github.com/JSchmie/ScrAIbe-WebUI" - } - , + extras_require = { + "app" : ["scraibe-webui"], + }, # dependency_links=[ # 'https://download.pytorch.org/whl/cu113', # ], - url= github_url, + url = github_url, - license='GPL-3', - author='Jacob Schmieder', - author_email='Jacob.Schmieder@dbfz.de', - description='Transcription tool for audio files based on Whisper and Pyannote', - classifiers=[ + license = 'GPL-3', + author = 'Jacob Schmieder', + author_email = 'Jacob.Schmieder@dbfz.de', + description = 'Transcription tool for audio files based on Whisper and Pyannote', + classifiers = [ 'Development Status :: 3 - Alpha', 'Environment :: GPU :: NVIDIA CUDA :: 11.2', 'License :: OSI Approved :: Open Software License 3.0 (OSL-3.0)', @@ -61,8 +62,8 @@ if __name__ == "__main__": keywords = ['transcription', 'speech recognition', 'whisper', 'pyannote', 'audio', 'ScrAIbe', 'scraibe', 'speech-to-text', 'speech-to-text transcription', 'speech-to-text recognition', 'voice-to-speech'], - package_data={'scraibe.app' : ["*.html", "*.svg","*.yml"]}, - entry_points={'console_scripts': - ['scraibe = scraibe.cli:cli']} - + include_package_data=True, + package_data = {'scraibe.app' : ["*.html", "*.svg","*.yml"]}, + entry_points = {'console_scripts': + ['scraibe = scraibe.cli:cli']} )