-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from thedropbears/switch_to_uv
- Loading branch information
Showing
10 changed files
with
813 additions
and
836 deletions.
There are no files selected for viewing
This file contains 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,3 +1,65 @@ | ||
# pysysid | ||
|
||
The Drop Bears' robot code for sysid in common mechanism types | ||
|
||
## Setup | ||
|
||
### Install dependencies | ||
|
||
We use `uv` to manage our dependencies in our development environments. | ||
This includes the Python version, and any Python packages such as `wpilib`. | ||
|
||
Install `uv` by following the [`uv` docs](https://docs.astral.sh/uv/). | ||
|
||
After installing `uv`, use it to create a virtual environment and install our dependencies. | ||
|
||
```sh | ||
uv sync | ||
``` | ||
|
||
Then, download the roboRIO dependencies. | ||
|
||
```sh | ||
uv run python -m ensurepip | ||
uv run robotpy --main <SYSID_PROJECT> sync --no-install | ||
``` | ||
|
||
### pre-commit | ||
|
||
[pre-commit][] is configured to run our formatters and linters. | ||
These are enforced for all code committed to this project. | ||
|
||
To use pre-commit, you must install it outside of this project's virtual environment. | ||
Either use your system package manager, or use `uv tool`: | ||
|
||
```sh | ||
uv tool install pre-commit | ||
``` | ||
|
||
You can then set up the pre-commit hooks to run on commit: | ||
|
||
```sh | ||
pre-commit install | ||
``` | ||
|
||
## Run | ||
|
||
### Simulation | ||
|
||
``` bash | ||
uv run robotpy --main <SYSID_PROJECT> sim | ||
``` | ||
|
||
### Deploy to Robot | ||
|
||
Once on robots network | ||
|
||
``` bash | ||
uv run robotpy --main <SYSID_PROJECT> deploy | ||
``` | ||
|
||
### Test | ||
|
||
``` bash | ||
uv run robotpy --main <SYSID_PROJECT> test | ||
``` |
This file contains 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 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 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 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,5 +1,6 @@ | ||
[tool.coverage.run] | ||
branch = true | ||
omit = ["config.py", "config-3.py"] | ||
|
||
[tool.coverage.report] | ||
exclude_lines = [ | ||
|
@@ -16,14 +17,27 @@ warn_unused_ignores = true | |
warn_unreachable = true | ||
strict_equality = true | ||
|
||
[[tool.mypy.overrides]] | ||
module = "choreo.*" | ||
ignore_missing_imports = true | ||
|
||
[tool.pyright] | ||
exclude = [ | ||
"ctre_sim", | ||
"logs", | ||
# Default excludes | ||
"**/__pycache__", | ||
"**/.*", | ||
] | ||
|
||
[tool.pytest.ini_options] | ||
addopts = "--strict-markers -v --maxfail=2" | ||
pythonpath = "." | ||
testpaths = ["tests"] | ||
xfail_strict = true | ||
|
||
[tool.ruff] | ||
target-version = "py39" | ||
target-version = "py311" | ||
|
||
[tool.ruff.lint] | ||
select = [ | ||
|
@@ -33,6 +47,8 @@ select = [ | |
"F", | ||
# flake8-bugbear | ||
"B", | ||
# isort | ||
"I", | ||
# pyupgrade | ||
"UP", | ||
# flake8-comprehensions | ||
|
@@ -46,20 +62,19 @@ select = [ | |
# perflint | ||
"PERF", | ||
] | ||
ignore = ["E501"] | ||
|
||
[tool.pdm] | ||
package-type = "application" | ||
|
||
[tool.pdm.scripts] | ||
deploy = "robotpy --main {args}/robot.py deploy" | ||
download = "robotpy sync --no-install" | ||
sim = "robotpy --main {args}/robot.py sim" | ||
test = "robotpy --main {args}/robot.py test --" | ||
ignore = [ | ||
"E501", # long lines | ||
"B905", # zip() without strict= | ||
] | ||
|
||
[tool.pdm.dev-dependencies] | ||
dev = ["hypothesis", "pytest>=7.2.0", "pytest-integration>=0.2.3"] | ||
typing = ["mypy>=1.8.0"] | ||
[tool.uv] | ||
dev-dependencies = [ | ||
"hypothesis>=6.112.1", | ||
"mypy>=1.8.0", | ||
"pytest>=7.2.0", | ||
"pytest-integration>=0.2.3", | ||
] | ||
prerelease = "allow" | ||
|
||
[project] | ||
name = "pysysid" | ||
|
@@ -68,27 +83,24 @@ description = "The Drop Bears' ongoing system identification code" | |
authors = [{ name = "The Drop Bears", email = "[email protected]" }] | ||
readme = "README.md" | ||
license = { text = "MIT" } | ||
requires-python = ">=3.10,<3.13" | ||
requires-python = ">=3.12,<3.14" | ||
|
||
dependencies = [ | ||
"phoenix6~=24.2.0", | ||
"robotpy==2024.3.1.0", | ||
"robotpy-commands-v2~=2024.3.1", | ||
"robotpy-navx~=2024.1.0", | ||
"robotpy-rev~=2024.2.1", | ||
"robotpy-urcl~=2024.0.1", | ||
"phoenix6~=25.1.0", | ||
"robotpy==2025.2.1.0", | ||
"robotpy-commands-v2~=2025.1.1", | ||
"robotpy-rev~=2025.0.1", | ||
"robotpy-urcl~=2025.0.0", | ||
] | ||
|
||
[tool.robotpy] | ||
requires = [ | ||
"phoenix6~=24.2.0", | ||
"robotpy-commands-v2~=2023.3.1", | ||
"robotpy-navx~=2024.1.0", | ||
"robotpy-rev~=2024.2.1", | ||
"robotpy-urcl~=2024.0.1", | ||
"phoenix6~=25.1.0", | ||
"robotpy-commands-v2~=2025.1.1", | ||
"robotpy-rev~=2025.0.1", | ||
"robotpy-urcl~=2025.0.0", | ||
# Not needed for these routines, but keep them on the robot for production. | ||
"numpy", | ||
"photonlibpy", | ||
] | ||
robotpy_version = "2024.3.1.0" | ||
robotpy_extras = ["apriltag"] | ||
robotpy_version = "2025.2.1.0" |
This file contains 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 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 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
Oops, something went wrong.