Skip to content

Commit

Permalink
DX: define developer environment with uv
Browse files Browse the repository at this point in the history
  • Loading branch information
redeboer committed Oct 17, 2024
1 parent 5ef0cb1 commit 2a2a2a3
Show file tree
Hide file tree
Showing 26 changed files with 5,044 additions and 341 deletions.
18 changes: 18 additions & 0 deletions .binder/postBuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
set -ex
curl -LsSf https://pixi.sh/install.sh | bash
export PATH="$HOME/.pixi/bin:$PATH"

pixi_packages="$(NO_COLOR= pixi list --explicit --no-install | awk 'NR > 1 {print $1}')"
if [[ -n "$pixi_packages" ]]; then
pixi global install $pixi_packages
fi
pixi clean cache --yes

uv export \
--extra jupyter \
> 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
6 changes: 4 additions & 2 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
".readthedocs.yml",
".vscode/*",
"docs/conf.py",
"pyproject.toml",
"tox.ini"
"pyproject.toml"
],
"language": "en-US",
"overrides": [
Expand Down Expand Up @@ -89,6 +88,7 @@
"Mikhasenko",
"NumPy",
"parametrizations",
"Pixi",
"plotly",
"pyplot",
"QRules",
Expand Down Expand Up @@ -172,6 +172,7 @@
"iframe",
"imag",
"infty",
"installkernel",
"ioff",
"iplt",
"ipykernel",
Expand Down Expand Up @@ -283,6 +284,7 @@
"unbinned",
"unnormalized",
"unsrt",
"venv",
"viridis",
"vmax",
"vmin",
Expand Down
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ indent_size = 4

[LICENSE]
indent_size = unset

[uv.lock]
indent_size = 4
14 changes: 4 additions & 10 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
if [ -e .venv ]; then
source .venv/bin/activate
elif [ -e venv ]; then
source venv/bin/activate
elif [ -e .pixi ]; then
watch_file pixi.lock
eval "$(pixi shell-hook)"
else
layout anaconda
fi
watch_file pixi.lock
eval "$(pixi shell-hook)"
uv sync --all-extras --quiet
source .venv/bin/activate
39 changes: 0 additions & 39 deletions .github/release-drafter.yml

This file was deleted.

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

This file was deleted.

8 changes: 2 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,15 @@ 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
with:
apt-packages: graphviz
gh-pages: true
python-version: "3.12"
specific-pip-packages: ${{ inputs.specific-pip-packages }}
style:
if: inputs.specific-pip-packages == ''
secrets:
token: ${{ secrets.PAT }}
uses: ComPWA/actions/.github/workflows/pre-commit.yml@v1
with:
python-version: "3.12"
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.

3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ version.py

# Temporary files
*.pyc
*condaenv.*
.coverage
.coverage.*
.ipynb_checkpoints/
Expand All @@ -38,7 +37,6 @@ prof/
.pixi/
.tox/
*venv/
pixi.lock
pyvenv*/

# Settings
Expand All @@ -53,6 +51,5 @@ pyvenv*/
!.readthedocs.yml
!.vscode/*.json
!codecov.yml
!environment.yml
!pyrightconfig.json
.jupyter_ystore.db
63 changes: 34 additions & 29 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
ci:
autoupdate_commit_msg: "MAINT: autoupdate pre-commit hooks"
autoupdate_commit_msg: "MAINT: update lock files"
autoupdate_schedule: quarterly
skip:
- pin-nb-requirements
- pyright
- uv-lock

repos:
- repo: meta
Expand All @@ -12,16 +13,15 @@ repos:
- id: check-useless-excludes

- repo: https://github.com/ComPWA/policy
rev: 0.4.1
rev: 0.5.0rc10
hooks:
- id: check-dev-files
args:
- --doc-apt-packages=graphviz
- --dev-python-version=3.12
- --github-pages
- --imports-on-top
- --no-prettierrc
- --no-cd
- --no-pypi
- --package-manager=pixi+uv
- --repo-name=report
- --repo-title=ComPWA Technical Reports
- id: colab-toc-visible
Expand Down Expand Up @@ -56,8 +56,27 @@ repos:
metadata.varInspector
metadata.vscode
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.8.7
hooks:
- id: nbqa-isort
args: [--float-to-top]
exclude: >-
(?x)^(
docs/001\.ipynb|
docs/002\.ipynb|
docs/003\.ipynb|
docs/008\.ipynb|
docs/013\.ipynb|
docs/018\.ipynb|
docs/020\.ipynb|
docs/026\.ipynb|
docs/027\.ipynb|
docs/028\.ipynb
)$
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.8
rev: v0.6.9
hooks:
- id: ruff
args: [--fix]
Expand All @@ -66,7 +85,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 Down Expand Up @@ -103,7 +122,7 @@ repos:
exclude: (?x)^(.*/Manifest\.toml|.*/Project\.toml)$

- repo: https://github.com/streetsidesoftware/cspell-cli
rev: v8.13.3
rev: v8.15.1
hooks:
- id: cspell

Expand All @@ -128,25 +147,6 @@ repos:
docs/_static/favicon.ico
)$
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.8.7
hooks:
- id: nbqa-isort
args: [--float-to-top]
exclude: >-
(?x)^(
docs/001\.ipynb|
docs/002\.ipynb|
docs/003\.ipynb|
docs/008\.ipynb|
docs/013\.ipynb|
docs/018\.ipynb|
docs/020\.ipynb|
docs/026\.ipynb|
docs/027\.ipynb|
docs/028\.ipynb
)$
- repo: local
hooks:
- id: pin-nb-requirements
Expand All @@ -159,7 +159,12 @@ repos:
types:
- jupyter

- repo: https://github.com/ComPWA/mirrors-pyright
rev: v1.1.382
- repo: https://github.com/ComPWA/pyright-pre-commit
rev: v1.1.385
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
31 changes: 14 additions & 17 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
version: 2

sphinx:
builder: html
configuration: docs/conf.py
fail_on_warning: true

formats:
- htmlzip

build:
os: ubuntu-22.04
apt_packages:
- graphviz
os: ubuntu-24.04
tools:
python: "3.12"
jobs:
pre_install:
- ./docs/install-julia-on-rtd.sh
post_install:
- python -m pip install 'uv>=0.2.0'
- python -m uv pip install -e .[doc]
commands:
- |-
export PIXI_HOME=$READTHEDOCS_VIRTUALENV_PATH
curl -fsSL https://pixi.sh/install.sh | bash
export UV_LINK_MODE=copy
pixi run \
uv run \
--extra doc \
--locked \
--with tox \
tox -e doc
mkdir -p $READTHEDOCS_OUTPUT
mv docs/_build/html $READTHEDOCS_OUTPUT
Loading

0 comments on commit 2a2a2a3

Please sign in to comment.