Skip to content

chore: replace tox workflow with Makefile - #2690

Open
PraaneshSelvaraj wants to merge 1 commit into
canonical:mainfrom
PraaneshSelvaraj:chore/replace-tox-with-make
Open

chore: replace tox workflow with Makefile#2690
PraaneshSelvaraj wants to merge 1 commit into
canonical:mainfrom
PraaneshSelvaraj:chore/replace-tox-with-make

Conversation

@PraaneshSelvaraj

Copy link
Copy Markdown

Replace the repository's tox/tox-uv developer workflow with a top-level Makefile that runs commands through uv, following the same pattern used in hyrum and jubilant.

Closes #2479.

What changed

  • Added a top-level Makefile as the primary developer entry point.
  • Replaced tox command wrappers with equivalent uv run invocations while preserving the underlying commands.
  • Added standard targets: help, all, format, fix, lint, unit, coverage, benchmark, integration, smoke, pebble, draft-release, and post-release.
  • Added a top-level docs target that delegates to the existing Sphinx documentation build.
  • Added ARGS forwarding so pytest filters and paths work naturally (e.g. make unit ARGS="-k test_name").

Notes

  • The documentation workflow itself is unchanged; this only adds a convenient top-level entry point.
  • Example charms are intentionally not modified in this PR, as described in the issue, they will follow once the Charmcraft profile/template changes land.

@PraaneshSelvaraj

Copy link
Copy Markdown
Author

@tonyandrewmeyer This PR only adds the Makefile. If you'd prefer, I can remove the tox files in a follow-up commit.

@tonyandrewmeyer tonyandrewmeyer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hi @PraaneshSelvaraj , thanks for this!

We definitely need to remove tox in the same PR, or they'll just drift, and we don't want two systems, just to move to make. That means removing tox, but also updating the workflows, documentation, and so on.

It's also important that what each command does stays the same, and that the same set of commands is provided, unless there are specific reasons, called out in the PR body, which that is not the case.

Please use "refs" not "closes" in the PR as there is still the follow-up work in the profiles and then example charms after this step.

Lastly, please do make sure you have tested things first.

Comment thread Makefile
uv run --group lint --group unit pyright $(ARGS)

pebble: # Run real Pebble tests
umask 0; pebble run --http=':4000' --create-dirs >/dev/null 2>&1 & sleep 1

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The Pebble daemon starts without PEBBLE=/tmp/pebble; only the pytest line on 78 sets it. This means the two pebble will be using different folders.

This also means all the pebble tests fail. Please make sure you have tested the commands locally, other than the ones for releasing (for smoke and integration you can do this in a VM, like Multipass).

Also, the CI needs to change to usemake, which would also exercise this.

Comment thread Makefile
PEBBLE=/tmp/pebble RUN_REAL_PEBBLE_TESTS=1 \
uv run --group unit \
pytest -v --tb native test/test_real_pebble.py $(ARGS)
killall -y 3m pebble

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The kill is skipped when the pytest line fails, since Make aborts the recipe. We need to keep the behaviour where it's always stopped, or there's a dangling pebble left running.

Comment thread Makefile
draft-release: # Create a draft GitHub release
uv run --group release python release.py $(ARGS)

fix: # Auto-fix lint issues

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Let's keep this PR as a move, not add new commands.

Comment thread Makefile
uv run --group lint ruff check --preview --fix
uv run --group lint ruff format --preview

format: # Format the Python code

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This should also have the check fix, like in tox.

Comment thread Makefile
-v --tb native \
-W "ignore:Harness is deprecated:PendingDeprecationWarning" \
$(ARGS)
mv tracing/.coverage .coverage-tracing

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This has dropped the report step.

@tonyandrewmeyer

Copy link
Copy Markdown
Collaborator

@PraaneshSelvaraj are you planning to continue work on this? Please let us know in the next day or two if so, otherwise we'll close this and let someone else pick it up.

@PraaneshSelvaraj

Copy link
Copy Markdown
Author

@PraaneshSelvaraj are you planning to continue work on this? Please let us know in the next day or two if so, otherwise we'll close this and let someone else pick it up.

@tonyandrewmeyer Yes, I’m planning to continue with this.

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.

Replace operator repo use of tox with Make

2 participants