Skip to content

Conversation

@albestro
Copy link
Contributor

@albestro albestro commented Nov 12, 2025

DISCLAIMER: I'm not an expert, I'm just taking the chance to learn about packaging by working on this migration. If you feel like it is not something desired, feel free to discard this PR. I just started it because it felt like the right move to do but no-one had the time to do dedicate.

  • bump to python 3.12 as minimal requirement (and use it in all CI workflows)
  • migrate from setup.cfg to pyproject.toml
    • delete bin/stack-config in favour of [project.scripts]
    • setuptools: drop MANIFEST.in (in favour of pyprojects.toml)
  • add dev group of dependencies for development
    • drop test_stackinator custom script
    • adapt the github workflow accordingly
    • currently just pytest, but we can add other stuff, e.g. static checking, ...
  • add docs group of dependencies
    • adapt the github workflow accordingly
  • github workflows: took the chance to update and modernize with uv
  • minor:
    • add documentation url
    • add license-file reference
    • drop requirements*.txt files (migrated to dependency-groups)
    • update .gitignore

With uv tool install . you get it installed as an editable package and the stack-config command is available without doing anything (no manual PATH update required).

TODO:

  • check that packaging and publishing works correctly

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR modernizes the project's packaging infrastructure by migrating from the legacy setup.cfg format to the standardized pyproject.toml format. It also streamlines the development workflow by eliminating custom scripts in favor of standard Python packaging tools.

Key changes:

  • Consolidated all packaging metadata into pyproject.toml and removed setup.cfg
  • Replaced the custom bin/stack-config script with a proper [project.scripts] entry point
  • Introduced a [dependency-groups] section for development dependencies and removed the custom test_stackinator.py test runner

Reviewed Changes

Copilot reviewed 4 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pyproject.toml Added complete project metadata including dependencies, scripts, and pytest configuration
setup.cfg Removed legacy configuration file
bin/stack-config Removed custom script wrapper in favor of setuptools entry point
test_stackinator.py Removed custom test runner in favor of direct pytest usage
.gitignore Added Python packaging artifacts to ignore list
.github/workflows/main.yaml Updated CI workflow to use uv sync and pytest directly

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +23 to 24
# TODO is it needed to cleanup site folder?
- run: rm -rf site
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self-reminder: can it be removed or is it somehow cached across runs?

Suggested change
# TODO is it needed to cleanup site folder?
- run: rm -rf site

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if it is cached ... I can't remember why it was added.

But it was probably added for a reason, and it doesn't hurt to rm -rf the path.

Comment on lines +22 to +24
run: uv publish
env:
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be tested

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the guide on how to install stack-config using pip a while back, because we don't tag releases very often. If somebody is using a pip-installed stackinator, they are almost certainly using an old version.

For better or worse, stackinator has a more relaxed "use the most recent commit in your release branch" model.

- run: pip install --upgrade pip
- run: |
pip install -r requirements-docs.txt
python-version: 3.12
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might become a github variable so that we share it across all workflows (if that's what we want)

@albestro albestro marked this pull request as ready for review November 17, 2025 16:09
uses: astral-sh/setup-uv@v6
- name: Install Dependencies
run: uv sync --group docs
# TODO is it needed to cleanup site folder?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question for reviewers

it was not possible to use uv run --script because we need to know
where stackinator root is, to add it to the venv using --with
@albestro
Copy link
Contributor Author

albestro commented Dec 2, 2025

As discussed offline with @bcumming, I added back bin/stack-config, since it is a nice-to-have alternative for a quick run without any required knowledge about uv or anything else.

I added it back, in a slightly different configuration, so that the project has a single source of truth in project.yaml (e.g. for dependencies). This improves maintainability since we don't have anymore the list of dependencies in this script.

In addition to that, this also means that the CI depending on this tool don't need any change, since it should still work as before (e.g. without having to do uv tool install).

Comment on lines +23 to 24
# TODO is it needed to cleanup site folder?
- run: rm -rf site
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if it is cached ... I can't remember why it was added.

But it was probably added for a reason, and it doesn't hurt to rm -rf the path.

Comment on lines +22 to +24
run: uv publish
env:
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the guide on how to install stack-config using pip a while back, because we don't tag releases very often. If somebody is using a pip-installed stackinator, they are almost certainly using an old version.

For better or worse, stackinator has a more relaxed "use the most recent commit in your release branch" model.

@bcumming bcumming merged commit c370be2 into eth-cscs:main Dec 12, 2025
2 checks passed
@albestro albestro deleted the alby/migrate-to-pyproject-toml branch December 15, 2025 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants