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
20 changes: 7 additions & 13 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -100,22 +100,16 @@
*.pyd binary
*.pyo binary

# Note: .db, .p, and .pkl files are associated
# with the python modules ``pickle``, ``dbm.*``,
# ``shelve``, ``marshal``, ``anydbm``, & ``bsddb``
# (among others).

# Jupyter notebook
*.ipynb text eol=lf

# Specific project files to override
# ============

# Poetry is inconsistent with the way it generates files, so in some cases we
# have to force them to the correct line ending in the run script or the
# pre-commit hooks. We don't bother doing that with poetry.lock, since its
# format is considered an implementation detail of Poetry itself.
pyproject.toml text eol=lf
poetry.toml text eol=lf
poetry.lock text=auto
docs/requirements.txt text eol=lf

# Note: .db, .p, and .pkl files are associated
# with the python modules ``pickle``, ``dbm.*``,
# ``shelve``, ``marshal``, ``anydbm``, & ``bsddb``
# (among others).
pyproject.toml text eol=lf
uv.lock text=auto
8 changes: 4 additions & 4 deletions .github/workflows/test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ concurrency:
jobs:
linux-build-and-test:
name: "Linux"
uses: pronovic/gha-shared-workflows/.github/workflows/poetry-build-and-test.yml@v9
uses: pronovic/gha-shared-workflows/.github/workflows/uv-build-and-test.yml@v10
secrets: inherit
with:
matrix-os-version: "[ 'ubuntu-latest' ]"
Expand All @@ -23,22 +23,22 @@ jobs:
persist-python-version: "3.10" # persist artifacts for the oldest supported Python version
macos-build-and-test:
name: "MacOS"
uses: pronovic/gha-shared-workflows/.github/workflows/poetry-build-and-test.yml@v9
uses: pronovic/gha-shared-workflows/.github/workflows/uv-build-and-test.yml@v10
secrets: inherit
with:
matrix-os-version: "[ 'macos-latest' ]"
matrix-python-version: "[ '3.13' ]" # only run MacOS tests on latest Python
windows-build-and-test:
name: "Windows"
uses: pronovic/gha-shared-workflows/.github/workflows/poetry-build-and-test.yml@v9
uses: pronovic/gha-shared-workflows/.github/workflows/uv-build-and-test.yml@v10
secrets: inherit
with:
matrix-os-version: "[ 'windows-latest' ]"
matrix-python-version: "[ '3.13' ]" # only run Windows tests on latest Python
release:
name: "Release"
if: github.ref_type == 'tag'
uses: pronovic/gha-shared-workflows/.github/workflows/poetry-release.yml@v9
uses: pronovic/gha-shared-workflows/.github/workflows/release.yml@v10
needs: [ linux-build-and-test, macos-build-and-test, windows-build-and-test ]
secrets: inherit
with:
Expand Down
10 changes: 3 additions & 7 deletions .run/commands/bumpchangelog.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
# vim: set ft=bash ts=3 sw=3 expandtab:
# Bump the version in the changelog, preparing for a new development cycle

# This relies on the poetry-dynamic-versioning plugin, which is assumed to be
# installed as a project plugin. If it's not installed, the new version in the
# Changelog will always be "0.0.1", because all Poetry is aware of is the
# hardcoded version "0.0.0".
# Bump the version in the changelog, preparing for a new development cycle.
# This relies on the uv-dynamic-versioning plugin.

command_bumpchangelog() {
mv Changelog Changelog.$$
echo "Version $(poetry version patch --short --dry-run) unreleased" > Changelog
echo "Version $(uvx --from=semver pysemver bump patch $(uvx uv-dynamic-versioning)) unreleased" > Changelog
echo "" >> Changelog
echo $'\t* ' >> Changelog
echo "" >> Changelog
Expand Down
2 changes: 1 addition & 1 deletion .run/commands/dos2unix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ with open(path, "wb") as f:
sys.exit(0)
EOF

poetry_run python "$WORKING_DIR/dos2unix.py" "$1"
run_command uvrun python "$WORKING_DIR/dos2unix.py" "$1"
}

11 changes: 0 additions & 11 deletions .run/commands/latestcode.sh

This file was deleted.

2 changes: 1 addition & 1 deletion .run/commands/mypy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

command_mypy() {
echo "Running mypy checks..."
poetry_run mypy --hide-absolute-path "$@"
run_command uvrun mypy --hide-absolute-path "$@"
echo "done"
}

41 changes: 0 additions & 41 deletions .run/commands/outdated.sh

This file was deleted.

35 changes: 0 additions & 35 deletions .run/commands/poetrybuild.sh

This file was deleted.

2 changes: 1 addition & 1 deletion .run/commands/precommit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
command_precommit() {
echo -n "Installing pre-commit hooks..."
if git rev-parse --git-dir > /dev/null 2>&1; then
poetry_run pre-commit install
run_command uvrun prek install --overwrite
else
echo "not a Git repository"
fi
Expand Down
10 changes: 5 additions & 5 deletions .run/commands/pytest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ command_pytest() {
fi

if [ $coverage == "yes" ]; then
poetry_run coverage run -m pytest --testdox --force-testdox $color $tests
poetry_run coverage report
poetry_run coverage lcov -o .coverage.lcov
run_command uvrun coverage run -m pytest --testdox --force-testdox $color $tests
run_command uvrun coverage report
run_command uvrun coverage lcov -o .coverage.lcov
if [ $html == "yes" ]; then
poetry_run coverage html -d .htmlcov
run_command uvrun coverage html -d .htmlcov
run_command openfile .htmlcov/index.html
fi
else
poetry_run pytest --testdox --force-testdox $color $tests
run_command uvrun pytest --testdox --force-testdox $color $tests
fi
}

18 changes: 4 additions & 14 deletions .run/commands/pythonversion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,9 @@
# Display information about the Python version that is in use

command_pythonversion() {
if [ "$1" == "--short" ]; then
echo "============================================================"
echo "Execution environment: $(poetry run python --version)"
echo "============================================================"
echo ""
else
echo "============================================================"
echo "Execution environment: $(poetry run python --version)"
echo "============================================================"
poetry env info
echo ""
echo "============================================================"
echo ""
fi
echo "============================================================"
echo "Execution environment: $(run_command uvrun python --version)"
echo "============================================================"
echo ""
}

2 changes: 1 addition & 1 deletion .run/commands/ruffautofix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

command_ruffautofix() {
echo "Applying Ruff automatic fixes..."
CLICOLOR_FORCE=1 poetry_run ruff check --fix --fix-only "$@"
CLICOLOR_FORCE=1 run_command uvrun ruff check --fix --fix-only "$@"
echo "done"
}

2 changes: 1 addition & 1 deletion .run/commands/ruffformat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

command_ruffformat() {
echo "Running Ruff formatter..."
CLICOLOR_FORCE=1 poetry_run ruff format "$@"
CLICOLOR_FORCE=1 run_command uvrun ruff format "$@"
echo "done"
}

2 changes: 1 addition & 1 deletion .run/commands/rufflint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ command_rufflint() {
echo "Running Ruff linter..."

# normally we would just run the command, but the $() subshell messes with error handling
OUTPUT=$(CLICOLOR_FORCE=1 poetry_run ruff check --no-fix 2>&1)
OUTPUT=$(CLICOLOR_FORCE=1 run_command uvrun ruff check --no-fix 2>&1)
if [ $? != 0 ]; then
echo "$OUTPUT" | sed 's/ *.*-->.* //'
exit 1
Expand Down
2 changes: 1 addition & 1 deletion .run/commands/sphinx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ command_sphinx() {

cd docs

poetry_run sphinx-build -N -E -a -b html -d _build/doctrees . _build/html 2>&1 | grep -v -F --file=.sphinxignore
run_command uvrun sphinx-build -N -E -a -b html -d _build/doctrees . _build/html 2>&1 | grep -v -F --file=.sphinxignore
if [ $open == "yes" ]; then
run_command openfile _build/html/index.html
fi
Expand Down
2 changes: 1 addition & 1 deletion .run/commands/unix2dos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ with open(path, "wb") as f:
sys.exit(0)
EOF

poetry_run python "$WORKING_DIR/unix2dos.py" "$1"
run_command uvrun python "$WORKING_DIR/unix2dos.py" "$1"
}

20 changes: 20 additions & 0 deletions .run/commands/uvbuild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# vim: set ft=bash ts=3 sw=3 expandtab:
# Build release artifacts into the dist/ directory

# The $SOURCE_DATE_EPOCH controls the timestamp on files in the generated sdist.
# See also: https://hatch.pypa.io/1.13/config/build/#reproducible-builds

command_uvbuild() {
rm -f dist/*

SOURCE_DATE_EPOCH=$(TZ=UTC date "+%s") uv build --wheel --sdist
if [ $? != 0 ]; then
echo "*** Build failed"
exit 1
fi

ls -l dist/

echo "done"
}

33 changes: 33 additions & 0 deletions .run/commands/uvoutdated.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# vim: set ft=bash ts=3 sw=3 expandtab:
# List outdated dependency constraints in pyproject.toml, which would prevent upgrading to the latest version.
# Due to the way `uv tree` works, we need to temporarily upgrade all packages before calling it.

command_uvoutdated() {
echo -n "Checking for outdated constraints..."

cp uv.lock .uv.lock.saved.$$
git checkout -q -- uv.lock
run_command uvsync --quiet
uv lock --quiet --upgrade

constraints=$(
uv tree --all-groups --outdated --depth 1 --color=never 2>/dev/null \
| grep '^├── .*(latest: .*)$' \
| sed 's/^├── / /' \
| sed 's/(group: .*) //' \
| sed 's/(latest: /-> /' \
| sed 's/)$//'
)

mv .uv.lock.saved.$$ uv.lock
run_command uvsync --quiet

if [ -z "$constraints" ]; then
echo "none found"
else
echo "$(echo "$constraints" | wc -l) found"
echo ""
echo "$constraints"
echo ""
fi
}
18 changes: 18 additions & 0 deletions .run/commands/uvrun.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# vim: set ft=bash ts=3 sw=3 expandtab:
# Run a command via UV.

command_uvrun() {
local COMMAND

COMMAND="$1"
shift 1

run_command uvsync

uv run "$COMMAND" "$@"
if [ $? != 0 ]; then
echo "Command failed: uv run $COMMAND $@"
exit 1
fi
}

11 changes: 11 additions & 0 deletions .run/commands/uvsync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# vim: set ft=bash ts=3 sw=3 expandtab:
# Run UV's synchronize operation.

command_uvsync() {
uv sync --quiet --all-extras --all-groups --frozen --compile-bytecode "$@"
if [ $? != 0 ]; then
echo "Command failed: uv sync"
exit 1
fi
}

14 changes: 14 additions & 0 deletions .run/commands/uvupdate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# vim: set ft=bash ts=3 sw=3 expandtab:
# Update all dependencies, or a subset of package dependencies passed in as arguments.

# UV's command line interface here is awkward. When you want to upgrade multiple
# packages, each package needs its own --upgrade-package argument to the uv command.

command_uvupdate() {
if [ $# == 0 ]; then
uv lock --upgrade
else
uv lock $(for arg in "$@"; do echo -n " --upgrade-package $arg"; done)
fi
}

Loading
Loading