Skip to content

Commit

Permalink
replaced deprecated setup.py by pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
mmmaat committed Jul 31, 2024
1 parent 0089a5d commit 5f6c0f2
Show file tree
Hide file tree
Showing 11 changed files with 119 additions and 144 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:

strategy:
matrix:
python-version: ['3.7', '3.10', '3.12']
python-version: ['3.8', '3.10', '3.12']

steps:
- name: Checkout phonemizer
Expand All @@ -28,8 +28,8 @@ jobs:
- name: Install phonemizer
run: |
pip install --upgrade pip pytest pytest-cov setuptools
pip install .
pip install --upgrade pip setuptools
pip install .[test]
- name: Version phonemizer
run: phonemize --version
Expand All @@ -38,7 +38,7 @@ jobs:
run: pytest -v --cov=phonemizer --cov-report=xml test/

- name: Upload coverage to Codecov
if: ${{ matrix.python-version == '3.10' }}
if: ${{ matrix.python-version == '3.12' }}
uses: codecov/codecov-action@v2
with:
files: coverage.xml
Expand Down Expand Up @@ -87,8 +87,8 @@ jobs:
- name: Install phonemizer
run: |
pip install --upgrade pip pytest setuptools
pip install .
pip install --upgrade pip setuptools
pip install .[test]
- name: Version phonemizer
run: phonemize --version
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ jobs:
- name: Install phonemizer
run: |
pip install --upgrade pip setuptools
python setup.py install
pip install --upgrade pytest
pip install .[test]
- name: Version phonemizer
run: phonemize --version
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/publish_pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ jobs:
- name: Build phonemizer
run: |
pip install --upgrade pip pytest wheel
python setup.py install
pytest
python setup.py sdist bdist_wheel
pip install --upgrade pip wheel build
pip install .[test]
python -m build
- name: Publish to Pypi
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ jobs:
- name: Install phonemizer
run: |
pip install pytest setuptools
python setup.py install
pip install --upgrade pip setuptools
pip install .[test]
- name: Version phonemizer
run: |
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ COPY . /phonemizer

# install phonemizer and run the tests
RUN cd /phonemizer && \
python3 setup.py install && \
python3 -m pip install --upgrade pip setuptools && \
python3 -m pip install .[test] && \
phonemize --version && \
python3 -m pytest -v test
9 changes: 9 additions & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ Version numbers follow `semantic versioning <https://semver.org>`__.
not yet released
----------------

**Requires python>=3.8 (was 3.6 in previous versions). Tests now requires pytest>=6.0**

* **improvments**

* Replaced dependency to deprecated ``pkg_resources`` by ``importlib``
(requires python>=3.8).

* Replaced deprecated ``setup.py`` by ``pyproject.toml``.

* **bug fix**

* ``espeak`` backend: words mismatch now works when using custom word
Expand Down
5 changes: 3 additions & 2 deletions docs/source/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ Install **espeak-ng** with the `.msi` Windows installer provided with
**mbrola** is not available for Windows.



Phonemizer
----------

Expand All @@ -116,6 +115,8 @@ Phonemizer
git clone https:/bootphon/phonemizer
cd phonemizer
pip install .
# to run tests or build this documentation, have a
# pip install .[test,doc]
If you experiment an error such as ``ImportError: No module named setuptools``
during installation, refer to `issue #11 <https:/bootphon/phonemizer/issues/11>`_.
Expand Down Expand Up @@ -148,5 +149,5 @@ suite from the root ``phonemizer`` folder (once you installed ``pytest``):

.. code-block:: bash
pip install pytest
pip install .[test] # this installs pytest
pytest
21 changes: 3 additions & 18 deletions phonemizer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,8 @@
# along with phonologizer. If not, see <http://www.gnu.org/licenses/>.
"""Multilingual text to phones converter"""

from .phonemize import phonemize # pylint: disable=unused-import

__version__ = '3.2.1'
"""Phonemizer version"""


try: # pragma: nocover
# This variable is injected in the __builtins__ by the build process. In
# that case we don't want to import phonemize as there are missing
# dependencies.
__PHONEMIZER_SETUP__
except NameError:
__PHONEMIZER_SETUP__ = False


if __PHONEMIZER_SETUP__: # pragma: nocover
import sys
sys.stderr.write(
'Partial import of phonemizer during the build process.\n')
else:
from .phonemize import phonemize # pylint: disable=unused-import
__version__ = '3.3.0-dev'
"""Phonemizer version"""
90 changes: 90 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Copyright 2015-2021 Mathieu Bernard
#
# This file is part of phonemizer: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# Phonemizer is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with phonemizer. If not, see <http://www.gnu.org/licenses/>.

[build-system]
requires = ["setuptools >= 61.0"]
build-backend = "setuptools.build_meta"

[project]
name = "phonemizer"
description = "Simple text to phones converter for multiple languages"
authors = [
{name = "Mathieu Bernard", email = "[email protected]"},
{name = "Hadrien Titeux"}]
readme = "README.md"
license = {file = "LICENSE"}
keywords = [
"linguistics",
"G2P",
"phone",
"espeak",
"festival",
"TTS"]
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: ",
"GNU General Public License v3 or later (GPLv3+)",
"Operating System :: OS Independent"]

requires-python = ">= 3.8"
dynamic = ["version"]
dependencies = [
"joblib",
"segments",
"attrs>=18.1",
"dlinfo",
"typing-extensions"]

[project.optional-dependencies]
test = ["pytest>=6.0", "pytest-cov", "coverage[toml]"]
doc = ["sphinx", "sphinx_rtd_theme"]

[project.scripts]
phonemize = "phonemizer.main:main"

[project.urls]
Documentation = "https://bootphon.github.io/phonemizer/"
Repository = "https:/bootphon/phonemizer"
Issues = "https:/bootphon/phonemizer"
Changelog = "https:/bootphon/phonemizer/blob/master/docs/source/changelog.rst"

[tool.setuptools.package-data]
phonemizer = [
"share/espeak/*",
"share/festival/*",
"share/segments/*"]

[tool.setuptools.dynamic]
version = {attr = "phonemizer.__version__"}

[tool.pytest.ini_options]
minversion = "6.0"
testpaths = "test"
python_files = ["test/*.py"]
filterwarnings = [
# ignore some deprecation warnings (on regexp escape sequence) for segments
# module and its dependencies
"ignore::DeprecationWarning:.*segments.*",
"ignore::DeprecationWarning:.*csvw.*",
"ignore::DeprecationWarning:.*clldutils.*",
# ignore a warning issued by joblib about multithreading
"ignore:This process (.*) is multi-threaded.*:DeprecationWarning:joblib"]
addopts = "--cov=phonemizer"

[tool.coverage.report]
exclude_lines = [
"pragma: nocover",
"@abc.abstractmethod"]
skip_covered = true
22 changes: 0 additions & 22 deletions setup.cfg

This file was deleted.

87 changes: 0 additions & 87 deletions setup.py

This file was deleted.

0 comments on commit 5f6c0f2

Please sign in to comment.