Skip to content

Commit

Permalink
DX: modernize dev environment with uv
Browse files Browse the repository at this point in the history
  • Loading branch information
redeboer committed Oct 16, 2024
1 parent 057e283 commit cb40a8b
Show file tree
Hide file tree
Showing 21 changed files with 4,020 additions and 227 deletions.
12 changes: 12 additions & 0 deletions .binder/postBuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
set -ex
curl -LsSf https://astral.sh/uv/install.sh | sh
source $HOME/.cargo/env
uv export \
--extra jupyter \
--extra notebooks \
> requirements.txt
uv pip install \
--requirement requirements.txt \
--system
uv cache clean
1 change: 1 addition & 0 deletions .binder/runtime.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python-3.12
4 changes: 3 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.ipynb]
indent_size = unset
[*.{py,toml}]
indent_size = 4

[setup.cfg]
[uv.lock]
indent_size = 4
3 changes: 2 additions & 1 deletion .envrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
layout anaconda
uv sync --all-extras --quiet
source .venv/bin/activate
37 changes: 0 additions & 37 deletions .github/release-drafter.yml

This file was deleted.

16 changes: 0 additions & 16 deletions .github/workflows/cd.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ on:

jobs:
doc:
uses: ComPWA/actions/.github/workflows/ci-docs.yml@v1
uses: ComPWA/actions/.github/workflows/ci-docs.yml@v2
permissions:
pages: write
id-token: write
Expand All @@ -39,4 +39,4 @@ jobs:
if: inputs.specific-pip-packages == ''
secrets:
token: ${{ secrets.PAT }}
uses: ComPWA/actions/.github/workflows/pre-commit.yml@v1
uses: ComPWA/actions/.github/workflows/pre-commit.yml@v2
4 changes: 2 additions & 2 deletions .github/workflows/clean-caches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ on:
jobs:
cleanup:
name: Remove caches
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: ComPWA/actions/clean-caches@v1
- uses: ComPWA/actions/clean-caches@v2
with:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ inputs.ref }}
22 changes: 22 additions & 0 deletions .github/workflows/lock.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Update

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: |-
${{ github.ref != format('refs/heads/{0}', github.event.repository.default_branch) }}
on:
pull_request:
branches:
- main
- epic/*
paths:
- .pre-commit-config.yaml
- uv.lock
workflow_dispatch:

jobs:
lock:
uses: ComPWA/actions/.github/workflows/lock.yml@v2
secrets:
token: ${{ secrets.PAT }}
2 changes: 1 addition & 1 deletion .github/workflows/pr-linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ on:

jobs:
lint-pr:
uses: ComPWA/actions/.github/workflows/pr-linting.yml@v1
uses: ComPWA/actions/.github/workflows/pr-linting.yml@v2
16 changes: 0 additions & 16 deletions .github/workflows/release-drafter.yml

This file was deleted.

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ version.py

# Temporary files
*.pyc
*condaenv.*
.coverage
.coverage.*
.ipynb_checkpoints/
Expand Down
56 changes: 30 additions & 26 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,34 @@
ci:
autoupdate_commit_msg: "MAINT: autoupdate pre-commit hooks"
autoupdate_commit_msg: "MAINT: update lock files"
autoupdate_schedule: quarterly
skip:
- prettier
- pyright
- taplo
- uv-lock

repos:
- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes

- repo: https://github.com/ComPWA/policy
rev: 60847f59f5f97c440e7addd72f2af3e0d6e86f6e
hooks:
- id: check-dev-files
args:
- --no-cd
- --no-pypi
- --repo-name=ComPWA benchmarks
- --repo-title=benchmarks
- id: colab-toc-visible
- id: remove-empty-tags

- repo: https://github.com/kynan/nbstripout
rev: 0.7.1
hooks:
- id: nbstripout
args:
- --drop-empty-cells
- --extra-keys
- |
cell.attachments
Expand All @@ -39,21 +51,8 @@ repos:
metadata.varInspector
metadata.vscode
- repo: https://github.com/ComPWA/policy
rev: 0.3.18
hooks:
- id: check-dev-files
args:
- --no-gitpod
- --no-prettierrc
- --no-pypi
- --repo-name=ComPWA benchmarks
- --repo-title=benchmarks
- id: colab-toc-visible
- id: remove-empty-tags

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.6
rev: v0.6.9
hooks:
- id: ruff
args: [--fix]
Expand All @@ -62,7 +61,7 @@ repos:
types_or: [python, pyi, jupyter]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-ast
- id: check-case-conflict
Expand All @@ -76,15 +75,15 @@ repos:
- id: mixed-line-ending
- id: trailing-whitespace

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
- repo: https://github.com/ComPWA/prettier-pre-commit
rev: v3.3.3
hooks:
- id: prettier

- repo: https://github.com/ComPWA/mirrors-taplo
rev: v0.8.1
- repo: https://github.com/ComPWA/taplo-pre-commit
rev: v0.9.3
hooks:
- id: taplo
- id: taplo-format

- repo: https://github.com/pappasam/toml-sort
rev: v0.23.1
Expand All @@ -94,7 +93,7 @@ repos:
- --in-place

- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: 2.7.3
rev: 3.0.3
hooks:
- id: editorconfig-checker
name: editorconfig
Expand All @@ -104,7 +103,12 @@ repos:
.*\.py
)$
- repo: https://github.com/ComPWA/mirrors-pyright
rev: v1.1.374
- repo: https://github.com/ComPWA/pyright-pre-commit
rev: v1.1.384
hooks:
- id: pyright

- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.4.22
hooks:
- id: uv-lock
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
1 change: 1 addition & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"executablebookproject.myst-highlight",
"github.vscode-github-actions",
"github.vscode-pull-request-github",
"mhutchie.git-graph",
"ms-python.python",
"ms-python.vscode-pylance",
"ms-vscode.live-server",
Expand Down
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,8 @@
"ruff.enable": true,
"ruff.importStrategy": "fromEnvironment",
"ruff.organizeImports": true,
"search.exclude": {
"**/uv.lock": true
},
"telemetry.telemetryLevel": "off"
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)
10 changes: 0 additions & 10 deletions environment.yml

This file was deleted.

Loading

0 comments on commit cb40a8b

Please sign in to comment.