Skip to content

Commit

Permalink
FIX: define dev dependencies as dependency groups (#35)
Browse files Browse the repository at this point in the history
* BREAK: convert package dependencies to notebook dependencies
* ENH: define script dependencies inline
  https://docs.astral.sh/uv/guides/scripts/#declaring-script-dependencies
* FIX: remove `pre-commit-uv` from environment
* FIX: remove developer dependencies from extras
* FIX: run envionment with Python 3.12
* MAINT: apply Ruff fixes
* MAINT: update lock files
  • Loading branch information
redeboer authored Oct 28, 2024
1 parent d826dfc commit d51af34
Show file tree
Hide file tree
Showing 8 changed files with 168 additions and 434 deletions.
5 changes: 4 additions & 1 deletion .binder/postBuild
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ set -ex
curl -LsSf https://astral.sh/uv/install.sh | sh
source $HOME/.cargo/env
uv export \
--extra jupyter \
--group jupyter \
--group notebooks \
--no-dev \
> requirements.txt
uv pip install \
--requirement requirements.txt \
--system
rm requirements.txt
uv cache clean
8 changes: 5 additions & 3 deletions .github/workflows/amptools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,14 @@ jobs:
make -j$(nproc)
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- run: pip install .
python-version: "3.12"
- uses: astral-sh/setup-uv@v3
with:
enable-cache: true
- name: Run executables
run: |
./print_amplitudes -c zlm.cfg > .print_amplitudes.log
python ./makeComparison.py
uv run makeComparison.py
./draw_zlm
working-directory: script
- uses: actions/upload-artifact@v3
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repos:
- id: check-useless-excludes

- repo: https://github.com/ComPWA/policy
rev: 0.5.0
rev: 0.5.5
hooks:
- id: colab-toc-visible
- id: check-dev-files
Expand Down Expand Up @@ -49,7 +49,7 @@ repos:
metadata.vscode
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.0
rev: v0.7.1
hooks:
- id: ruff
args: [--fix]
Expand Down Expand Up @@ -119,6 +119,6 @@ repos:
- "-y=defaultIndent: ' '"

- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.4.24
rev: 0.4.27
hooks:
- id: uv-lock
2 changes: 1 addition & 1 deletion binder/runtime.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
python-3.10
python-3.12
2 changes: 1 addition & 1 deletion docs/widget.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@
" sign = l_str[6]\n",
" indices = eval(l_str[9:])\n",
" superscript = f\"<sup>({sign})</sup>\"\n",
" subscript = f\"<sub>{\",\".join(f\"{i:+d}\" if i else str(i) for i in indices)}</sub>\"\n",
" subscript = f\"<sub>{','.join(f'{i:+d}' if i else str(i) for i in indices)}</sub>\"\n",
" label = f\"[𝑙]{superscript}{subscript}\"\n",
" row = w.HBox([w.HTML(label), sliders[f\"{l_str}_mag\"], sliders[f\"{l_str}_phi\"]])\n",
" l_sliders[sign].append(row)\n",
Expand Down
43 changes: 20 additions & 23 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,47 +3,44 @@ build-backend = "setuptools.build_meta"
requires = ["setuptools"]

[project]
dependencies = [
"ampform",
"ipympl",
"ipywidgets",
"ipywidgets",
"matplotlib",
"pandas",
"sympy",
"uproot",
]
description = "Investigation of symbolic amplitude models for the GlueX experiment"
license = {text = "BSD 3-Clause License"}
name = "gluex-amplitude"
requires-python = ">=3.12"
version = "0.0.0"

[project.optional-dependencies]
[project.readme]
content-type = "text/markdown"
file = "README.md"

[dependency-groups]
dev = [
"gluex-amplitude[doc]",
"gluex-amplitude[jupyter]",
"gluex-amplitude[sty]",
"ruff",
{include-group = "doc"},
{include-group = "jupyter"},
]
doc = [
"jupyter-book",
{include-group = "notebooks"},
]
doc = ["jupyter-book"]
jupyter = [
"jupyterlab",
"jupyterlab-code-formatter >=3.0.0",
"jupyterlab-code-formatter",
"jupyterlab-git",
"jupyterlab-lsp",
"jupyterlab-myst",
"python-lsp-ruff",
"python-lsp-server[rope]",
{include-group = "notebooks"},
]
sty = [
"pre-commit-uv",
"ruff",
notebooks = [
"ampform",
"ipympl",
"ipywidgets",
"matplotlib",
"sympy",
]

[project.readme]
content-type = "text/markdown"
file = "README.md"

[tool.ruff]
extend-include = ["*.ipynb"]
preview = true
Expand Down
7 changes: 7 additions & 0 deletions script/makeComparison.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# /// script
# dependencies = [
# "numpy",
# "pandas",
# "uproot",
# ]
# ///
import re

import numpy as np
Expand Down
529 changes: 127 additions & 402 deletions uv.lock

Large diffs are not rendered by default.

0 comments on commit d51af34

Please sign in to comment.