Skip to content

Commit 80c2921

Browse files
committed
build: Add missing common justfile recipes for ecosystem consistency
Added recipes: - fix-format: renamed from autoformat (autoformat kept as alias) - test-all: run tests on all environments - upgrade: upgrade dependencies in single environment - upgrade-all: upgrade dependencies in all environments - publish-pypi: download from GitHub and publish to PyPI - publish-rtd: trigger Read the Docs build - download-github-release: download release artifacts from GitHub These recipes align txaio with the common justfile recipes specification defined in MODERNIZATION.md for consistent developer experience across the WAMP Python ecosystem. Note: This work was completed with AI assistance (Claude Code).
1 parent f144cc8 commit 80c2921

1 file changed

Lines changed: 87 additions & 3 deletions

File tree

justfile

Lines changed: 87 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,30 @@ install-dev-all:
413413
just install-dev ${venv}
414414
done
415415
416+
# Upgrade dependencies in a single environment (usage: `just upgrade cpy314`)
417+
upgrade venv="": (create venv)
418+
#!/usr/bin/env bash
419+
set -e
420+
VENV_NAME="{{ venv }}"
421+
if [ -z "${VENV_NAME}" ]; then
422+
echo "==> No venv name specified. Auto-detecting from system Python..."
423+
VENV_NAME=$(just --quiet _get-system-venv-name)
424+
echo "==> Defaulting to venv: '${VENV_NAME}'"
425+
fi
426+
VENV_PYTHON=$(just --quiet _get-venv-python "${VENV_NAME}")
427+
echo "==> Upgrading dependencies in ${VENV_NAME}..."
428+
${VENV_PYTHON} -m pip install --upgrade pip
429+
${VENV_PYTHON} -m pip install --upgrade -e .[all,dev]
430+
echo "==> Dependencies upgraded in ${VENV_NAME}."
431+
432+
# Meta-recipe to run `upgrade` on all environments
433+
upgrade-all:
434+
#!/usr/bin/env bash
435+
set -e
436+
for venv in {{ENVS}}; do
437+
just upgrade ${venv}
438+
done
439+
416440
# -----------------------------------------------------------------------------
417441
# -- Installation: Tools (Ruff, Sphinx, etc)
418442
# -----------------------------------------------------------------------------
@@ -461,7 +485,7 @@ install-rust:
461485
# -----------------------------------------------------------------------------
462486

463487
# Automatically fix all formatting and code style issues.
464-
autoformat venv="": (install-tools venv)
488+
fix-format venv="": (install-tools venv)
465489
#!/usr/bin/env bash
466490
set -e
467491
VENV_NAME="{{ venv }}"
@@ -482,6 +506,9 @@ autoformat venv="": (install-tools venv)
482506
"${VENV_PATH}/bin/ruff" check --fix --exclude ./test ./txaio
483507
echo "--> Formatting complete."
484508
509+
# Alias for fix-format (backward compatibility)
510+
autoformat venv="": (fix-format venv)
511+
485512
# Lint code using Ruff in a single environment
486513
check-format venv="": (install-tools venv)
487514
#!/usr/bin/env bash
@@ -551,6 +578,14 @@ test venv="": (install-tools venv) (install venv)
551578
echo "==> Running test suite for ${VENV_NAME}..."
552579
"${VENV_PATH}/bin/pytest"
553580
581+
# Meta-recipe to run `test` on all environments
582+
test-all:
583+
#!/usr/bin/env bash
584+
set -e
585+
for venv in {{ENVS}}; do
586+
just test ${venv}
587+
done
588+
554589
# -----------------------------------------------------------------------------
555590
# -- Documentation
556591
# -----------------------------------------------------------------------------
@@ -652,8 +687,28 @@ verify-wheels venv="": (install-tools venv)
652687
echo ""
653688
echo "==> Wheel verification complete."
654689
655-
# Publish package to PyPI (requires twine setup)
656-
publish venv="": (build venv) (build-sourcedist venv) (verify-wheels venv)
690+
# Publish package to PyPI (requires twine setup) - meta-recipe
691+
publish venv="" tag="": (publish-pypi venv tag) (publish-rtd tag)
692+
693+
# Download GitHub release artifacts (usage: `just download-github-release` for nightly, or `just download-github-release stable`)
694+
download-github-release release_type="nightly":
695+
#!/usr/bin/env bash
696+
set -e
697+
echo "==> Downloading GitHub release artifacts (${release_type})..."
698+
mkdir -p dist/
699+
if [ "{{ release_type }}" = "stable" ]; then
700+
gh release download --repo crossbario/txaio --pattern "*.whl" --pattern "*.tar.gz" --dir dist/
701+
else
702+
gh release download --repo crossbario/txaio --pattern "*.whl" --pattern "*.tar.gz" --dir dist/ nightly || echo "No nightly release found, trying latest..."
703+
if [ ! -f dist/*.whl ]; then
704+
gh release download --repo crossbario/txaio --pattern "*.whl" --pattern "*.tar.gz" --dir dist/
705+
fi
706+
fi
707+
echo "==> Downloaded artifacts:"
708+
ls -la dist/
709+
710+
# Download release artifacts from GitHub and publish to PyPI
711+
publish-pypi venv="" tag="": (install-tools venv)
657712
#!/usr/bin/env bash
658713
set -e
659714
VENV_NAME="{{ venv }}"
@@ -663,5 +718,34 @@ publish venv="": (build venv) (build-sourcedist venv) (verify-wheels venv)
663718
echo "==> Defaulting to venv: '${VENV_NAME}'"
664719
fi
665720
VENV_PATH="{{ VENV_DIR }}/${VENV_NAME}"
721+
722+
TAG="{{ tag }}"
723+
if [ -z "${TAG}" ]; then
724+
echo "==> No tag specified, using local build..."
725+
just build ${VENV_NAME}
726+
just build-sourcedist ${VENV_NAME}
727+
else
728+
echo "==> Downloading release artifacts for tag ${TAG}..."
729+
mkdir -p dist/
730+
gh release download --repo crossbario/txaio --pattern "*.whl" --pattern "*.tar.gz" --dir dist/ "${TAG}"
731+
fi
732+
733+
echo "==> Verifying artifacts..."
734+
"${VENV_PATH}/bin/twine" check dist/*
735+
666736
echo "==> Publishing to PyPI..."
667737
"${VENV_PATH}/bin/twine" upload dist/*
738+
739+
# Trigger Read the Docs build for a specific tag
740+
publish-rtd tag="":
741+
#!/usr/bin/env bash
742+
set -e
743+
TAG="{{ tag }}"
744+
if [ -z "${TAG}" ]; then
745+
echo "==> No tag specified. RTD will build from webhook on push."
746+
echo " To manually trigger: https://readthedocs.org/projects/txaio/builds/"
747+
else
748+
echo "==> RTD build triggered by GitHub webhook on tag push."
749+
echo " Monitor build at: https://readthedocs.org/projects/txaio/builds/"
750+
echo " Documentation will be available at: https://txaio.readthedocs.io/en/${TAG}/"
751+
fi

0 commit comments

Comments
 (0)