Add --dry-run flag to run and sync commands (#15) #46
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| version: "latest" | |
| - name: Set up Python ${{ matrix.python-version }} | |
| run: uv python install ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: uv sync --all-extras --python ${{ matrix.python-version }} | |
| - name: Run linting | |
| run: | | |
| uv run ruff check src tests | |
| uv run ruff format --check src tests | |
| - name: Run unit tests | |
| run: uv run pytest tests/test_rename.py tests/test_download.py tests/test_run.py tests/test_patch.py tests/test_config.py tests/test_server.py -v | |
| - name: Run integration tests | |
| run: uv run pytest tests/test_integration.py -v | |
| integration-icechunk: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| version: "latest" | |
| - name: Set up Python 3.12 | |
| run: uv python install 3.12 | |
| - name: Install third-wheel | |
| run: uv sync --all-extras --python 3.12 | |
| - name: Download icechunk wheel from nightly | |
| run: | | |
| mkdir -p wheels | |
| pip download icechunk \ | |
| --index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple \ | |
| --no-deps \ | |
| -d ./wheels/ || echo "Download failed, skipping integration test" | |
| - name: Inspect and rename wheel | |
| run: | | |
| if ls wheels/icechunk-*.whl 1> /dev/null 2>&1; then | |
| uv run third-wheel inspect wheels/icechunk-*.whl | |
| uv run third-wheel rename wheels/icechunk-*.whl icechunk_v1 -o ./wheels/ | |
| ls -la wheels/ | |
| else | |
| echo "No wheel found, skipping" | |
| fi | |
| - name: Install renamed wheel and verify imports | |
| run: | | |
| if ls wheels/icechunk_v1-*.whl 1> /dev/null 2>&1; then | |
| # Create a test venv | |
| uv venv test-venv --python 3.12 | |
| uv pip install --python test-venv/bin/python wheels/icechunk_v1-*.whl | |
| # Verify the import works | |
| test-venv/bin/python -c " | |
| import icechunk_v1 | |
| print(f'Successfully imported icechunk_v1 version: {icechunk_v1.__version__}') | |
| # Verify key classes are accessible | |
| from icechunk_v1 import Repository, IcechunkStore, Session | |
| print('All key classes imported successfully') | |
| " | |
| else | |
| echo "No renamed wheel found, skipping verification" | |
| fi | |
| run-command: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| name: Test third-wheel run | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| version: "latest" | |
| - name: Set up Python 3.12 | |
| run: uv python install 3.12 | |
| - name: Install third-wheel | |
| run: uv sync --all-extras --python 3.12 | |
| - name: Test run with CLI rename (urllib3 v1 + v2) | |
| run: | | |
| uv run third-wheel run examples/cli_rename.py \ | |
| --rename "urllib3<2=urllib3_v1" -v | |
| - name: Test run with inline script annotations | |
| run: | | |
| cat > /tmp/test_inline_rename.py << 'SCRIPT' | |
| # /// script | |
| # requires-python = ">=3.12" | |
| # dependencies = [ | |
| # "urllib3_v1", # urllib3<2 | |
| # "urllib3>=2", | |
| # ] | |
| # /// | |
| import urllib3 | |
| import urllib3_v1 | |
| print(f"urllib3 v2: {urllib3.__version__}") | |
| print(f"urllib3 v1: {urllib3_v1.__version__}") | |
| v2_major = int(urllib3.__version__.split(".")[0]) | |
| v1_major = int(urllib3_v1.__version__.split(".")[0]) | |
| assert v2_major >= 2, f"Expected urllib3 >= 2.x, got {urllib3.__version__}" | |
| assert v1_major < 2, f"Expected urllib3_v1 < 2.x, got {urllib3_v1.__version__}" | |
| print("SUCCESS: Both versions installed via inline annotations!") | |
| SCRIPT | |
| uv run third-wheel run /tmp/test_inline_rename.py -v | |
| - name: Test run with structured tool.third-wheel metadata | |
| run: | | |
| cat > /tmp/test_structured_rename.py << 'SCRIPT' | |
| # /// script | |
| # requires-python = ">=3.12" | |
| # dependencies = [ | |
| # "urllib3_v1", | |
| # "urllib3>=2", | |
| # ] | |
| # [tool.third-wheel] | |
| # renames = [ | |
| # {original = "urllib3", new-name = "urllib3_v1", version = "<2"}, | |
| # ] | |
| # /// | |
| import urllib3 | |
| import urllib3_v1 | |
| print(f"urllib3 v2: {urllib3.__version__}") | |
| print(f"urllib3 v1: {urllib3_v1.__version__}") | |
| v2_major = int(urllib3.__version__.split(".")[0]) | |
| v1_major = int(urllib3_v1.__version__.split(".")[0]) | |
| assert v2_major >= 2, f"Expected urllib3 >= 2.x, got {urllib3.__version__}" | |
| assert v1_major < 2, f"Expected urllib3_v1 < 2.x, got {urllib3_v1.__version__}" | |
| print("SUCCESS: Both versions installed via [tool.third-wheel]!") | |
| SCRIPT | |
| uv run third-wheel run /tmp/test_structured_rename.py -v | |
| - name: Test run without renames delegates to uv | |
| run: | | |
| cat > /tmp/test_no_rename.py << 'SCRIPT' | |
| # /// script | |
| # requires-python = ">=3.12" | |
| # dependencies = [ | |
| # "urllib3>=2", | |
| # ] | |
| # /// | |
| import urllib3 | |
| print(f"urllib3: {urllib3.__version__}") | |
| print("SUCCESS: Plain script works without renames!") | |
| SCRIPT | |
| uv run third-wheel run /tmp/test_no_rename.py | |
| proxy-dual-install: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| name: Test proxy with dual icechunk install | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| version: "latest" | |
| - name: Set up Python 3.12 | |
| run: uv python install 3.12 | |
| - name: Install third-wheel with server extras | |
| run: uv sync --all-extras --python 3.12 | |
| - name: Start proxy server | |
| run: | | |
| # Start proxy in background with icechunk v1 (<2) renamed | |
| uv run third-wheel serve \ | |
| -u https://pypi.anaconda.org/scientific-python-nightly-wheels/simple \ | |
| -r "icechunk=icechunk_v1:<2" \ | |
| --port 8123 & | |
| # Wait for server to start | |
| sleep 5 | |
| # Verify server is running | |
| curl -s http://127.0.0.1:8123/simple/ | grep icechunk_v1 | |
| - name: Run uv sync to install both versions | |
| run: | | |
| cd tests/fixtures/dual-install | |
| # Use uv sync to install both packages with all their dependencies | |
| uv sync --python 3.12 | |
| # Show what was installed | |
| echo "Installed icechunk packages:" | |
| uv pip list | grep -i icechunk | |
| - name: Verify both versions are installed and isolated | |
| run: | | |
| cd tests/fixtures/dual-install | |
| uv run python -c " | |
| import sys | |
| # Import both versions | |
| import icechunk_v1 | |
| import icechunk | |
| print(f'icechunk_v1 version: {icechunk_v1.__version__}') | |
| print(f'icechunk version: {icechunk.__version__}') | |
| # Verify they are different versions | |
| v1_version = icechunk_v1.__version__ | |
| v2_version = icechunk.__version__ | |
| print(f'v1 module path: {icechunk_v1.__file__}') | |
| print(f'v2 module path: {icechunk.__file__}') | |
| # v1 should be < 2.0, v2 should be >= 2.0 | |
| assert 'icechunk_v1' in icechunk_v1.__file__, 'v1 module path should contain icechunk_v1' | |
| assert 'icechunk_v1' not in icechunk.__file__, 'v2 module path should not contain icechunk_v1' | |
| # Verify they are different modules (isolation check) | |
| assert icechunk_v1 is not icechunk, 'Modules should be different objects' | |
| print('SUCCESS: Both versions installed and isolated correctly!') | |
| " |