Skip to content

Commit

Permalink
improve
Browse files Browse the repository at this point in the history
  • Loading branch information
zrr1999 committed Nov 21, 2023
1 parent 56dcc30 commit 59449a9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 18 deletions.
10 changes: 2 additions & 8 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ jobs:
- name: Build package
run: |
pdm build -v
- name: Upload base wheel
uses: actions/upload-artifact@v3
with:
name: base
path: dist
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
Expand All @@ -43,7 +38,6 @@ jobs:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
runs-on: ubuntu-latest
needs: base-build
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -64,7 +58,7 @@ jobs:
path: base-dist
- name: Build package
run: |
pip3.12 install base-dist/*.whl
pip3.12 install .
python3.12 -m pyfuture transfer-dir . . --target ${{ matrix.python-version }}
PDM_BUILD_SCM_VERSION=$RELEASE_VERSION pdm build -v --no-sdist
- name: "Upload wheels"
Expand All @@ -76,7 +70,7 @@ jobs:
publish-release:
name: Upload to PyPI
runs-on: ubuntu-latest
needs: build
needs: [build, base-build]
permissions:
id-token: write
steps:
Expand Down
15 changes: 6 additions & 9 deletions pdm_build.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
from pdm.backend.base import Context
from pdm.backend.wheel import WheelBuilder
from pathlib import Path
from typing import Any
import sys


def pdm_build_hook_enabled(context: Context):
return context.target == "wheel"

def pdm_build_finalize(context: Context, artifact: Path) -> None:
if isinstance(context.builder, WheelBuilder):
name_version = context.builder.name_version
tag = context.builder.tag.replace("py3", f"py{sys.version_info.major}{sys.version_info.minor}")
artifact.rename(artifact.parent/f"{name_version}-{tag}.whl")

def pdm_build_initialize(context: Context) -> None:
config_settings = context.builder.config_settings
config_settings[
"--python-tag"
] = f"py{sys.version_info.major}{sys.version_info.minor}"
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies = [
"libcst>=1.1.0",
"typer>=0.9.0",
"loguru>=0.7.2",

"watchfiles>=0.21.0",
]
requires-python = ">=3.8"
Expand All @@ -33,6 +33,7 @@ write_template = "__version__ = '{}'"

[tool.pdm.build]
includes = ["pyfuture"]
is-purelib = true

[build-system]
requires = ["pdm-backend"]
Expand Down

0 comments on commit 59449a9

Please sign in to comment.