@@ -22,11 +22,34 @@ VENV_DIR := './.venvs'
2222# Define supported Python environments
2323ENVS := ' cpy314 cpy313 cpy312 cpy311 pypy311'
2424
25- # Default recipe: list all recipes
25+ # Default recipe: show project header and list all recipes
2626default :
27- @ echo " "
28- @ just --list
29- @ echo " "
27+ #!/usr/bin/env bash
28+ set -e
29+ VERSION=$(grep ' ^version' pyproject.toml | head -1 | sed ' s/.*= *"\(.*\)"/\1/' )
30+ GIT_REV=$(git rev-parse --short HEAD 2 >/ dev/ null || echo " unknown" )
31+ echo " "
32+ echo " ==============================================================================="
33+ echo " cfxdb "
34+ echo " "
35+ echo " Crossbar.io database schemas and access classes for zLMDB/LMDB "
36+ echo " "
37+ echo " Python Package: cfxdb "
38+ echo " Python Package Version: ${VERSION} "
39+ echo " Git Version: ${GIT_REV} "
40+ echo " Protocol Specification: https://wamp-proto.org/ "
41+ echo " Documentation: https://crossbar.readthedocs.io "
42+ echo " Package Releases: https://pypi.org/project/cfxdb/ "
43+ echo " Nightly/Dev Releases: https://github.com/crossbario/cfxdb/releases "
44+ echo " Source Code: https://github.com/crossbario/cfxdb "
45+ echo " Copyright: typedef int GmbH (Germany/EU) "
46+ echo " License: MIT License "
47+ echo " "
48+ echo " >>> Created by The WAMP/Autobahn/Crossbar.io OSS Project <<< "
49+ echo " ==============================================================================="
50+ echo " "
51+ just --list
52+ echo " "
3053
3154# Internal helper to map Python version short name to full uv version
3255_ get-spec short_name :
@@ -242,6 +265,22 @@ install-all:
242265 just install-dev ${env }
243266 done
244267
268+ # Meta-recipe to run `install-dev` on all environments
269+ install-dev-all :
270+ #!/usr/bin/env bash
271+ set -e
272+ for venv in {{ ENVS}} ; do
273+ just install-dev ${venv}
274+ done
275+
276+ # Meta-recipe to run `install-tools` on all environments
277+ install-tools-all :
278+ #!/usr/bin/env bash
279+ set -e
280+ for venv in {{ ENVS}} ; do
281+ just install-tools ${venv}
282+ done
283+
245284# -----------------------------------------------------------------------------
246285# -- Code Quality
247286# -----------------------------------------------------------------------------
@@ -252,25 +291,28 @@ check-format venv="":
252291 set -e
253292 VENV_PYTHON=$(just --quiet _get-venv-python {{ venv }})
254293 echo " ==> Checking code formatting with Ruff..."
255- ${VENV_PYTHON} -m ruff format --check cfxdb/
294+ ${VENV_PYTHON} -m ruff format --check src / cfxdb/
256295 echo " --> Format check passed"
257296
258- # Auto-format code with Ruff (modifies files in-place!)
259- autoformat venv = " ":
297+ # Automatically fix all formatting and code style issues.
298+ fix-format venv = " ": ( install-tools venv)
260299 #!/usr/bin/env bash
261300 set -e
262301 VENV_PYTHON=$(just --quiet _get-venv-python {{ venv }})
263302 echo " ==> Auto-formatting code with Ruff..."
264- ${VENV_PYTHON} -m ruff format cfxdb/
303+ ${VENV_PYTHON} -m ruff format src / cfxdb/
265304 echo " --> Code formatted"
266305
306+ # Alias for fix-format (backward compatibility)
307+ autoformat venv = " ": (fix-format venv)
308+
267309# Run Ruff linter
268310check-lint venv = " ":
269311 #!/usr/bin/env bash
270312 set -e
271313 VENV_PYTHON=$(just --quiet _get-venv-python {{ venv }})
272314 echo " ==> Running Ruff linter..."
273- ${VENV_PYTHON} -m ruff check cfxdb/
315+ ${VENV_PYTHON} -m ruff check src / cfxdb/
274316 echo " --> Linting passed"
275317
276318# Run static type checking with mypy
@@ -279,7 +321,7 @@ check-typing venv="":
279321 set -e
280322 VENV_PYTHON=$(just --quiet _get-venv-python {{ venv }})
281323 echo " ==> Running type checking with mypy..."
282- ${VENV_PYTHON} -m mypy cfxdb/ || echo " Warning: Type checking found issues"
324+ ${VENV_PYTHON} -m mypy src / cfxdb/ || echo " Warning: Type checking found issues"
283325
284326# Run all code quality checks
285327check venv = " ": (check-format venv) (check-lint venv) (check-typing venv)
@@ -288,13 +330,13 @@ check venv="": (check-format venv) (check-lint venv) (check-typing venv)
288330# -- Testing
289331# -----------------------------------------------------------------------------
290332
291- # Run the test suite with pytest
333+ # Run the test suite with pytest (requires: `just install-dev`)
292334test venv = " ":
293335 #!/usr/bin/env bash
294336 set -e
295337 VENV_PYTHON=$(just --quiet _get-venv-python {{ venv }})
296338 echo " ==> Running test suite with pytest..."
297- ${VENV_PYTHON} -m pytest -v cfxdb/
339+ ${VENV_PYTHON} -m pytest -v src / cfxdb/ tests /
298340 echo " --> Tests passed"
299341
300342# Run tests in all environments
@@ -309,65 +351,106 @@ test-all:
309351 just test ${env }
310352 done
311353
312- # Generate code coverage report
313- coverage venv = " ":
354+ # Upgrade dependencies in a single environment (re-installs all deps to latest)
355+ upgrade venv = " ": (create venv)
356+ #!/usr/bin/env bash
357+ set -e
358+ VENV_PYTHON=$(just --quiet _get-venv-python {{ venv }})
359+ echo " ==> Upgrading all dependencies..."
360+ ${VENV_PYTHON} -m pip install --upgrade pip
361+ ${VENV_PYTHON} -m pip install --upgrade -e ' .[dev]'
362+ echo " --> Dependencies upgraded"
363+
364+ # Meta-recipe to run `upgrade` on all environments
365+ upgrade-all :
366+ #!/usr/bin/env bash
367+ set -e
368+ for venv in {{ ENVS}} ; do
369+ echo " "
370+ echo " ======================================================================"
371+ echo " Upgrading ${venv}"
372+ echo " ======================================================================"
373+ just upgrade ${venv}
374+ done
375+
376+ # Generate code coverage report (requires: `just install-dev`)
377+ check-coverage venv = " ":
314378 #!/usr/bin/env bash
315379 set -e
316380 VENV_PYTHON=$(just --quiet _get-venv-python {{ venv }})
317381 echo " ==> Generating coverage report..."
318- ${VENV_PYTHON} -m pytest --cov=cfxdb --cov-report=html --cov-report=term cfxdb/
382+ ${VENV_PYTHON} -m pytest --cov=cfxdb --cov-report=html --cov-report=term src / cfxdb/ tests /
319383 echo " --> Coverage report generated in htmlcov/"
320384
385+ # Alias for check-coverage (backward compatibility)
386+ coverage venv = " ": (check-coverage venv)
387+
321388# -----------------------------------------------------------------------------
322389# -- Building
323390# -----------------------------------------------------------------------------
324391
325392# Build source distribution
326- build-sourcedist venv = " ":
393+ build-sourcedist venv = " ": ( install-build-tools venv)
327394 #!/usr/bin/env bash
328395 set -e
329- VENV_PYTHON=$(just --quiet _get-venv-python {{ venv }})
396+ VENV_NAME=" {{ venv }} "
397+ if [ -z " ${VENV_NAME}" ]; then
398+ VENV_NAME=$(just --quiet _get-system-venv-name)
399+ fi
400+ VENV_PYTHON=$(just --quiet _get-venv-python " ${VENV_NAME}" )
330401 echo " ==> Building source distribution..."
331402 ${VENV_PYTHON} -m build --sdist
332- echo " --> Source distribution built"
403+ ls -la dist /
333404
334405# Build wheel package
335- build venv = " ":
406+ build venv = " ": ( install-build-tools venv)
336407 #!/usr/bin/env bash
337408 set -e
338- VENV_PYTHON=$(just --quiet _get-venv-python {{ venv }})
339- echo " ==> Building wheel..."
409+ VENV_NAME=" {{ venv }} "
410+ if [ -z " ${VENV_NAME}" ]; then
411+ VENV_NAME=$(just --quiet _get-system-venv-name)
412+ fi
413+ VENV_PATH=" {{ VENV_DIR}} /${VENV_NAME}"
414+ VENV_PYTHON=$(just --quiet _get-venv-python " ${VENV_NAME}" )
415+ echo " ==> Building wheel package..."
340416 ${VENV_PYTHON} -m build --wheel
341- echo " --> Wheel built"
417+ ls -la dist /
342418
343419# Build both source distribution and wheel
344- dist venv = " ":
420+ dist venv = " ": ( install-build-tools venv)
345421 #!/usr/bin/env bash
346422 set -e
347- VENV_PYTHON=$(just --quiet _get-venv-python {{ venv }})
423+ VENV_NAME=" {{ venv }} "
424+ if [ -z " ${VENV_NAME}" ]; then
425+ VENV_NAME=$(just --quiet _get-system-venv-name)
426+ fi
427+ VENV_PYTHON=$(just --quiet _get-venv-python " ${VENV_NAME}" )
348428 echo " ==> Building distribution packages..."
349429 ${VENV_PYTHON} -m build
350- echo " --> Distribution packages built"
351430 echo " "
352431 echo " Built packages:"
353432 ls -lh dist/
354433
355- # Build wheels for all environments
356- build-all :
357- #!/usr/bin/env bash
358- set -e
359- for env in {{ ENVS}} ; do
360- just build ${env }
361- done
434+ # Build wheels for all environments (pure Python - only needs one build)
435+ build-all : (build " cpy311" )
436+ echo " ==> Pure Python package: single universal wheel built."
362437
363- # Verify distribution packages
364- verify-dist venv = " ":
438+ # Verify wheels using twine check (pure Python package - auditwheel not applicable)
439+ verify-wheels venv = " ": ( install-tools venv)
365440 #!/usr/bin/env bash
366441 set -e
367- VENV_PYTHON=$(just --quiet _get-venv-python {{ venv }})
368- echo " ==> Verifying distribution packages..."
369- ${VENV_PYTHON} -m twine check dist/ *
370- echo " --> Verification passed"
442+ VENV_NAME=" {{ venv }} "
443+ if [ -z " ${VENV_NAME}" ]; then
444+ VENV_NAME=$(just --quiet _get-system-venv-name)
445+ fi
446+ VENV_PATH=" {{ VENV_DIR}} /${VENV_NAME}"
447+ echo " ==> Verifying wheels with twine check..."
448+ " ${VENV_PATH}/bin/twine" check dist/ *
449+ echo " "
450+ echo " ==> Note: This is a pure Python package (py3-none-any wheel)."
451+ echo " auditwheel verification is not applicable (no native extensions)."
452+ echo " "
453+ echo " ==> Wheel verification complete."
371454
372455# -----------------------------------------------------------------------------
373456# -- Documentation
@@ -420,3 +503,76 @@ publish-test venv="":
420503 echo " ==> Publishing to Test PyPI..."
421504 ${VENV_PYTHON} -m twine upload --repository testpypi dist/ *
422505 echo " --> Published to Test PyPI"
506+
507+ # Download GitHub release artifacts (nightly or tagged release)
508+ download-github-release release_type = " nightly":
509+ #!/usr/bin/env bash
510+ set -e
511+ echo " ==> Downloading GitHub release artifacts ({{ release_type}} )..."
512+ rm -rf ./ dist
513+ mkdir -p ./ dist
514+ if [ " {{ release_type}} " = " nightly" ]; then
515+ gh release download nightly --repo crossbario/ cfxdb --dir ./ dist --pattern ' *.whl' --pattern ' *.tar.gz' || \
516+ echo " Note: No nightly release found or no artifacts available"
517+ else
518+ gh release download " {{ release_type}} " --repo crossbario/ cfxdb --dir ./ dist --pattern ' *.whl' --pattern ' *.tar.gz'
519+ fi
520+ echo " "
521+ echo " Downloaded artifacts:"
522+ ls -la ./ dist/ || echo " No artifacts downloaded"
523+
524+ # Download release artifacts from GitHub and publish to PyPI
525+ publish-pypi venv = " " tag = " ": (install-tools venv)
526+ #!/usr/bin/env bash
527+ set -e
528+ VENV_PATH=" {{ VENV_DIR}} /$(just --quiet _get-system-venv-name)"
529+ if [ -n " {{ venv }} " ]; then
530+ VENV_PATH=" {{ VENV_DIR}} /{{ venv }} "
531+ fi
532+ TAG=" {{ tag }} "
533+ if [ -z " ${TAG}" ]; then
534+ echo " Error: Please specify a tag to publish"
535+ echo " Usage: just publish-pypi cpy311 v24.1.1"
536+ exit 1
537+ fi
538+ echo " ==> Publishing ${TAG} to PyPI..."
539+ echo " "
540+ echo " Step 1: Download release artifacts from GitHub..."
541+ just download-github-release " ${TAG}"
542+ echo " "
543+ echo " Step 2: Verify packages with twine..."
544+ " ${VENV_PATH}/bin/twine" check dist/ *
545+ echo " "
546+ echo " Note: This is a pure Python package (py3-none-any wheel)."
547+ echo " auditwheel verification is not applicable (no native extensions)."
548+ echo " "
549+ echo " Step 3: Upload to PyPI..."
550+ echo " "
551+ echo " WARNING: This will upload to PyPI!"
552+ echo " Press Ctrl+C to cancel, or Enter to continue..."
553+ read
554+ " ${VENV_PATH}/bin/twine" upload dist/ *
555+ echo " "
556+ echo " ==> Successfully published ${TAG} to PyPI"
557+
558+ # Trigger Read the Docs build for a specific tag
559+ publish-rtd tag = " ":
560+ #!/usr/bin/env bash
561+ set -e
562+ TAG=" {{ tag }} "
563+ if [ -z " ${TAG}" ]; then
564+ echo " Error: Please specify a tag to build"
565+ echo " Usage: just publish-rtd v24.1.1"
566+ exit 1
567+ fi
568+ echo " ==> Triggering Read the Docs build for ${TAG}..."
569+ echo " "
570+ echo " Note: Read the Docs builds are typically triggered automatically"
571+ echo " when tags are pushed to GitHub. This recipe is a placeholder"
572+ echo " for manual triggering if needed."
573+ echo " "
574+ echo " To manually trigger a build:"
575+ echo " 1. Go to https://readthedocs.org/projects/cfxdb/"
576+ echo " 2. Click 'Build a version'"
577+ echo " 3. Select the tag: ${TAG}"
578+ echo " "
0 commit comments