From b645c426881f2480abf5d12ef83c6942e733b5dd Mon Sep 17 00:00:00 2001 From: Eric Joanis Date: Fri, 23 Oct 2026 14:43:19 -0400 Subject: [PATCH 1/4] refactor: move dev dependencies from extras to groups https://docs.astral.sh/uv/concepts/projects/dependencies/#dependency-groups https://packaging.python.org/en/latest/specifications/dependency-groups/ --- .github/workflows/docs.yml | 2 +- .github/workflows/matrix-tests.yml | 2 +- .github/workflows/pythonpublish.yml | 4 +-- .github/workflows/tests.yml | 4 +-- Contributing.md | 6 ++-- README.md | 11 +++---- docs/Contributing.md | 2 +- pyproject.toml | 47 ++++++++++++++++++----------- 8 files changed, 45 insertions(+), 33 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 68f52d89..a3662738 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -18,7 +18,7 @@ jobs: python-version: "3.10" - name: Install dependencies and Studio run: | - pip install -e .[docs] + pip install --group docs -e . - 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 c8d7f672..6ed994cf 100644 --- a/.github/workflows/matrix-tests.yml +++ b/.github/workflows/matrix-tests.yml @@ -48,6 +48,6 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install Python dependencies run: | - pip install -e .[all] + pip install --group dev -e . - name: Run tests run: pytest diff --git a/.github/workflows/pythonpublish.yml b/.github/workflows/pythonpublish.yml index 9a304db1..4d353aa5 100644 --- a/.github/workflows/pythonpublish.yml +++ b/.github/workflows/pythonpublish.yml @@ -46,7 +46,7 @@ jobs: shell: bash run: diff <(echo "VERSION = \"${VERSION#v}\"") <(head -1 readalongs/_version.py) - - name: Install dependencies + - name: Install build dependencies run: | python -m pip install --upgrade pip pip install build @@ -101,7 +101,7 @@ jobs: python-version: "3.10" - name: Install dependencies and Studio run: | - pip install -e .[docs] + pip install --group dev -e . - 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 7ec12f04..6391aace 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -46,7 +46,7 @@ jobs: # Keep pip up to date python -m pip install --upgrade pip # Install all Python dependencies in just one pip call, including Studio itself - pip install -e .[all] + pip install --group all -e . - name: Run tests run: | @@ -138,7 +138,7 @@ jobs: - name: Install Python dependencies run: | python -m pip install --upgrade pip - pip install -e .[all] + pip install --group all -e . - name: Run tests on Windows run: pytest diff --git a/Contributing.md b/Contributing.md index dc060c29..c3ba9452 100644 --- a/Contributing.md +++ b/Contributing.md @@ -16,7 +16,7 @@ commits. Run these commands in each of your sandboxes to enable our pre-commit hooks and commitlint: ```sh -pip install -e '.[dev]' +pip install --group dev -e . prek install gitlint install-hook ``` @@ -53,7 +53,7 @@ We've listed all the developper dependencies for the project in [pyproject.toml](pyproject.toml) to make them easy to install: ```sh -pip install -e '.[dev]' +pip install --group dev -e . prek install ``` @@ -115,7 +115,7 @@ commit-msg hook in Git. Run this command in your g2p sandbox to install and enable the commit-msg hook: ```sh -pip install -e '.[dev]' +pip install --group dev -e . gitlint install-hook ``` diff --git a/README.md b/README.md index 9aadd564..ddd35258 100644 --- a/README.md +++ b/README.md @@ -151,15 +151,14 @@ environment](https://docs.python.org/3/library/venv.html) though!): Run `readalongs -h` to confirm that installation was successful. -If you installed the current development version with Git, you can also run the +If you installed the current development version from GitHub, you can also run the full test suite, either with `hatch`: hatch test -or test the installed version (requires installing dev dependencies): +or with pytest (requires installing dev dependencies): - pip install 'readalongs[dev]' # if you installed from PyPI, or - pip install -e '.[dev]' # if you installed from a local clone + pip install --group dev -e . pytest And you can download our [open samples on GitHub](https://github.com/ReadAlongs/OpenSamples) @@ -259,8 +258,8 @@ This repo follows the [Contributor Covenant](http://contributor-covenant.org/ver You can install our standard Git hooks by running these commands in your sandbox: ```sh -pip install -e '.[dev]' -pre-commit install +pip install --group dev -e . +prek install gitlint install-hook ``` diff --git a/docs/Contributing.md b/docs/Contributing.md index e9ffa710..449157df 100644 --- a/docs/Contributing.md +++ b/docs/Contributing.md @@ -14,7 +14,7 @@ commands at the root of your Studio sandbox: 1. Install Studio and the required build software (mkdocs and friends): - pip install -e '.[docs]' + pip install --group docs -e . 2. Run this command to serve the documentation locally: diff --git a/pyproject.toml b/pyproject.toml index 7b5b3dcf..dc511a54 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,15 +55,7 @@ dependencies = [ ] [project.optional-dependencies] -dev = [ - "readalongs[api]", - "gitlint-core>=0.17.0", - "httpx>=0.24.1", # for testing with starlette<1.2 - "httpx2", # for testing with starlette>=1.2 - "pep440>=0.1.2", - "prek", - "pytest", -] +# Optional production dependency extras api = [ # gunivorn is only available on *nix, but it's only required for production deployments @@ -78,10 +70,31 @@ heroku = [ "ilt-panphon>=0.21.4,<0.22", ] -ci = [ +[dependency-groups] +# Optional development dependency groups + +dev = [ + {include-group = "test"}, + {include-group = "lint"}, +] + +all = [ + {include-group = "dev"}, + {include-group = "ci"}, + {include-group = "docs"}, +] + +test = [ "readalongs[api]", - "coverage", - "licensecheck", + "httpx>=0.24.1", # for testing with starlette<1.2 + "httpx2", # for testing with starlette>=1.2 + "pep440>=0.1.2", + "pytest", +] + +lint = [ + "gitlint-core>=0.17.0", + "prek", ] docs = [ @@ -94,10 +107,10 @@ docs = [ "mike>=2.1.1", ] -all = [ - "readalongs[dev]", - "readalongs[ci]", - "readalongs[docs]", +ci = [ + "readalongs[api]", + "coverage", + "licensecheck", ] [project.scripts] @@ -115,7 +128,7 @@ include = [ requires = [ "hatch-pip-compile" ] [tool.hatch.envs.hatch-test] -features = [ "dev" ] +dependency-groups = [ "dev" ] [tool.hatch.envs.prod] features = [ "heroku", "api" ] From 6278d79d126b9afbb98902aee0976147c536afa2 Mon Sep 17 00:00:00 2001 From: Eric Joanis Date: Fri, 23 Oct 2026 14:44:48 -0400 Subject: [PATCH 2/4] docs: clarify windows dep installs and remove references to Anaconda --- README.md | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index ddd35258..5d5cb000 100644 --- a/README.md +++ b/README.md @@ -96,34 +96,30 @@ The compiler should already be there, but run ` install gc ##### The easy way, using conda The `conda` package manager can install Python 3 and the required compiler automatically for you, -and simplifies ffmpeg and git installation. We recommend this solution. +and simplifies ffmpeg and git installation. -If the Anaconda Terms of Service are compatible with your organization, you can -use Miniconda3: download and run the latest "Miniconda3 Windows 64-bit" -installer from https://docs.conda.io/en/latest/miniconda.html. - -Fully open-source alternative, free for all organizations: Miniforge3. Download and run the latest "Miniforge3-Windows-x86_64" installer from -https://github.com/conda-forge/miniforge. - -Either way, you can accept all the default options suggested by the installer. +https://github.com/conda-forge/miniforge. You can accept all the default options suggested by the installer. -Launch an Anaconda Prompt or a Miniforge Prompt (this should be available from +Launch a Miniforge Prompt (this should be available from your Start Menu after installation) and run: conda install ffmpeg conda install git You can then run the pip install and git commands below, and use readalongs, all -from the Anaconda or Miniforge Prompt. +from the Miniforge Prompt. ##### The hard way If you know what you're doing, you can install the dependencies directly on your machine: - Install Python3 for Windows. - - Install [FFmpeg builds for Windows](https://ffmpeg.zeranoe.com/builds/) ([alternative instructions](https://windowsloop.com/install-ffmpeg-windows-10/)). - - Install [Visual Studio Build Tools](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2017) (search for "Build Tools", select C++ when prompted). + - Install ffmpeg one of these ways: + - Install [Pixi](https://pixi.prefix.dev/latest/installation/) and run `pixi global install ffmpeg` + - or download from the [Official FFmpeg source](https://ffmpeg.org/download.html#build-windows) + - or use [alternative instructions](https://windowsloop.com/install-ffmpeg-windows-10/). + - If the `pip install` commands below fail during a compilation step, install [Visual Studio Build Tools](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2017) (search for "Build Tools", select C++ when prompted). - Install Git for Windows (optional). ### Installing ReadAlongs Studio itself From 6fe53fb4ba3fb441af2901b861178f6c4fecf2c0 Mon Sep 17 00:00:00 2001 From: Eric Joanis Date: Fri, 23 Oct 2026 14:47:33 -0400 Subject: [PATCH 3/4] test: configure hatch matrix testing Run with all python versions 3.10+ using `hatch test -a`. But hatch no longer supports Python 3.9, so keep running that one with `uv run --python 3.9 pytest`. That point will be moot once #323 is merged, but leaving the comment here anyway. --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index dc511a54..16c3874e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -130,6 +130,9 @@ requires = [ "hatch-pip-compile" ] [tool.hatch.envs.hatch-test] dependency-groups = [ "dev" ] +[[tool.hatch.envs.hatch-test.matrix]] +python = ["3.10", "3.11", "3.12", "3.13", "3.14"] + [tool.hatch.envs.prod] features = [ "heroku", "api" ] type = "pip-compile" From 94f245c928652d4c777b3b10ab2d18acb7a56d17 Mon Sep 17 00:00:00 2001 From: Eric Joanis Date: Fri, 23 Oct 2026 16:12:04 -0400 Subject: [PATCH 4/4] fix: address deprecation warning by not using LazyFile directly In testing, we get warnings about the name click.utils.LazyFile being deprecated in click 9. Turns out we don't need that logic anyway, so just remove it. --- readalongs/api.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/readalongs/api.py b/readalongs/api.py index 165b2498..0706a117 100644 --- a/readalongs/api.py +++ b/readalongs/api.py @@ -150,14 +150,6 @@ def make_xml( Returns: (status, exception, log_text) """ - # plaintextfile is not a file object if passed from click - - plaintextfile = ( - plaintextfile.name - if isinstance(plaintextfile, click.utils.LazyFile) - else plaintextfile - ) - xmlfile = str(xmlfile) if isinstance(xmlfile, os.PathLike) else xmlfile logging_stream = io.StringIO() logging_handler = logging.StreamHandler(logging_stream) try: @@ -169,7 +161,7 @@ def make_xml( with open(plaintextfile, encoding="utf-8-sig") as plaintextfile_handle: make_xml_args.update( plaintextfile=plaintextfile_handle, - xmlfile=xmlfile, + xmlfile=str(xmlfile), language=JoinerCallbackForClick(get_langs_deferred())( value_groups=language ),