Skip to content
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
6 changes: 3 additions & 3 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
ARG VARIANT=3-bookworm
FROM mcr.microsoft.com/vscode/devcontainers/python:${VARIANT}

# Poetry
ARG POETRY_VERSION="none"
RUN if [ "${POETRY_VERSION}" != "none" ]; then su vscode -c "umask 0002 && pip3 install poetry==${POETRY_VERSION}"; fi
# uv
RUN su vscode -c "curl -LsSf https://astral.sh/uv/install.sh | sh"
ENV PATH="/home/vscode/.local/bin:${PATH}"

# [Optional] If your pip requirements rarely change, uncomment this section to add them to the image.
# COPY requirements.txt /tmp/pip-tmp/
Expand Down
4 changes: 1 addition & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
// Update 'VARIANT' to pick a Python version
// Append -bookworm or -buster to pin to an OS version.
// Use -bookworm variants on local on arm64/Apple Silicon.
"VARIANT": "3.13-bookworm",
// Options
"POETRY_VERSION": "2.1.3"
"VARIANT": "3.14-bookworm"
}
},
// Configure tool-specific properties.
Expand Down
5 changes: 2 additions & 3 deletions .devcontainer/post-install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/sh

poetry config virtualenvs.in-project true
poetry install --all-extras
pre-commit install
uv sync --all-extras
uv run pre-commit install
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

version: 2
updates:
- package-ecosystem: "pip" # See documentation for possible values
- package-ecosystem: "uv" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "monthly"
Expand Down
38 changes: 25 additions & 13 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Run Python Tests
name: CI
on:
push:
branches:
Expand All @@ -13,23 +13,35 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
python-version:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"

steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v6

- name: Install uv and set the Python version
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version }}
version: "0.10.9"

- name: Install Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Setup Poetry
uses: abatilo/actions-poetry@v2
- name: Install dependencies
run: |
poetry install

- name: Run linting
run: |
poetry run ruff check .
poetry run ruff format . --check
uv run ruff check .
uv run ruff format . --check

- name: Run mypy
run: poetry run mypy src/rivian
- name: Run tests with poetry and pytest
run: poetry run pytest
run: uv run mypy src/rivian

- name: Test with pytest
run: uv run pytest
33 changes: 20 additions & 13 deletions .github/workflows/python-publish.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
# An action to build and publish python package to https://pypi.org/ using poetry https://github.com/sdispater/poetry
# For more information see: https://github.com/marketplace/actions/publish-python-poetry-package

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package

on:
Expand All @@ -20,9 +12,24 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build and publish to pypi
uses: JRubics/poetry-publish@v1.16
- name: Checkout
uses: actions/checkout@v6

- name: Install uv
uses: astral-sh/setup-uv@v7
with:
pypi_token: ${{ secrets.PYPI_API_TOKEN }}
plugins: "poetry-dynamic-versioning[plugin]"
version: "0.10.9"

- name: Build
run: uv build

- name: Smoke test (wheel)
run: uv run --isolated --no-project --with dist/*.whl python -c "import rivian; assert rivian.__version__ != '0.0.0'"

- name: Smoke test (source distribution)
run: uv run --isolated --no-project --with dist/*.tar.gz python -c "import rivian; assert rivian.__version__ != '0.0.0'"

- name: Publish
env:
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run: uv publish
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Version file (auto-generated by Hatchling)
src/rivian/__version__.py

# IDE generated files
.vscode/

Expand Down
15 changes: 7 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
repos:
- repo: https://github.com/python-poetry/poetry
rev: '2.2.1'
- repo: https://github.com/astral-sh/uv-pre-commit
# uv version.
rev: 0.10.9
hooks:
# Validate poetry configuration.
- id: poetry-check
# Update the lock file.
- id: poetry-lock
# Update the uv lockfile
- id: uv-lock
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.9.6
rev: v0.15.5
hooks:
# Run the linter.
- id: ruff
- id: ruff-check
args: [--fix]
# Run the formatter.
- id: ruff-format
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ Currently a Work In Progress

## Dependencies

[Poetry](https://python-poetry.org/docs/)
[uv](https://docs.astral.sh/uv/)

```
curl -sSL https://install.python-poetry.org | python3 -
curl -LsSf https://astral.sh/uv/install.sh | sh
```

## Setup

Install project dependencies into the poetry virtual environment and run pre-commit
Install project dependencies into the uv virtual environment and run pre-commit

```
poetry install --all-extras
uv sync --all-extras
pre-commit install
```

## Run Tests

```
poetry run pytest
uv run pytest
```
Loading