Skip to content

chore: migrate to uv+ruff#225

Merged
Thanhphan1147 merged 10 commits intomainfrom
uv+ruff
Nov 18, 2025
Merged

chore: migrate to uv+ruff#225
Thanhphan1147 merged 10 commits intomainfrom
uv+ruff

Conversation

@weiiwang01
Copy link
Contributor

@weiiwang01 weiiwang01 commented Nov 12, 2025

Overview

Migrate the Python project to use uv, tox-uv, and ruff for building, testing and linting.

The changes include:

  • Merge requirements.txt into pyproject.toml
  • Migrate tox.ini to tox.toml
  • Replace tox with tox-uv
  • Use ruff for linting and formatting, replacing flake8, pylint, black, and isort
  • Fix some linting issue discovered by ruff

Rationale

Juju Events Changes

Module Changes

Library Changes

Checklist

Copy link
Collaborator

@Thanhphan1147 Thanhphan1147 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@weiiwang01
Copy link
Contributor Author

@copilot I want you to modify this pull request.

The first thing you need to do is add a new entry to docs/changelog.md. The changelog entry should be short and should describe the changes introduced by this pull request.

The second thing you need to do is update CONTRIBUTING.md to explain how to use uv and tox-uv for development. For your reference, here's a section I copied from another project. In this reference, it's using uv sync --all-groups but if you are seeing tool.uv.conflicts defined in pyproject.toml use uv sync instead.

## Developing

To make contributions to this charm, you'll need a working [development setup](https://documentation.ubuntu.com/juju/3.6/howto/manage-your-deployment/).

The code for this charm can be downloaded as follows:

```
git clone https://github.com/canonical/pollen-operator
```

Make sure to install [uv](https://docs.astral.sh/uv/), for example:

```sh
sudo snap install astral-uv --classic
```

Then install `tox` with extensions, as well as a range of Python versions:

```sh
uv tool install tox --with tox-uv
uv tool update-shell
```

To create an environment for development, use:

```shell
uv sync --all-groups
source venv/bin/activate
```

For all your modifications, make minimal changes to complete the task.

Copy link
Contributor

Copilot AI commented Nov 12, 2025

@weiiwang01 I've opened a new pull request, #227, to work on those changes. Once the pull request is ready, I'll request review from you.

@Thanhphan1147
Copy link
Collaborator

Thanhphan1147 commented Nov 17, 2025

@weiiwang01 I think we should not touch and code in legacy/ and add ignore rules for the different tools we have. Since that code is brought over from the old charm and we need to keep it unchanged to ensure backwards compatibility. We've also decided that that code will not be maintained so it's fine to exclude it from our lint suite

Please ignore this I misread tests/unit/legacy, which is fine 😄

@Thanhphan1147 Thanhphan1147 merged commit 63b97f0 into main Nov 18, 2025
56 of 63 checks passed
@Thanhphan1147 Thanhphan1147 deleted the uv+ruff branch November 18, 2025 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants