Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Use UV for dependency management #262

Merged
merged 6 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions .github/dependabot.yml

This file was deleted.

37 changes: 37 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended",
":disableRateLimiting",
":noUnscheduledUpdates",
// Avoid conflicts with custom `commitMessagePrefix`
":semanticCommitsDisabled"
],
"automerge": true,
"automergeStrategy": "squash",
"automergeType": "pr",
"platformAutomerge": true,
"schedule": ["after 1am and before 3am every monday"],
"lockFileMaintenance": {
"enabled": true,
"schedule": ["after 1am and before 3am every wednesday"]
},
"timezone": "Etc/UTC",
"enabledManagers": ["pep621", "github-actions", "terraform"],
"packageRules": [
// Later rules override earlier rules
{
"matchManagers": ["pep621"],
"rangeStrategy": "bump",
"groupName": "Python dependencies"
},
{
"matchManagers": ["github-actions"],
"groupName": "GitHub actions"
},
{
"matchManagers": ["terraform"],
"groupName": "Terraform"
},
],
}
26 changes: 0 additions & 26 deletions .github/workflows/dependabot_pr.yaml

This file was deleted.

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
ghislainbourgeois marked this conversation as resolved.
Show resolved Hide resolved
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/stable
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
- 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
- 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
- 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
```

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
13 changes: 11 additions & 2 deletions charmcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,21 @@ bases:

parts:
charm:
source: .
plugin: charm
charm-requirements:
- requirements.txt
build-packages:
- cargo
- libffi-dev
- libssl-dev
- pkg-config
- rustc
build-snaps:
- astral-uv
- rustup
override-build: |
rustup default stable
uv export --frozen --no-dev -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"
gruyaume marked this conversation as resolved.
Show resolved Hide resolved
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