Skip to content

Commit

Permalink
feat: switching to using pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelLarkin committed Nov 12, 2024
2 parents 1f661dd + 7ac1f70 commit a33445b
Show file tree
Hide file tree
Showing 9 changed files with 199 additions and 195 deletions.
110 changes: 55 additions & 55 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,24 @@ jobs:
needs:
- test
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v4
with:
token: ${{ secrets.SGILE_PAT }}
submodules: recursive
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install pypa/build
run: python3 -m pip install build
- name: Build a binary wheel and a source tarball
run: python -m build --sdist --wheel
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Checkout repository and submodules
uses: actions/checkout@v4
with:
token: ${{ secrets.SGILE_PAT }}
submodules: recursive
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install pypa/build
run: python3 -m pip install build
- name: Build a binary wheel and a source tarball
run: python -m build --sdist --wheel
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

github-release:
name: >-
Expand All @@ -48,34 +48,34 @@ jobs:
- build
runs-on: ubuntu-latest
permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Sign the dists with Sigstore
uses: sigstore/[email protected]
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Update CHANGELOG
id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
tag: ${{ github.ref_name }}
- name: Create Release
uses: ncipollo/[email protected]
with:
allowUpdates: true
name: ${{ github.ref_name }}
tag: ${{ github.ref_name }}
body: ${{ steps.changelog.outputs.changes }}
token: ${{ github.token }}
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Sign the dists with Sigstore
uses: sigstore/[email protected]
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Update CHANGELOG
id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
tag: ${{ github.ref_name }}
- name: Create Release
uses: ncipollo/[email protected]
with:
allowUpdates: true
name: ${{ github.ref_name }}
tag: ${{ github.ref_name }}
body: ${{ steps.changelog.outputs.changes }}
token: ${{ github.token }}

doc-deploy:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -127,14 +127,14 @@ jobs:
name: pypi
url: https://pypi.org/p/everyvoice
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
4 changes: 1 addition & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ jobs:
- name: Install dependencies and package
run: |
CUDA_TAG=cpu pip install -r requirements.torch.txt --find-links https://download.pytorch.org/whl/torch_stable.html
pip install -r requirements.dev.txt
pip install cython
pip install -e .
pip install -e .[dev]
pip install coverage
- run: pip freeze
- run: pip list
Expand Down
4 changes: 2 additions & 2 deletions make-everyvoice-env
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,15 @@ r pip install cython

# pycountry and pyworld don't always compile cleanly, but we can fall back to
# using conda-forge if necessary
PY_COUNTRY_WORLD=$(grep "pycountry\|pyworld" requirements.txt)
PY_COUNTRY_WORLD=$(grep -o "\(pycountry\|pyworld\)==[0-9.]\+" pyproject.toml)
if ! r pip install $PY_COUNTRY_WORLD; then
echo Falling back to installing pycountry and pyworld from conda-forge
r conda install -y $PY_COUNTRY_WORLD -c conda-forge
fi

r conda install -y sox -c conda-forge
r pip install -e .
r pip install -r requirements.dev.txt
r pip install .[dev]
echo ""
echo "Environment creation completed with success"

Expand Down
141 changes: 141 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "EveryVoice"
description = "Text-to-Speech Synthesis for the Speech Generation for Indigenous Language Education Small Teams Project"
license = { file = "LICENSE" }
authors = [
{ name = "Aidan Pine", email = "[email protected]" },
{ name = "Eric Joanis", email = "[email protected]" },
{ name = "Marc Tessier", email = "[email protected]" },
{ name = "Mengzhe Geng", email = "[email protected]" },
{ name = "Samuel Larkin", email = "[email protected]" },
{ name = "Vladislav Govor" },
{ name = "David Guzmán", email = "[email protected]" },
]
maintainers = [
{ name = "Aidan Pine", email = "[email protected]" },
{ name = "Eric Joanis", email = "[email protected]" },
{ name = "Samuel Larkin", email = "[email protected]" },
]
readme = "README.md"
requires-python = ">=3.10, <3.12"
keywords = ["TTS", "CLI"]
classifiers = [
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: End Users/Desktop",
"Intended Audience :: Other Audience",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: MacOS :: MacOS X",
"Operating System :: MacOS",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: Implementation",
"Programming Language :: Python",
"Programming Language :: Unix Shell",
"Topic :: Multimedia :: Sound/Audio :: Speech",
"Typing :: Typed",
]
dependencies = [
"clipdetect>=0.1.4",
"deepdiff>=6.5.0",
"anytree>=2.12.1",
"einops==0.5.0",
"g2p~=2.0",
"gradio>=4.32.1",
"grapheme>=0.6.0",
"ipatok>=0.4.1",
"librosa==0.9.2",
"lightning>=2.0.0",
"loguru==0.6.0",
"matplotlib~=3.9.0",
"merge-args",
"nltk==3.9.1",
"numpy<2", # torch < 2.4.1 requires numpy < 2 but fails to declare it
"pandas~=2.0",
"panphon==0.20.0",
"protobuf~=4.25", # https://github.com/EveryVoiceTTS/EveryVoice/issues/387
"pycountry==22.3.5",
"pydantic[email]>=2.4.2,<2.8.0",
"pympi-ling",
"pysdtw==0.0.5",
"pyworld==0.3.4",
"PyYAML>=5.1",
"questionary==1.10.0",
"simple-term-menu==1.5.2",
"setuptools==59.5.0", # https://github.com/pytorch/pytorch/issues/69894
"tabulate==0.9.0",
"tensorboard>=2.14.1",
"torch==2.1.0",
"torchaudio==2.1.0",
"torchinfo==1.8.0",
"typer>=0.12.3",
"yaspin>=3.1.0",
]
dynamic = ["version"]

[project.optional-dependencies]
# [Specifying GPU version of pytorch for python package in pyproject.toml](https://discuss.pytorch.org/t/specifying-gpu-version-of-pytorch-for-python-package-in-pyproject-toml/209157)
torch = [
# these requirements have to be installed ahead of time in your environment and from a different URL:
# CUDA_TAG=cu118 pip install -r requirements.torch.txt --find-links https://download.pytorch.org/whl/torch_stable.html
'torch==2.1.0; sys_platform == "darwin"',
'torchaudio==2.1.0; sys_platform == "darwin"',
]
dev = [
"black~=24.3",
"flake8>=4.0.1",
"gitlint-core>=0.19.0",
"isort>=5.10.1",
"mypy>=1.8.0",
"pre-commit>=3.2.0",
"types-pyyaml>=6.0.5",
"types-requests>=2.27.11",
"types-setuptools>=57.4.9",
"types-tabulate==0.9.0",
"types-tqdm>=4.64,<5.0",
"everyvoice[test]",
]
test = ["jsonschema>=4.17.3", "pep440>=0.1.2"]

[project.scripts]
everyvoice = "everyvoice.cli:app"

[project.urls]
Homepage = "https://github.com/EveryVoiceTTS/EveryVoice"
Documentation = "https://docs.everyvoice.ca"
Repository = "https://github.com/EveryVoiceTTS/EveryVoice"
Issues = "https://github.com/EveryVoiceTTS/EveryVoice/issues"
Changelog = "https://github.com/EveryVoiceTTS/EveryVoice/releases"

[tool.flake8]
ignore = ["E203", "E266", "E501", "W503"]
max-line-length = 88
max-complexity = 18
select = ["B", "C", "E", "F", "W", "T4", "B9"]

[tool.hatch.version]
path = "everyvoice/_version.py"
# pattern = "VERSION = 'b(?P<version>[^']+)'"

[tool.isort]
known_first_party = "everyvoice"
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
line_length = 88
ensure_newline_before_comments = true

[tool.mypy]
files = "everyvoice"
ignore_missing_imports = true
plugins = ["pydantic.mypy", "numpy.typing.mypy_plugin"]
check_untyped_defs = false
14 changes: 0 additions & 14 deletions requirements.dev.txt

This file was deleted.

2 changes: 0 additions & 2 deletions requirements.test.txt

This file was deleted.

34 changes: 0 additions & 34 deletions requirements.txt

This file was deleted.

19 changes: 0 additions & 19 deletions setup.cfg

This file was deleted.

Loading

0 comments on commit a33445b

Please sign in to comment.