- Notifications
You must be signed in to change notification settings - Fork 0
Add PyPiLibrary Python sibling project#64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
37b10b452433525155075410f174aa0a1e703347292e9dbb44c939f643d2bbf6b95dd46dbe5bae2626a207a101a692f27eb0cfcb1ba24ee0dd7073da1092d26067aa3a1b4d4b6ee7ccbb77a936176bb4d89c7f0a22db3bce76aab0ab57f01File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,23 +1,33 @@ | ||
| # https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file | ||
| version: 2 | ||
| updates: | ||
| # main | ||
| - package-ecosystem: "nuget" | ||
| target-branch: "main" | ||
| directory: "/" | ||
| schedule: | ||
| interval: "daily" | ||
| groups: | ||
| nuget-deps: | ||
| patterns: | ||
| - "*" | ||
| - package-ecosystem: "github-actions" | ||
| target-branch: "main" | ||
| directory: "/" | ||
| schedule: | ||
| interval: "daily" | ||
| groups: | ||
| actions-deps: | ||
| patterns: | ||
| - "*" | ||
| # https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file | ||
| version: 2 | ||
| updates: | ||
| - package-ecosystem: "nuget" | ||
| target-branch: "main" | ||
| directory: "/" | ||
| schedule: | ||
| interval: "daily" | ||
| groups: | ||
| nuget-deps: | ||
| patterns: | ||
| - "*" | ||
| - package-ecosystem: "github-actions" | ||
| target-branch: "main" | ||
| directory: "/" | ||
| schedule: | ||
| interval: "daily" | ||
| groups: | ||
| actions-deps: | ||
| patterns: | ||
| - "*" | ||
| - package-ecosystem: "uv" | ||
| target-branch: "main" | ||
| directory: "/PyPiLibrary" | ||
| schedule: | ||
| interval: "daily" | ||
| groups: | ||
| pypi-deps: | ||
| patterns: | ||
| - "*" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| name: Build PyPI library task | ||
| # This reusable workflow only builds the PyPI library and uploads the | ||
| # wheel + sdist as a workflow-run artifact. It does NOT publish to PyPI. | ||
| # Publishing happens directly in `publish-release.yml` so that the | ||
| # `id-token: write` permission required by Trusted Publishing is granted | ||
| # at the entry-point job, not propagated through a reusable-workflow | ||
| # chain (which would require every caller — including `test-release-task.yml` | ||
| # during PR validation — to also grant id-token write, even when no | ||
| # publishing happens). | ||
| on: | ||
| workflow_call: | ||
| outputs: | ||
| artifact-name: | ||
| value: ${{ jobs.build-pypilibrary.outputs.artifact-name }} | ||
| artifact-id: | ||
| value: ${{ jobs.build-pypilibrary.outputs.artifact-id }} | ||
| jobs: | ||
| build-pypilibrary: | ||
| name: Build PyPI library project job | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: ./PyPiLibrary | ||
| outputs: | ||
| artifact-name: pypilibrary-build | ||
| artifact-id: ${{ steps.artifact-upload-step.outputs.artifact-id }} | ||
| steps: | ||
| - name: Checkout code step | ||
| uses: actions/checkout@v6 | ||
| - name: Setup uv step | ||
| uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 | ||
| with: | ||
| # Pin uv to the same version as `.devcontainer/post-create.sh` | ||
| # (UV_VERSION) so CI and local devcontainer behavior cannot drift | ||
| # — same uv resolves the same lockfile the same way. Bump in lock- | ||
| # step with the devcontainer pin. | ||
| version: "0.11.8" | ||
| enable-cache: true | ||
| cache-dependency-glob: "PyPiLibrary/uv.lock" | ||
| - name: Sync dependencies step | ||
| run: uv sync --all-groups --frozen | ||
| - name: Lint with ruff step | ||
| run: uv run ruff check | ||
| - name: Verify formatting with ruff step | ||
| run: uv run ruff format --check | ||
| - name: Type check with pyright step | ||
| run: uv run pyright | ||
| - name: Run pytest step | ||
| run: uv run pytest | ||
| - name: Build sdist and wheel step | ||
| run: uv build | ||
| - name: Upload build artifacts step | ||
| id: artifact-upload-step | ||
| uses: actions/upload-artifact@v6 | ||
| with: | ||
| name: pypilibrary-build | ||
| path: PyPiLibrary/dist/* | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -23,6 +23,47 @@ jobs: | ||
| nuget: true | ||
| dockerhub: true | ||
| publish-pypi: | ||
| name: Publish PyPI library job | ||
| needs: [create-release] | ||
| runs-on: ubuntu-latest | ||
| environment: | ||
| name: pypi | ||
| url: https://pypi.org/project/ptr727-projecttemplate-library/ | ||
| # When a `permissions:` block is present, every scope not listed | ||
| # collapses to `none`. The job needs three things explicitly: | ||
| # - `id-token: write` for Trusted Publishing's OIDC exchange | ||
| # (pypa/gh-action-pypi-publish swaps the token for a short-lived | ||
| # PyPI upload token; no PYPI_API_TOKEN secret involved). | ||
| # - `contents: read` so `actions/checkout`-style operations and any | ||
| # repo metadata reads continue to work. | ||
| # - `actions: read` so `actions/download-artifact` can list and | ||
| # fetch the artifact uploaded by the build workflow earlier in | ||
| # the same run. | ||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
| actions: read | ||
| steps: | ||
| - name: Download PyPI library build artifacts step | ||
| uses: actions/download-artifact@v7 | ||
| with: | ||
| name: pypilibrary-build | ||
| path: ./dist | ||
ptr727 marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| - name: Publish to PyPI step | ||
| uses: pypa/gh-action-pypi-publish@6733eb7d741f0b11ec6a39b58540dab7590f9b7d # v1.14.0 | ||
| with: | ||
| packages-dir: ./dist | ||
ptr727 marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| # Skip rather than fail when the version already exists on PyPI. | ||
| # The template ships with `__version__ = "0.0.0"` as a placeholder | ||
| # — the release-on-every-push model would otherwise re-upload the | ||
| # same version and fail the workflow until the adopter wires a | ||
| # real version scheme (see PyPiLibrary/README.md). | ||
| skip-existing: true | ||
| date-badge: | ||
| name: Create BYOB date badge job | ||
| needs: [create-release] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -8,3 +8,13 @@ | ||
| .artifacts | ||
| .DS_Store | ||
| *.user | ||
| # Python / uv | ||
| __pycache__/ | ||
| *.py[cod] | ||
| *.egg-info/ | ||
| .venv/ | ||
| dist/ | ||
| .pytest_cache/ | ||
| .ruff_cache/ | ||
| .pyright/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -27,6 +27,32 @@ | ||
| "include": [ | ||
| "**/*.cs" | ||
| ] | ||
| }, | ||
| { | ||
| "name": "Ruff Format", | ||
| "command": "bash", | ||
| "args": [ | ||
| "-c", | ||
| "command -v uv >/dev/null 2>&1 || { echo 'uv not on PATH; skipping ruff format' >&2; exit 0; }; exec uv run --project PyPiLibrary ruff format \"$@\"", | ||
| "--", | ||
| "${staged}" | ||
| ], | ||
ptr727 marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| "include": [ | ||
| "PyPiLibrary/**/*.py" | ||
| ] | ||
ptr727 marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| }, | ||
| { | ||
| "name": "Ruff Check", | ||
| "command": "bash", | ||
| "args": [ | ||
| "-c", | ||
| "command -v uv >/dev/null 2>&1 || { echo 'uv not on PATH; skipping ruff check' >&2; exit 0; }; exec uv run --project PyPiLibrary ruff check \"$@\"", | ||
| "--", | ||
| "${staged}" | ||
| ], | ||
ptr727 marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| "include": [ | ||
| "PyPiLibrary/**/*.py" | ||
| ] | ||
ptr727 marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| } | ||
| ] | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.