Skip to content

Commit

Permalink
Merge pull request #5 from GabDug/fix/support-pdm-2-10-0
Browse files Browse the repository at this point in the history
fix: support PDM 2.10.0
  • Loading branch information
GabDug authored Nov 1, 2023
2 parents 6813314 + cf66915 commit 3fe8721
Show file tree
Hide file tree
Showing 7 changed files with 602 additions and 554 deletions.
27 changes: 22 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,19 @@ jobs:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12']
pdm-version: ["", "head", "2.7.4"]
pdm-version: ["", "head", "2.7.4", "2.8.2", "2.9.3", "2.10.0"]
os: [ubuntu-latest]
# We don't run the full matrix on macOS and Windows
# Runners are more expensive on these platforms
include:
- os: macOS-latest
python-version: '3.11'
pdm-version: ""
- os: windows-latest
exclude:
# Random CI errors - not worth it
- os: ubuntu-latest
python-version: '3.11'
pdm-version: ""
pdm-version: "3.7.4"

steps:
- uses: actions/checkout@v4
Expand All @@ -51,8 +53,23 @@ jobs:
${{ steps.set_variables.outputs.PDM_CACHE }}
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ matrix.pdm-version }}


- name: Install dependencies
run: pdm install
run: |
pdm config venv.with_pip True
pdm install -G :all --dev
pdm venv activate in-project
source .venv/bin/activate
# Get the pip command to run depending on matrix.pdm-version
# We force reinstall of pdm in the virtualenv
if [[ "${{ matrix.pdm-version }}" == "head" ]]; then
pip install "pdm @ git+https://github.com/pdm-project/pdm"
elif [[ "${{ matrix.pdm-version }}" == "" ]]; then
pip install pdm
else
pip install pdm==${{ matrix.pdm-version }}
fi
- name: Run Tests
run: pdm run test-cov
- name: Upload coverage to Codecov
Expand All @@ -66,7 +83,7 @@ jobs:
pdm run lint-mypy
- name: Lint with ruff
run: |
pdm run lint-ruff --format=github --exit-non-zero-on-fix
pdm run lint-ruff --output-format=github --exit-non-zero-on-fix
- name: Build with pdm
run: |
pdm build
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ jobs:
- uses: pdm-project/setup-pdm@v3
- name: Publish package distributions to PyPI
run: pdm publish
- name: Upload Workflow Artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: ./dist/*
- name: Publish package distributions to GitHub Releases
uses: actions/upload-release-asset@v1
with:
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ repos:
- id: fix-byte-order-marker

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.9.1
rev: 23.10.1
hooks:
- id: black

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.292
rev: v0.1.3
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
python 3.11.6
pdm 2.9.3
pdm 2.10.0
1,107 changes: 563 additions & 544 deletions pdm.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ include = ["src/*"]
omit = ["*/tests/*"]

[tool.coverage.report]
fail_under = 92.0
fail_under = 88.0

exclude_lines = [
"def __repr__",
Expand Down
9 changes: 8 additions & 1 deletion src/pdm_wheel/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def handle(self, project: Project, options: argparse.Namespace) -> None:
project.core.ui.echo("Checking lockfile...", err=False)
check_lockfile(project, raise_not_exist=True)

if not project.lockfile.static_urls:
if not self._has_static_urls(project):
project.core.ui.echo(
"The lockfile does not contain static file URLs. Exporting wheel may be longer than expected, and make calls to indexes.",
style="warning",
Expand Down Expand Up @@ -168,3 +168,10 @@ def _get_candidates(self, project: Project, options: Namespace) -> dict[str, Can

# Remove candidates with [extras] because the bare candidates are already included
return {name: candidate for name, candidate in candidates.items() if not candidate.req.extras}

def _has_static_urls(self, project: Project) -> bool:
if hasattr(project.lockfile, "static_urls"):
return bool(project.lockfile.static_urls)
if hasattr(project.lockfile, "strategy"):
return "static_urls" in project.lockfile.strategy
return True

0 comments on commit 3fe8721

Please sign in to comment.