Skip to content

Commit

Permalink
chore: Use UV for dependency management
Browse files Browse the repository at this point in the history
  • Loading branch information
ghislainbourgeois committed Oct 30, 2024
1 parent 00144f5 commit 6f083ca
Show file tree
Hide file tree
Showing 14 changed files with 1,665 additions and 308 deletions.
12 changes: 5 additions & 7 deletions .github/workflows/integration-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,11 @@ jobs:
run: echo "charm_path=$(find built/ -name '*.charm' -type f -print)" >> $GITHUB_OUTPUT

- name: Setup operator environment
uses: charmed-kubernetes/actions-operator@main
with:
provider: microk8s
channel: 1.29-strict/stable
juju-channel: 3.4/stable
lxd-channel: 5.20/stable

run: |
sudo snap install concierge --classic
sudo concierge prepare -p microk8s --microk8s-channel "1.29-strict/stable" --juju-channel "3.4/stable" --lxd-channel "5.20/stable" --extra-snaps astral-uv/latest/edge
uv tool install tox --with tox-uv
- name: Run integration tests
run: |
tox -e integration -- \
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/lint-report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
run: sudo snap install --classic astral-uv --channel latest/edge
- name: Install tox
run: pip install tox
run: uv tool install tox --with tox-uv
- name: Run tests using tox
run: tox -e lint
4 changes: 3 additions & 1 deletion .github/workflows/static-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install uv
run: sudo snap install --classic astral-uv --channel latest/edge
- name: Install tox
run: pip install tox
run: uv tool install tox --with tox-uv
- name: Run tests using tox
run: tox -e static
4 changes: 3 additions & 1 deletion .github/workflows/unit-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install uv
run: sudo snap install --classic astral-uv --channel latest/edge
- name: Install tox
run: pip install tox
run: uv tool install tox --with tox-uv
- name: Run tests using tox
run: tox -e unit
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.charm_tracing_buffer.raw
build/
*.egg-info
*.idea
.vscode/
.coverage
Expand Down
22 changes: 17 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,29 @@

To make contributions to this charm, you'll need a working [development setup](https://juju.is/docs/sdk/dev-setup).

You can create an environment for development with `tox`:
This project uses `uv`. You can install it on Ubuntu with:

```shell
tox devenv -e integration
source venv/bin/activate
sudo snap install --classic astral-uv --channel latest/edge
```

You can create an environment for development with `uv`:

```shell
uv sync
```

## Testing

This project uses `tox` for managing test environments. There are some pre-configured environments
that can be used for linting and formatting code when you're preparing contributions to the charm:
This project uses `tox` for managing test environments. It can be installed
with:

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

There are some pre-configured environments that can be used for linting
and formatting code when you're preparing contributions to the charm:

```shell
tox -e format # update your code according to linting rules
Expand Down
9 changes: 7 additions & 2 deletions charmcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,16 @@ bases:
parts:
charm:
build-packages:
- cargo
- libffi-dev
- libssl-dev
- pkg-config
- rustc
build-snaps:
- astral-uv
- rustup
override-build: |
rustup default stable
uv export --frozen -o requirements.txt
craftctl default
provides:
certificates:
Expand Down
28 changes: 28 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
[project]
name = "self-signed-certificates-operator"
version = "0.1.0"
requires-python = ">=3.10"

dependencies = [
"cryptography",
"jsonschema",
"ops >= 2.2.0",
"opentelemetry-exporter-otlp-proto-http",
"pydantic==2.9.2",
]

[dependency-groups]
test = [
"coverage[toml]",
"juju",
"pytest",
"pytest-operator",
"pytest-asyncio==0.21.2",
"ops[testing]",
]
dev = [
"codespell",
"pyright",
"ruff",
]

# Testing tools configuration
[tool.coverage.run]
branch = true
Expand Down
5 changes: 0 additions & 5 deletions requirements.in

This file was deleted.

89 changes: 0 additions & 89 deletions requirements.txt

This file was deleted.

9 changes: 0 additions & 9 deletions test-requirements.in

This file was deleted.

Loading

0 comments on commit 6f083ca

Please sign in to comment.