1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171
|
# Default recipe - show available recipes
default:
just --list
# Create virtual environment with uv
venv:
uv venv --python 3.13
uv pip install pip # Install pip for backward compatibility
# Install the package in development mode
install: venv clear-cache
uv pip install -e .
# Install from local source distribution (for testing)
install-local: package clear-cache
uv pip install dist/wrapt-*.tar.gz
# Install from local source distribution with verbose output
install-local-verbose: package clear-cache
uv pip install -v dist/wrapt-*.tar.gz
# Create source distribution package
package: venv
uv run python setup.py sdist
# Clear pip cache for wrapt to avoid conflicts with local development
clear-cache:
uv cache clean wrapt || true
# Release: clean, package, and upload to PyPI
release:
echo "ERROR: Direct releases are no longer supported from this Justfile."
echo "Release packages are built by GitHub Actions."
echo "Push a tag to trigger the build workflow."
exit 1
# Release to Test PyPI
release-test: clean package
uv publish --index-url https://test.pypi.org/simple/ dist/*
# Remove temporary files and build artifacts
mostlyclean: clear-cache
rm -rf .coverage.*
rm -rf .pytest_cache
rm -rf .tox .venv
rm -rf .mypy_cache
rm -rf __pycache__
rm -rf tests/__pycache__
rm -rf tests/core/__pycache__
rm -rf src/wrapt/__pycache__
rm -rf src/wrapt/_wrappers.*.so
rm -rf docs/__pycache__
rm -rf docs/_build
# Clean build artifacts and virtual environment
clean: mostlyclean
rm -rf build dist src/wrapt.egg-info
# Run tests with tox
test-tox:
tox --skip-missing-interpreters
# Run tests with uv (modern alternative)
test:
just test-version 3.9
just test-version 3.10
just test-version 3.11
just test-version 3.12
just test-version 3.13
just test-version 3.14
# Run mypy type checking for all supported Python versions
test-mypy:
just test-mypy-version 3.9
just test-mypy-version 3.10
just test-mypy-version 3.11
just test-mypy-version 3.12
just test-mypy-version 3.13
just test-mypy-version 3.14
# Run tests with uv for a specific Python version
test-version version:
#!/usr/bin/env bash
set -euo pipefail
rm -rf .mypy_cache
rm -rf .pytest_cache
rm -rf src/wrapt/__pycache__
rm -rf src/wrapt/_wrappers.*.so
rm -rf .venv-test-tmp
uv venv .venv-test-tmp --python {{version}}
source .venv-test-tmp/bin/activate
python -m ensurepip --upgrade
python -m pip install --upgrade pip
pip3 install pytest
# export PYTHONPATH=src
echo "=== Testing Python {{version}} - without C extensions ==="
export WRAPT_INSTALL_EXTENSIONS=false
pip3 install -e . --no-cache
python -c "import wrapt.__wrapt__; assert not wrapt.__wrapt__._using_c_extension, 'wrongly using C extension'"
pytest
pip3 uninstall wrapt -y
echo "=== Testing Python {{version}} - with C extensions ==="
export WRAPT_INSTALL_EXTENSIONS=true
pip3 install -e . --no-cache
python -c "import wrapt.__wrapt__; assert wrapt.__wrapt__._using_c_extension, 'C extension not loaded'"
pytest
echo "=== Testing Python {{version}} - with C extensions disabled at runtime ==="
export WRAPT_DISABLE_EXTENSIONS=true
python -c "import wrapt.__wrapt__; assert not wrapt.__wrapt__._using_c_extension, 'wrongly using C extension'"
pytest
deactivate
rm -rf .venv-test-tmp
echo "All test variants completed for Python {{version}}"
# Run mypy type checking for a specific Python version
test-mypy-version version:
echo "=== Running mypy type checking with Python {{version}} ==="
mypy --python-version {{version}} src/wrapt
view-mypy-test test:
MYPYPATH=src/ uv run mypy --strict --show-error-codes tests/mypy/{{test}}.py
save-mypy-test test:
- MYPYPATH=src/ uv run mypy --strict --show-error-codes tests/mypy/{{test}}.py > tests/mypy/{{test}}.out
verify-mypy-test test:
- MYPYPATH=src/ uv run mypy --strict --show-error-codes tests/mypy/{{test}}.py | diff -c - tests/mypy/{{test}}.out
# Install development dependencies with uv
dev-install: venv
uv sync
# Run tests using pip-installed pytest (backward compatibility check)
test-pip: venv
source .venv/bin/activate && pip install pytest && pip install -e . && pytest
# Check if virtual environment exists
venv-check:
if [ ! -d ".venv" ]; then echo "Virtual environment not found. Run 'just venv' first."; exit 1; fi
# Activate virtual environment (for interactive use)
shell: venv
echo "Activating virtual environment..."
echo "Run: source .venv/bin/activate"
# Show virtual environment info
venv-info: venv-check
source .venv/bin/activate && python --version && pip --version
|