Skip to content

Set up python copier template for python repositories #8903

@Tom-Willemsen

Description

@Tom-Willemsen

We have a number of python repositories that use many common components, e.g.

  • pyproject.toml metadata
  • Github actions CI setup including dependabot
  • ruff & pyright or ty configuration
  • pytest + coverage configuration
  • Docs/sphinx boilerplate configuration
  • Github releases
  • Optional pypi publishing
  • License

Examples include ibex_bluesky_core, genie, lewis, fastcs-secop, IBEX-device-generator (currently a bit different, can be made consistent), saluki, and others.

As a developer I would like it to be easier to:

  • Set up a new python project, following modern best-practices - i.e. in approximately the shape of the repositories above, with GHA, docs, tests, linting, releases all configured
  • Update to newer best-practices across all python repos, as and when we choose to use different tools for linting/ci/docs/building etc
  • But still allow each project to make local modifications to it's local configuration as makes sense for that specific project

A common tool for this in python is copier, see the following repositories for Diamond and ESS example templates using this tool:

Our "template structure" should look roughly like this: ISISComputingGroup/kafka_dae_diagnostics@f716e5b (but don't just blindly copy that commit - there'll be a few things we want to adjust).

Copier "questions" to include:

  • Repo/project name
  • module name
  • Whether to publish to pypi
  • Docs theme colour
  • CI (windows only / linux only / windows + linux)
  • choice of pyright or ty for type-checking

Acceptance criteria

  • "Copier" template set up for our repository shape and our team's current practices, to make it easier to create new python projects and update the repository setup of existing projects as and when best practices change
  • Document how to use it, either in the copier template repo itself, and/or in the dev wiki

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions