diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index da51e986..00000000 --- a/.coveragerc +++ /dev/null @@ -1,7 +0,0 @@ -[run] -branch = True -source_pkgs = g2p -omit = g2p/tests/* - -[report] -precision = 2 diff --git a/.flake8 b/.flake8 new file mode 100644 index 00000000..118cfdfb --- /dev/null +++ b/.flake8 @@ -0,0 +1,7 @@ +# NOTE: This is actually ignored by flake8 in pre-commit for some +# reason but it will get used in editors. How to make flake8 read it? +# Who knows? flake8 is a mystery. + +[flake8] +max-line-length = 120 +extend-ignore = E203,E704 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 0e3e2427..f174e61a 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -18,10 +18,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -e . - - name: Install documentation dependencies - run: | - pip install -r docs/requirements.txt + pip install -e .[docs] - name: Setup doc deploy run: | git config user.name 'github-actions[bot]' diff --git a/.github/workflows/matrix-tests.yml b/.github/workflows/matrix-tests.yml index cf8b475b..b34e21d1 100644 --- a/.github/workflows/matrix-tests.yml +++ b/.github/workflows/matrix-tests.yml @@ -18,7 +18,6 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements/requirements.test.txt - pip install -e . + pip install -e .[test,api] - name: Run tests run: python run_tests.py dev diff --git a/.github/workflows/pythonpublish.yml b/.github/workflows/pythonpublish.yml index ad34822b..7e460a49 100644 --- a/.github/workflows/pythonpublish.yml +++ b/.github/workflows/pythonpublish.yml @@ -92,10 +92,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -e . - - name: Install documentation dependencies - run: | - pip install -r docs/requirements.txt + pip install -e .[docs] - name: Setup doc deploy run: | git config user.name 'github-actions[bot]' diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 844c0abd..b55f9e5b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,6 +4,13 @@ on: - push - workflow_call +# Since we don't checkout the full history, set a default version so +# certain tests (pep440, update_schema) will still function. NOTE: +# This **must** match the Major.Minor version of the JSON schema file +# in g2p/mappings/.schema!!! +env: + SETUPTOOLS_SCM_PRETEND_VERSION: "2.0" + jobs: test-all-on-linux: # This is our main test job, exercising everything and uploading to coverage @@ -17,9 +24,8 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt - pip install -r requirements/requirements.test.txt - pip install -e . + pip install -e .[test] + pip install gunicorn pip install pip-licenses if pip-licenses | grep -v 'Artistic License' | grep -v LGPL | grep GNU; then echo 'Please avoid introducing *GPL dependencies'; false; fi pip install coverage @@ -81,6 +87,8 @@ jobs: if: ${{ !contains(github.event.head_commit.message, '#no-ci') }} steps: - uses: actions/checkout@v4 + with: + fetch-tags: true - name: Set up Python uses: actions/setup-python@v5 with: @@ -88,8 +96,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements/requirements.test.txt - pip install -e . + pip install -e .[test] - name: Run tests on Windows run: python run_tests.py dev - name: Make sure the CLI outputs utf8 on Windows diff --git a/.gitignore b/.gitignore index 470931ca..ef425ae8 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,4 @@ docs/_build/ # mkdocs build site +g2p/_version.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1fa57c55..0d87253d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,7 +9,7 @@ repos: exclude: \.svg$ - repo: local # Using local repos because these won't work for me from remote repo -EJ - # They're also more convenient because we install them via requirements.dev.txt + # They're also more convenient because we install them via optional deps # and they are then available on the command line as well as in pre-commit. hooks: - id: isort @@ -32,6 +32,7 @@ repos: stages: [commit] - repo: https://github.com/pycqa/flake8 # do flake8 last to avoid duplicate reports - rev: 3.8.3 + rev: 5.0.4 hooks: - - id: flake8 + - id: flake8 + args: ["--max-line-length=120", "--extend-ignore=E203,E704"] diff --git a/.pylintrc b/.pylintrc deleted file mode 100644 index 1a320518..00000000 --- a/.pylintrc +++ /dev/null @@ -1,8 +0,0 @@ -[MAIN] -disable= - # We use isort for sorting our imports, so nevermind what pylint thinks - wrong-import-order, - # I find the "unnecessary" else makes code more readable - no-else-return, - # We use single letter e for exception, f for file handles - invalid-name diff --git a/Contributing.md b/Contributing.md index 5fda71fd..92cf9c87 100644 --- a/Contributing.md +++ b/Contributing.md @@ -17,11 +17,18 @@ them in. ## TL;DR -Please considering running these commands in each of your sandboxes to enable our -pre-commit hooks and commitlint: +Please consider using the `dev` environment with `hatch` to do +development, which enables some checking of Git commits and messages: ```sh -pip install -r requirements/requirements.dev.txt +hatch -e dev shell +``` + +If you have a pre-existing virtual environment (sandbox), you can also +install the required packages with `pip`: + +```sh +pip install -e .[dev] pre-commit install gitlint install-hook ``` @@ -53,15 +60,30 @@ All the pre-commit hooks are executed using a tool called [pre-commit](https://pre-commit.com/). Once you enable pre-commit, it will run all the hooks each time you try to commit anything in this repo. -We've listed all the developper dependencies for the project in -[requirements/requirements.dev.txt](requirements/requirements.dev.txt) to make them easy to install: +We've added all the developer dependencies for the project to the +`dev` environment to make them easy to install with `hatch`. In +addition, `pre-commit` and `gitlint` hooks will be installed on +creation of this environment. Note that you will have to use the +`dev` environment when committing since pre-commit is installed there. +You can either start a shell: ```sh -pip install -r requirements/requirements.dev.txt -pre-commit install +hatch -e dev shell ``` -Note that you have to run the second command in every g2p sandbox you create. +Or run commands in the environment: + +```sh +hatch -e dev run git commit -m 'chore: foo bar baz' +``` + +If you have a pre-existing virtual environment (sandbox), you can also +install the required packages with `pip`: + +```sh +pip install -e .[dev] +pre-commit install +``` ## commitlint @@ -115,10 +137,26 @@ These rules are inspired by these commit formatting guides: We run commitlint on each commit message that you write by enabling the commit-msg hook in Git. -Run this command in your g2p sandbox to install and enable the commit-msg hook: +The commit-msg hook is enabled on creation of the `dev` environment +with `hatch`. Note that you will have to use the `dev` environment +when committing since pre-commit is installed there. You can either +start a shell: + +```sh +hatch -e dev shell +``` + +Or run commands in the environment: + +```sh +hatch -e dev run git commit -m 'chore: foo bar baz' +``` + +If you have a pre-existing virtual environment (sandbox), you can also +install the required packages with `pip`: ```sh -pip install -r requirements/requirements.dev.txt +pip install -e .[dev] gitlint install-hook ``` diff --git a/README.md b/README.md index 277c7e34..8bdb5ebb 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,21 @@ The initial version of this package was developed by [Patrick Littell](https://g The best thing to do is install with pip `pip install g2p`. This command will install the latest release published on [PyPI g2p releases](https://pypi.org/project/g2p/). -You can also clone the repo and pip install it locally: +You can also use [hatch](https://hatch.pypa.io/latest/) (see [hatch +installation instructions](https://hatch.pypa.io/latest/install/)) to +set up an isolated local development environment, which may be useful +if you wish to contribute new mappings: + +```sh +$ git clone https://github.com/roedoejet/g2p.git +$ cd g2p +$ hatch shell +``` + +You can also simply install an "editable" version with `pip` (but it +is recommended to do this in a [virtual +environment](https://docs.python.org/3/library/venv.html) or a [conda +environment](https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html)): ```sh $ git clone https://github.com/roedoejet/g2p.git @@ -52,6 +66,7 @@ $ cd g2p $ pip install -e . ``` + ## Usage The easiest way to create a transducer is to use the `g2p.make_g2p` function. @@ -251,7 +266,7 @@ mappings: 4. Add a mapping file. Look at the other mappings for examples, or visit the [g2p studio](https://g2p-studio.herokuapp.com) to practise your mappings. Mappings are defined in either a CSV or json file. See [writing mapping files](#writing-mapping-files) for more info. -5. After installing your local version (`pip3 install -e .`), update with `g2p update` +5. Start a development shell with `hatch shell` (or install an editable version with `pip install -e .`) then update with `g2p update` 6. Add some tests in `g2p/testspublic/data/.psv`. Each line in the file will run a test with the following structure: `|||` 7. Run `python3 run_tests.py langs` to make sure your tests pass. 8. Make sure you have [checked all the boxes](https://github.com/roedoejet/g2p/blob/main/.github/pull_request_template.md) and make a [pull request]((https://github.com/roedoejet/g2p/pulls)! diff --git a/docs/installation.md b/docs/installation.md index 8ce65b6a..39653738 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -19,3 +19,10 @@ cd g2p pip install -e . ``` + +To install in an isolated environment (recommended for development) +you may use [hatch](https://hatch.pypa.io/latest/): + +``` +hatch shell +``` diff --git a/docs/requirements.txt b/docs/requirements.txt deleted file mode 100644 index 43d088b3..00000000 --- a/docs/requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -mkdocs>=1.5.2 -mkdocs-click>=0.8.0 -mkdocs-material>=9.2.5 -mkdocstrings[python]>=0.22.0 -mike>=1.1.2 diff --git a/g2p/_version.py b/g2p/_version.py deleted file mode 100644 index 21014090..00000000 --- a/g2p/_version.py +++ /dev/null @@ -1 +0,0 @@ -VERSION = "2.0.0" diff --git a/g2p/tests/test_cli.py b/g2p/tests/test_cli.py index bafa44a7..098d7ba7 100755 --- a/g2p/tests/test_cli.py +++ b/g2p/tests/test_cli.py @@ -10,10 +10,10 @@ import jsonschema import yaml +from click.testing import CliRunner from tqdm import tqdm from g2p._version import VERSION -from g2p.app import APP from g2p.cli import ( convert, doctor, @@ -39,7 +39,7 @@ class CliTest(TestCase): """Test suite for the g2p Command Line Interface""" def setUp(self): - self.runner = APP.test_cli_runner() + self.runner = CliRunner() def test_update(self): result = self.runner.invoke(update) @@ -97,6 +97,19 @@ def test_update(self): result = self.runner.invoke(update, ["-i", bad_langs_dir, "-o", tmpdir]) self.assertEqual(result.exit_code, 0) + def test_schema_ci_version(self): + """Make sure that the version (possibly a fake version - see + .github/workflows/tests.yml) matches the one in the schema.""" + MAJOR_MINOR_VERSION = ".".join(VERSION.split(".")[:2]) + self.assertTrue( + ( + Path(__file__).parent.parent + / "mappings" + / ".schema" + / f"g2p-config-schema-{MAJOR_MINOR_VERSION}.json" + ).exists() + ) + def test_update_schema(self): result = self.runner.invoke(update_schema) self.assertNotEqual(result.exit_code, 0) diff --git a/g2p/tests/test_doctor_expensive.py b/g2p/tests/test_doctor_expensive.py index 13eee00b..88090518 100755 --- a/g2p/tests/test_doctor_expensive.py +++ b/g2p/tests/test_doctor_expensive.py @@ -2,7 +2,8 @@ from unittest import TestCase, main -from g2p.app import APP +from click.testing import CliRunner + from g2p.cli import doctor from g2p.log import LOGGER from g2p.mappings.langs.utils import check_ipa_known_segs @@ -23,7 +24,7 @@ def test_doctor_cli(self): # TODO: assert something more useful here... # This test simulates calling "g2p doctor" on the command line with no arguments, # which runs doctor on all mappings. - runner = APP.test_cli_runner() + runner = CliRunner() with self.assertLogs(LOGGER, level="WARNING") as cm: result = runner.invoke(doctor) self.assertEqual(result.exit_code, 0) diff --git a/g2p/tests/test_studio.py b/g2p/tests/test_studio.py index e7b66eb8..f9144370 100755 --- a/g2p/tests/test_studio.py +++ b/g2p/tests/test_studio.py @@ -3,7 +3,7 @@ """ Test suite for the g2p-studio web app. -Requirements: python 3.8 and requirements/requirements.test.txt +Requirements: python 3.8 and `test` dependencies Before running this test suite, launch the g2p-studio server: minimal dev mode: @@ -27,7 +27,7 @@ # flake8: noqa: C901 from unittest import IsolatedAsyncioTestCase, main -from playwright.async_api import async_playwright +from playwright.async_api import async_playwright # type: ignore from g2p.app import APP, SOCKETIO from g2p.log import LOGGER diff --git a/g2p/tests/test_utils.py b/g2p/tests/test_utils.py index 4bc80971..3883bdc8 100755 --- a/g2p/tests/test_utils.py +++ b/g2p/tests/test_utils.py @@ -10,10 +10,8 @@ from unittest import TestCase, main import yaml -from pep440 import is_canonical from g2p import get_arpabet_langs -from g2p._version import VERSION from g2p.exceptions import IncorrectFileType, RecursionError from g2p.log import LOGGER from g2p.mappings import Mapping, utils @@ -299,9 +297,6 @@ def test_get_arpabet_langs(self): self.assertIs(LANGS2, LANGS) self.assertIs(LANG_NAMES2, LANG_NAMES) - def test_version_is_pep440_compliant(self): - self.assertTrue(is_canonical(VERSION)) - if __name__ == "__main__": main() diff --git a/g2p/tests/test_z_local_config.py b/g2p/tests/test_z_local_config.py index b962e3a2..15690701 100755 --- a/g2p/tests/test_z_local_config.py +++ b/g2p/tests/test_z_local_config.py @@ -21,9 +21,9 @@ from unittest import TestCase, main import yaml +from click.testing import CliRunner from g2p import exceptions -from g2p.app import APP from g2p.cli import convert, generate_mapping from g2p.mappings import Mapping from g2p.mappings.utils import normalize @@ -32,7 +32,7 @@ class LocalConfigTest(TestCase): def setUp(self): - self.runner = APP.test_cli_runner() + self.runner = CliRunner() self.mappings_dir = Path(PUBLIC_DIR) / "mappings" def test_local_config(self): diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..79e74800 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,213 @@ +[build-system] +requires = ["hatchling", "hatch-vcs"] +build-backend = "hatchling.build" + +[project] +name = "g2p" +dynamic = ["version"] +description = "Module for creating context-aware, rule-based G2P mappings that preserve indices" +readme = "README.md" +license = "MIT" +requires-python = ">= 3.7" +authors = [ + { name = "Aidan Pine", email = "hello@aidanpine.ca" }, +] +classifiers = [ + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", +] +dependencies = [ + "click>=8.0.4", + "coloredlogs>=15.0.1", + "networkx>=2.6", + "openpyxl", + "panphon>=0.19", + "pydantic>=2.3", + "pyyaml>=5.2", + "regex", + "text_unidecode", + "tqdm", +] + +[project.optional-dependencies] +api = [ + "eventlet>=0.36.1", + "flask-cors>=3.0.9", + "flask-restful>=0.3.9", + "flask-talisman>=0.7.0", + "flask<2.3; python_version < '3.8'", + "flask; python_version >= '3.8'", + "flask_socketio>=5.0.0", + "python-engineio>=4.0.0", + "python-socketio>=5.0.0", + "fastapi", +] +test = [ + "g2p[api]", + "coverage[toml]>=6.5", + "playwright>=1.26.1", + "jsonschema>=4.17.3", + "pep440>=0.1.2", +] +dev = [ + "g2p[test]", + "black>=23; python_version < '3.8'", + "black~=24.3; python_version >= '3.8'", + "gitlint>=0.17.0", + "isort>=5.10.1", + "mypy>=1; python_version < '3.8'", + "mypy>=1.8.0; python_version >= '3.8'", + "pre-commit>=2.6.0", +] +# This one is a bit special and cannot depend on other features, +# because if it depends on `g2p[api]` then we end up with +# `g2p==SOMEVERSION` in requirements.txt and we DO NOT want that to +# happen. +# See https://github.com/jazzband/pip-tools/issues/2002 +# See https://github.com/juftin/hatch-pip-compile/issues/78 +prod = [ + "gunicorn>=21.1.0", +] +docs = [ + "mkdocs>=1.5.2", + "mkdocs-click>=0.8.0", + "mkdocs-material>=9.2.5", + "mkdocstrings[python]>=0.22.0", + "mike>=1.1.2", +] + +[project.scripts] +g2p = "g2p.cli:cli" + +[project.urls] +Homepage = "https://github.com/roedoejet/g2p" + +[tool.setuptools] +packages = ["g2p"] +include-package-data = true + +[tool.hatch.version] +source = "vcs" + +[tool.hatch.build.hooks.vcs] +version-file = "g2p/_version.py" +template = """ +# file generated by setuptools_scm +# don't change, don't track in version control +TYPE_CHECKING = False +if TYPE_CHECKING: + from typing import Tuple, Union + VERSION_TUPLE = Tuple[Union[int, str], ...] +else: + VERSION_TUPLE = object + +VERSION: str +version: str +__version__: str +__version_tuple__: VERSION_TUPLE +version_tuple: VERSION_TUPLE + +VERSION = __version__ = version = {version!r} +__version_tuple__ = version_tuple = {version_tuple!r} +""" + +[tool.hatch.build.targets.sdist] +include = [ + "/g2p", +] + +[tool.hatch.env] +requires = [ + "hatch-pip-compile" +] + +[tool.hatch.envs.api] +features = [ "api" ] + +[tool.hatch.envs.api.scripts] +serve = "flask --app g2p.app run" +routes = "flask --app g2p.app routes" + +[tool.hatch.envs.prod] +template = "api" +features = [ "api", "prod" ] +type = "pip-compile" +python = "3.10" +lock-filename = "requirements.txt" +pip-compile-verbose = false + +[tool.hatch.envs.prod.scripts] +serve = "gunicorn --worker-class eventlet -w 1 g2p.app:APP --no-sendfile" + +[tool.hatch.envs.test] +features = [ "test" ] + +[[tool.hatch.envs.test.matrix]] +python = ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + +[tool.hatch.envs.test.scripts] +serve-cov = "coverage run -m flask --app g2p.app run" +test = "python run_tests.py dev" +test-cov = "coverage run run_tests.py dev" +test-studio = "python g2p/tests/test_studio.py" +cov-report = [ + "- coverage combine", + "coverage report", +] +cov = [ + "test-cov", + "cov-report", +] + +[tool.hatch.envs.dev] +features = [ "dev" ] +post-install-commands = [ + "pre-commit install", + "gitlint install-hook || true", +] + +[tool.hatch.envs.dev.scripts] +check = "mypy --install-types --non-interactive {args:g2p}" + +[tool.coverage.run] +source_pkgs = ["g2p"] +branch = true +parallel = true +omit = [ + "g2p/_version.py", + "g2p/tests/**/*.py", +] + +[tool.coverage.report] +precision = 2 + +[tool.mypy] +plugins = ["pydantic.mypy"] + +[tool.isort] +profile = "black" + +[tool.pylint.main] +# Unsure how to make pylint recursively ignore +ignore = [ + "g2p/tests", + "g2p/tests/public", + "g2p/tests/public/data", +] + +[tool.pylint.messages_control] +# This is TOO LONG but the code is that way for the moment +max-line-length = 120 +good-names = [ + # We use single letter e for exception, f for file handles + "e", "f", +] +disable = [ + # We do this to speed loading time, sorry pylint but not sorry + "import-outside-toplevel", + # We use isort for sorting our imports, so nevermind what pylint thinks + "wrong-import-order", + # I find the "unnecessary" else makes code more readable + "no-else-return", +] diff --git a/readme-heroku.md b/readme-heroku.md index 314784ae..53b78ebf 100644 --- a/readme-heroku.md +++ b/readme-heroku.md @@ -3,4 +3,11 @@ Our production Heroku deployment is controlled by the following files: - `runtime.txt`: tells Heroku which run-time engine to use (i.e., which version of Python); Heroku detects Python by default, but `runtime.txt` lets us specify/bump the version as needed; - - `requirements.txt`: tells Heroku what our production dependencies are. + - `requirements.txt`: tells Heroku what our production dependencies + are. This is managed by `hatch` now. You will need to make sure + the Python version in the `[tool.hatch.envs.prod]` section matches + the one in `runtime.txt`. Now you can update the requirements with: + + hatch env remove prod + rm -f requirements.txt + hatch env create prod diff --git a/requirements.txt b/requirements.txt index 952b4b34..f8360643 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,132 @@ -# Minimal requirements for all uses of g2p --r requirements/requirements.txt -# Additional requirements for production deployment --r requirements/requirements.prod.txt +# +# This file is autogenerated by hatch-pip-compile with Python 3.10 +# +# - click>=8.0.4 +# - coloredlogs>=15.0.1 +# - networkx>=2.6 +# - openpyxl +# - panphon>=0.19 +# - pydantic>=2.3 +# - pyyaml>=5.2 +# - regex +# - text-unidecode +# - tqdm +# - eventlet!=0.36.0,>=0.33.0 +# - flask-cors>=3.0.9 +# - flask-restful>=0.3.9 +# - flask-socketio>=5.0.0 +# - flask-talisman>=0.7.0 +# - flask; python_version >= "3.8" +# - flask<2.3; python_version < "3.8" +# - python-engineio>=4.0.0 +# - python-socketio>=5.0.0 +# - gunicorn>=21.1.0 +# + +aniso8601==9.0.1 + # via flask-restful +annotated-types==0.6.0 + # via pydantic +bidict==0.23.1 + # via python-socketio +blinker==1.7.0 + # via flask +click==8.1.7 + # via + # hatch.envs.prod + # flask +coloredlogs==15.0.1 + # via hatch.envs.prod +dnspython==2.6.1 + # via eventlet +editdistance==0.8.1 + # via panphon +et-xmlfile==1.1.0 + # via openpyxl +eventlet==0.36.1 + # via hatch.envs.prod +flask==3.0.2 ; python_version >= "3.8" + # via + # hatch.envs.prod + # flask-cors + # flask-restful + # flask-socketio +flask-cors==4.0.0 + # via hatch.envs.prod +flask-restful==0.3.10 + # via hatch.envs.prod +flask-socketio==5.3.6 + # via hatch.envs.prod +flask-talisman==1.1.0 + # via hatch.envs.prod +greenlet==3.0.3 + # via eventlet +gunicorn==21.2.0 + # via hatch.envs.prod +h11==0.14.0 + # via wsproto +humanfriendly==10.0 + # via coloredlogs +itsdangerous==2.1.2 + # via flask +jinja2==3.1.3 + # via flask +markupsafe==2.1.5 + # via + # jinja2 + # werkzeug +munkres==1.1.4 + # via panphon +networkx==3.2.1 + # via hatch.envs.prod +numpy==1.26.4 + # via panphon +openpyxl==3.1.2 + # via hatch.envs.prod +packaging==24.0 + # via gunicorn +panphon==0.20.0 + # via hatch.envs.prod +pydantic==2.6.4 + # via hatch.envs.prod +pydantic-core==2.16.3 + # via pydantic +python-engineio==4.9.0 + # via + # hatch.envs.prod + # python-socketio +python-socketio==5.11.2 + # via + # hatch.envs.prod + # flask-socketio +pytz==2024.1 + # via flask-restful +pyyaml==6.0.1 + # via + # hatch.envs.prod + # panphon +regex==2023.12.25 + # via + # hatch.envs.prod + # panphon +simple-websocket==1.0.0 + # via python-engineio +six==1.16.0 + # via flask-restful +text-unidecode==1.3 + # via hatch.envs.prod +tqdm==4.66.2 + # via hatch.envs.prod +typing-extensions==4.10.0 + # via + # pydantic + # pydantic-core +unicodecsv==0.14.1 + # via panphon +werkzeug==3.0.1 + # via flask +wsproto==1.2.0 + # via simple-websocket + +# The following packages are considered to be unsafe in a requirements file: +# setuptools diff --git a/requirements/readme.md b/requirements/readme.md deleted file mode 100644 index 239883f4..00000000 --- a/requirements/readme.md +++ /dev/null @@ -1,7 +0,0 @@ -All requirements for normal use are in `requirements.txt`. - -We use a specific version of gunicorn to run the g2p studio in production, and don't want to introduce git as a dependency, so we separate these requirements here into `requirements.prod.txt`. - -Requirements recommended for use during development but not needed for running g2p are separated into `requirements.dev.txt`. - -Requirements needed for running tests are in `requirements.test.txt`. diff --git a/requirements/requirements.dev.txt b/requirements/requirements.dev.txt deleted file mode 100644 index 544708ed..00000000 --- a/requirements/requirements.dev.txt +++ /dev/null @@ -1,9 +0,0 @@ -black~=24.3; python_version >= "3.8" -flake8>=4.0.1 -gitlint-core==0.17.0 -isort>=5.10.1 -mypy>=1.4.1 -mypy>=1.8.0; python_version >= "3.8" -pre-commit>=2.6.0 -types-PyYAML --r requirements.test.txt diff --git a/requirements/requirements.prod.txt b/requirements/requirements.prod.txt deleted file mode 100644 index 9f21dec9..00000000 --- a/requirements/requirements.prod.txt +++ /dev/null @@ -1 +0,0 @@ -gunicorn>=21.1.0 diff --git a/requirements/requirements.test.txt b/requirements/requirements.test.txt deleted file mode 100644 index eae11b39..00000000 --- a/requirements/requirements.test.txt +++ /dev/null @@ -1,3 +0,0 @@ -playwright>=1.26.1 -jsonschema>=4.17.3 -pep440>=0.1.2 diff --git a/requirements/requirements.txt b/requirements/requirements.txt deleted file mode 100644 index 0915cd11..00000000 --- a/requirements/requirements.txt +++ /dev/null @@ -1,22 +0,0 @@ -openpyxl -click>=8.0.4 -coloredlogs>=15.0.1 -dnspython>=2.1.0,<=2.3.0 -eventlet>=0.33.0,!=0.36.0 -flask-cors>=3.0.9 -flask-talisman>=0.7.0 -flask-restful>=0.3.9 -networkx>=2.6 -numpy>=1.20.2,<2 -panphon>=0.19 -pyyaml>=5.2 -regex -requests -tqdm -text_unidecode - -Flask==2.2.5 -flask_socketio>=5.0.0 -python-engineio>=4.0.0 -python-socketio>=5.0.0 -pydantic>=2.3 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index c2a70350..00000000 --- a/setup.cfg +++ /dev/null @@ -1,18 +0,0 @@ -[isort] -known_first_party = readalongs -multi_line_output=3 -include_trailing_comma=True -force_grid_wrap=0 -use_parentheses=True -line_length=88 -ensure_newline_before_comments=True - -[mypy] -ignore_missing_imports = True -plugins = pydantic.mypy - -[flake8] -ignore = E203, E302, E501, E999, W503 -max-line-length = 88 -max-complexity = 12 -select = B,C,E,F,W,B9 diff --git a/setup.py b/setup.py deleted file mode 100644 index 5ac549ad..00000000 --- a/setup.py +++ /dev/null @@ -1,46 +0,0 @@ -""" Setup for g2p -""" - -from os import path - -from setuptools import find_packages, setup - -# Ugly hack to read the current version number without importing g2p: -with open("g2p/_version.py", "r", encoding="utf8") as version_file: - namespace = {} # type: ignore - exec(version_file.read(), namespace) - VERSION = namespace["VERSION"] - -this_directory = path.abspath(path.dirname(__file__)) - -with open(path.join(this_directory, "README.md"), encoding="utf8") as f: - long_description = f.read() - -with open( - path.join(this_directory, "requirements", "requirements.txt"), encoding="utf8" -) as f: - REQS = f.read().splitlines() - -setup( - name="g2p", - python_requires=">=3.7", - version=VERSION, - author="Aidan Pine", - author_email="hello@aidanpine.ca", - license="MIT", - url="https://github.com/roedoejet/g2p", - description="Module for creating context-aware, rule-based G2P mappings that preserve indices", - long_description=long_description, - long_description_content_type="text/markdown", - platform=["any"], - packages=find_packages(), - include_package_data=True, - install_requires=REQS, - entry_points={"console_scripts": ["g2p = g2p.cli:cli"]}, - zip_safe=False, - classifiers=[ - "Programming Language :: Python :: 3", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - ], -)