-
Notifications
You must be signed in to change notification settings - Fork 38
feat(cli): Add uv to cli #537
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
14f874b
Specify CLI deployment version
pedro-avalos 0467309
Pin build system to a specific version
pedro-avalos 3d32837
Add uv.lock and version dependencies
pedro-avalos 79356f5
Add git commit to uv cache-keys
pedro-avalos 31fd615
Update cli tox to use tox-uv
pedro-avalos 6e52fb0
Remove old branch from cli-tox.yml rule
pedro-avalos 4ac0c6d
Use snapcraft uv plugin
pedro-avalos 8ec90bd
Add basic HACKING.md
pedro-avalos 223951d
Run tests with different python versions
pedro-avalos 9b123e5
Move set_env in tox.ini
pedro-avalos 6066249
Add tox test to ensure lock file is up to date
pedro-avalos 2d8ba39
Remove extraneous testing environments
pedro-avalos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 3.10 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| # Testflinger CLI | ||
|
|
||
| ## Build the Snap Package | ||
|
|
||
| Testflinger CLI is distributed as a [Snap package][snap]. | ||
|
|
||
| Install [`snapcraft`][snapcraft]: | ||
|
|
||
| ```shell | ||
| sudo snap install --classic snapcraft | ||
| ``` | ||
|
|
||
| Then you can build the Snap package by running `snapcraft`: | ||
|
|
||
| ```shell | ||
| snapcraft pack | ||
| ``` | ||
|
|
||
| Then you can install the Snap package locally with the `--dangerous` flag | ||
| (replace `testflinger.snap` with the name of the `.snap` file that was | ||
| created by the previous command): | ||
|
|
||
| ```shell | ||
| sudo snap install --dangerous testflinger.snap | ||
| ``` | ||
|
|
||
| To learn more about `snapcraft`, refer to the | ||
| [`snapcraft` documentation][snapcraft-docs]. | ||
|
|
||
| ## Set up your Development Environment | ||
|
|
||
| We use [`uv`][uv] to manage our project and dependencies. You should install it | ||
| from the [Snap Store][uv-snap] by using the following command: | ||
|
|
||
| ```shell | ||
| sudo snap install --classic astral-uv | ||
| ``` | ||
|
|
||
| To create your development environment, run the following: | ||
|
|
||
| ```shell | ||
| uv sync | ||
| ``` | ||
|
|
||
| This will create a virtual environment under `.venv`, to activate it, you need | ||
| to source the following file: | ||
|
|
||
| ```shell | ||
| source .venv/bin/activate | ||
pedro-avalos marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ``` | ||
|
|
||
| ## Manage Dependencies | ||
|
|
||
| ### Add a dependency | ||
|
|
||
| To add a new dependency to `testflinger-cli`, please use `uv`, as it will | ||
| automatically add it to both the `pyproject.toml` and `uv.lock` files: | ||
|
|
||
| ```shell | ||
| uv add ... | ||
| ``` | ||
|
|
||
| If the dependency is only a development dependency, please add it to the `dev` | ||
| dependency group by using the `--dev` flag. | ||
|
|
||
| To learn more about the `uv add` command, refer to the | ||
| [`uv` documentation][uv-add]. | ||
|
|
||
| ### Remove a dependency | ||
|
|
||
| ```shell | ||
| uv remove ... | ||
| ``` | ||
|
|
||
| If the dependency is only a development dependency, please remove it from the | ||
| `dev` dependency group by using the `--dev` flag. | ||
|
|
||
| To learn more about the `uv remove` command, refer to the | ||
| [`uv` documentation][uv-remove]. | ||
|
|
||
| ## Test | ||
|
|
||
| To run all our tests, run the `tox` tool. To run it with `uv`, use the following command: | ||
|
|
||
| ```shell | ||
| uvx --with tox-uv tox | ||
| ``` | ||
|
|
||
| You can also run `tox` on its own, and it should automatically pull in `tox-uv` as a dependency for running the tests with our `uv` lock file. | ||
|
|
||
| ```shell | ||
| tox | ||
| ``` | ||
|
|
||
| [snap]: https://snapcraft.io/testflinger-cli | ||
| [snapcraft]: https://snapcraft.io/snapcraft | ||
| [snapcraft-docs]: https://snapcraft.io/docs/snapcraft | ||
| [uv]: https://docs.astral.sh/uv | ||
| [uv-snap]: https://snapcraft.io/astral-uv | ||
| [uv-add]: https://docs.astral.sh/uv/reference/cli/#uv-add | ||
| [uv-remove]: https://docs.astral.sh/uv/reference/cli/#uv-remove | ||
boukeas marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,37 @@ | ||
| [tox] | ||
| envlist = py | ||
| skipsdist = true | ||
| env_list = | ||
| lock | ||
| format | ||
| lint | ||
| unit | ||
| no_package = true | ||
| requires = | ||
| tox-uv>=1.25.0 | ||
|
|
||
| [testenv] | ||
| setenv = | ||
| runner = uv-venv-lock-runner | ||
| dependency_groups = | ||
| dev | ||
|
|
||
| [testenv:lock] | ||
| description = Check lock file | ||
| commands = | ||
| uv lock --check | ||
|
|
||
| [testenv:format] | ||
| description = Run formatting tests | ||
| commands = | ||
| black --check testflinger_cli | ||
|
|
||
| [testenv:lint] | ||
| description = Run linting tests | ||
| commands = | ||
| flake8 testflinger_cli | ||
| pylint testflinger_cli | ||
|
|
||
| [testenv:unit] | ||
| description = Run unit tests | ||
| set_env = | ||
| HOME = {envtmpdir} | ||
| deps = | ||
| black | ||
| flake8 | ||
| mock | ||
| pytest | ||
| pylint | ||
| pytest-mock | ||
| pytest-cov | ||
| requests-mock | ||
| commands = | ||
| {envbindir}/pip install . | ||
| {envbindir}/python -m black --check testflinger_cli | ||
| {envbindir}/python -m flake8 testflinger_cli | ||
| {envbindir}/python -m pylint testflinger_cli | ||
| {envbindir}/python -m pytest --doctest-modules --cov=. | ||
| pytest --cov=. --doctest-modules |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.