Skip to content

Modularize noxfile.py #3128

@namurphy

Description

@namurphy

Description of improvement

We should consider extracting complicated sessions from noxfile.py and putting them into standalone scripts in tools/. This would best be done for sessions that are not used in CI, and thus exclude sessions like tests, docs, etc.

Motivation

Extracting scripts would have a few benefits:

  • Decouple these tasks from Nox, in case we switch to a different task runner in the future.
  • Make noxfile.py easier to navigate.
  • Improve cohesion for each of the files.

Implementation strategy

The best place for the scripts would probably be tools/.

We should embed metadata in them (as per PEP 723) so that we can run them with uv run.

The sessions could still be kept in noxfile.py to make it easier to use a matrix setup for GitHub workflows, while also making them easier to find (with nox -l) and run (with nox -s '<session_name>'). The new sessions could be something like session.run("uv", "run", "scriptname.py").

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    noxRelated to the nox automation software

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions