Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DX: define developer environment with uv #107

Merged
merged 10 commits into from
Oct 18, 2024
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
1 change: 1 addition & 0 deletions .binder/apt.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
graphviz
11 changes: 11 additions & 0 deletions .binder/postBuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
set -ex
curl -LsSf https://astral.sh/uv/install.sh | sh
source $HOME/.cargo/env
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
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
4 changes: 2 additions & 2 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
watch_file pixi.lock
eval "$(pixi shell-hook)"
uv sync --all-extras --quiet
source .venv/bin/activate
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
docs/**/* linguist-documentation=false
pixi.lock linguist-language=YAML
37 changes: 0 additions & 37 deletions .github/workflows/ci-docs.yml

This file was deleted.

38 changes: 38 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: CI

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: |-
${{ github.ref != format('refs/heads/{0}', github.event.repository.default_branch) }}

env:
PYTHONHASHSEED: "0"

on:
push:
branches:
- main
- epic/*
- "[0-9]+.[0-9]+.x"
pull_request:
branches:
- main
- epic/*
- "[0-9]+.[0-9]+.x"
workflow_dispatch:
inputs:
specific-pip-packages:
description: Run CI with specific pip packages
required: false
type: string

jobs:
doc:
uses: ComPWA/actions/.github/workflows/ci-docs.yml@v2
permissions:
pages: write
id-token: write
with:
apt-packages: graphviz
gh-pages: true
specific-pip-packages: ${{ inputs.specific-pip-packages }}
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 }}
7 changes: 4 additions & 3 deletions .github/workflows/pr-linting.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
name: PR linting
jobs:
lint-pr:
uses: ComPWA/actions/.github/workflows/pr-linting.yml@v1
on:
pull_request:
types:
Expand All @@ -11,3 +8,7 @@ on:
- reopened
- synchronize
- unlabeled

jobs:
lint-pr:
uses: ComPWA/actions/.github/workflows/pr-linting.yml@v2
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
*.egg-info
.ipynb_checkpoints/
.pixi
.venv/
.virtual_documents/
node_modules/
**/*.pickle
Expand Down
99 changes: 66 additions & 33 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ci:
autoupdate_commit_msg: "MAINT: autoupdate pre-commit config"
autoupdate_commit_msg: "MAINT: update lock files"
autoupdate_schedule: quarterly

repos:
Expand All @@ -8,31 +8,20 @@ repos:
- id: check-hooks-apply
- id: check-useless-excludes

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-added-large-files
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/ComPWA/policy
rev: 0.3.18
rev: 0.5.0
hooks:
- id: check-dev-files
args:
- --doc-apt-packages=graphviz
- --github-pages
- --no-cd
- --no-pypi
- --repo-name=gluex-nstar
- --repo-name="Symbolic Amplitudes for Light Baryons"
- id: fix-nbformat-version
- id: remove-empty-tags

- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: 2.7.3
hooks:
- id: editorconfig-checker
name: editorconfig
alias: ec
exclude: >-
(?x)^(
.*\.py
)$

- repo: https://github.com/kynan/nbstripout
rev: 0.7.1
hooks:
Expand All @@ -42,23 +31,60 @@ repos:
- --extra-keys
- |
cell.attachments
cell.metadata.code_folding
cell.metadata.editable
cell.metadata.id
cell.metadata.pycharm
cell.metadata.slideshow
cell.metadata.user_expressions
metadata.celltoolbar
metadata.colab.name
metadata.colab.provenance
metadata.interpreter
metadata.notify_time
metadata.toc
metadata.toc-autonumbering
metadata.toc-showcode
metadata.toc-showmarkdowntxt
metadata.toc-showtags
metadata.varInspector
metadata.vscode

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.0
hooks:
- id: ruff
args: [--fix]
types_or: [python, pyi, jupyter]
- id: ruff-format
types_or: [python, pyi, jupyter]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/ComPWA/prettier-pre-commit
rev: v3.3.3
hooks:
- id: prettier
exclude: >-
(?x)^(
.*\.ipynb
)$

- repo: https://github.com/redeboer/taplo-pre-commit
rev: 0.9.1rc1
- repo: https://github.com/ComPWA/taplo-pre-commit
rev: v0.9.3
hooks:
- id: taplo
- id: taplo-format

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

- repo: https://github.com/pappasam/toml-sort
rev: v0.23.1
Expand All @@ -67,11 +93,18 @@ repos:
args:
- --in-place

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.7
- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: 3.0.3
hooks:
- id: ruff
args: [--fix]
types_or: [python, pyi, jupyter]
- id: ruff-format
types_or: [python, pyi, jupyter]
- id: editorconfig-checker
name: editorconfig
alias: ec
exclude: >-
(?x)^(
.*\.py
)$

- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.4.24
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
10 changes: 0 additions & 10 deletions .readthedocs.yaml

This file was deleted.

16 changes: 16 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 2
build:
os: "ubuntu-24.04"
tools:
python: "3.12"
commands:
- |-
export PIXI_HOME=$READTHEDOCS_VIRTUALENV_PATH
curl -fsSL https://pixi.sh/install.sh | bash
pixi global install uv
- |-
export UV_LINK_MODE=copy
uv run --extra doc --locked --with tox \
tox -e doc
mkdir -p $READTHEDOCS_OUTPUT
mv docs/_build/html $READTHEDOCS_OUTPUT
14 changes: 14 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,21 @@
"ms-vsliveshare.vsliveshare",
"redhat.vscode-yaml",
"simonsiefke.svg-preview",
"soulcode.vscode-unwanted-extensions",
"stkb.rewrap",
"tamasfe.even-better-toml",
"yzhang.markdown-all-in-one"
],
"unwantedRecommendations": [
"bungcip.better-toml",
"davidanson.vscode-markdownlint",
"garaioag.garaio-vscode-unwanted-recommendations",
"ms-python.black-formatter",
"ms-python.flake8",
"ms-python.isort",
"ms-python.mypy-type-checker",
"ms-python.pylint",
"travisillig.vscode-json-stable-stringify",
"tyriar.sort-lines"
]
}
Loading
Loading