Skip to content

Commit aa163e0

Browse files
authored
Merge pull request #116 from Armandpl/uv
switch to uv
2 parents 67ccdd5 + c146c00 commit aa163e0

9 files changed

Lines changed: 3254 additions & 4682 deletions

File tree

.github/workflows/ci.yml

Lines changed: 11 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -8,84 +8,24 @@ on:
88
branches:
99
- master
1010

11-
# https://jacobian.org/til/github-actions-poetry/
1211
jobs:
13-
flake8-lint:
12+
run-tests:
13+
name: python
1414
runs-on: ubuntu-latest
15-
name: Lint
16-
steps:
17-
- name: Check out source repository
18-
uses: actions/checkout@v2
19-
- name: Set up Python environment
20-
uses: actions/setup-python@v1
21-
with:
22-
python-version: "3.9"
23-
- name: flake8 Lint
24-
uses: py-actions/flake8@v2
25-
with:
26-
# custom ignores start at w504, before are the default ones
27-
ignore: "E121,E123,E126,E226,E24,E704,W503,W504,E203,E402,E501,F401,F841"
28-
exclude: "logs/*,data/*,furuta/logging/protobuf/*"
2915

30-
test:
31-
runs-on: ubuntu-latest
3216
steps:
3317
- uses: actions/checkout@v4
3418

35-
# If you wanted to use multiple Python versions, you'd have specify a matrix in the job and
36-
# reference the matrixe python version here.
37-
- uses: actions/setup-python@v5
38-
with:
39-
python-version: 3.9
40-
41-
# Cache the installation of Poetry itself, e.g. the next step. This prevents the workflow
42-
# from installing Poetry every time, which can be slow. Note the use of the Poetry version
43-
# number in the cache key, and the "-0" suffix: this allows you to invalidate the cache
44-
# manually if/when you want to upgrade Poetry, or if something goes wrong. This could be
45-
# mildly cleaner by using an environment variable, but I don't really care.
46-
- name: cache poetry install
47-
uses: actions/cache@v4
48-
with:
49-
path: ~/.local
50-
key: poetry-1.4.0-0
51-
52-
# Install Poetry. You could do this manually, or there are several actions that do this.
53-
# `snok/install-poetry` seems to be minimal yet complete, and really just calls out to
54-
# Poetry's default install script, which feels correct. I pin the Poetry version here
55-
# because Poetry does occasionally change APIs between versions and I don't want my
56-
# actions to break if it does.
57-
#
58-
# The key configuration value here is `virtualenvs-in-project: true`: this creates the
59-
# venv as a `.venv` in your testing directory, which allows the next step to easily
60-
# cache it.
61-
- uses: snok/install-poetry@v1
62-
with:
63-
version: 1.4.0
64-
virtualenvs-create: true
65-
virtualenvs-in-project: true
66-
67-
# Cache your dependencies (i.e. all the stuff in your `pyproject.toml`). Note the cache
68-
# key: if you're using multiple Python versions, or multiple OSes, you'd need to include
69-
# them in the cache key. I'm not, so it can be simple and just depend on the poetry.lock.
70-
- name: cache deps
71-
id: cache-deps
72-
uses: actions/cache@v4
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v6
7321
with:
74-
path: .venv
75-
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
22+
enable-cache: true
7623

77-
# Install dependencies. `--no-root` means "install all dependencies but not the project
78-
# itself", which is what you want to avoid caching _your_ code. The `if` statement
79-
# ensures this only runs on a cache miss.
80-
- run: poetry install --no-interaction --no-root
81-
if: steps.cache-deps.outputs.cache-hit != 'true'
24+
- name: Install the project
25+
run: uv sync --locked --all-extras --dev
8226

83-
# Now install _your_ project. This isn't necessary for many types of projects -- particularly
84-
# things like Django apps don't need this. But it's a good idea since it fully-exercises the
85-
# pyproject.toml and makes that if you add things like console-scripts at some point that
86-
# they'll be installed and working.
87-
- run: poetry install --no-interaction
27+
- name: Lint
28+
run: uv run pre-commit run --all-files --config ./.pre-commit-config.yaml
8829

89-
# And finally run tests. I'm using pytest and all my pytest config is in my `pyproject.toml`
90-
# so this line is super-simple. But it could be as complex as you need.
91-
- run: poetry run pytest
30+
- name: Run tests
31+
run: uv run pytest tests

.pre-commit-config.yaml

Lines changed: 4 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ default_language_version:
33

44
repos:
55
- repo: https://github.com/pre-commit/pre-commit-hooks
6-
rev: v4.3.0
6+
rev: v5.0.0
77
hooks:
88
# list of supported hooks: https://pre-commit.com/hooks.html
99
- id: trailing-whitespace
@@ -19,35 +19,21 @@ repos:
1919

2020
# python code formatting
2121
- repo: https://github.com/psf/black
22-
rev: 22.6.0
22+
rev: 25.1.0
2323
hooks:
2424
- id: black
2525
args: [--line-length, "99"]
2626

2727
# python import sorting
2828
- repo: https://github.com/PyCQA/isort
29-
rev: 5.12.0
29+
rev: 6.0.1
3030
hooks:
3131
- id: isort
3232
args: ["--profile", "black", "--filter-files"]
3333

34-
# python upgrading syntax to newer version
35-
- repo: https://github.com/asottile/pyupgrade
36-
rev: v2.32.1
37-
hooks:
38-
- id: pyupgrade
39-
args: [--py38-plus]
40-
41-
# python docstring formatting
42-
- repo: https://github.com/myint/docformatter
43-
rev: v1.7.5
44-
hooks:
45-
- id: docformatter
46-
args: [--in-place, --wrap-summaries=99, --wrap-descriptions=99]
47-
4834
# python check (PEP8), programming errors and code complexity
4935
- repo: https://github.com/PyCQA/flake8
50-
rev: 4.0.1
36+
rev: 7.3.0
5137
hooks:
5238
- id: flake8
5339
args:
@@ -57,30 +43,3 @@ repos:
5743
"--exclude",
5844
"logs/*,data/*,furuta/logging/protobuf/*",
5945
]
60-
61-
# yaml formatting
62-
- repo: https://github.com/pre-commit/mirrors-prettier
63-
rev: v2.7.1
64-
hooks:
65-
- id: prettier
66-
types: [yaml]
67-
# # jupyter notebook cell output clearing
68-
# - repo: https://github.com/kynan/nbstripout
69-
# rev: 0.5.0
70-
# hooks:
71-
# - id: nbstripout
72-
73-
# # jupyter notebook linting
74-
# - repo: https://github.com/nbQA-dev/nbQA
75-
# rev: 1.4.0
76-
# hooks:
77-
# - id: nbqa-black
78-
# args: ["--line-length=99"]
79-
# - id: nbqa-isort
80-
# args: ["--profile=black"]
81-
# - id: nbqa-flake8
82-
# args:
83-
# [
84-
# "--extend-ignore=E203,E402,E501,F401,F841",
85-
# "--exclude=logs/*,data/*",
86-
# ]

furuta/logger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
class SimpleLogger:
12-
def __init__(self, log_path: (str | Path)):
12+
def __init__(self, log_path: str | Path):
1313
self.output_file = open(log_path, "wb")
1414
self.mcap_writer = Writer(self.output_file)
1515

furuta/plotter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def __init__(self, times: np.ndarray, states: dict[str, np.ndarray]):
5050
self.states = states
5151

5252
@classmethod
53-
def from_log_path(cls, log_path: (str | Path)) -> "Plotter":
53+
def from_log_path(cls, log_path: str | Path) -> "Plotter":
5454
loader = Loader()
5555
times, states = loader.load(log_path)
5656
return cls(times, states)

0 commit comments

Comments
 (0)