-
Notifications
You must be signed in to change notification settings - Fork 14
build: migrate to uv + pyproject.toml (PEP 621/735) + python-semantic-release #253
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
Open
farhan
wants to merge
7
commits into
openedx:main
Choose a base branch
from
farhan:farhan/modernize-python-repo-2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c4c4cbd
build: migrate to uv, pyproject.toml (PEP 621/735), and python-semant…
farhan 5ba8c89
fix: exclude test modules from wheel
farhan d37ccdc
fix: remove uv run prefix from Makefile targets
farhan 031c0e8
fix: use source_pkgs for coverage with src/ layout
farhan 136e3b8
fix: switch readthedocs install to uv sync with doc group
farhan b7ae121
fix: use source = ["src"] for coverage in src/ layout
farhan 008e1b6
build: enforce --locked in CI uv sync and uv run tox
farhan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| name: Release | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
|
|
||
| jobs: | ||
| run_ci: | ||
| uses: ./.github/workflows/ci.yml | ||
|
|
||
| release: | ||
| needs: run_ci | ||
| runs-on: ubuntu-latest | ||
| if: github.ref_name == 'main' | ||
| concurrency: | ||
| group: ${{ github.workflow }}-release-${{ github.ref_name }} | ||
| cancel-in-progress: false | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| ref: ${{ github.ref_name }} | ||
|
|
||
| - name: Force branch to workflow sha | ||
| run: git reset --hard ${{ github.sha }} | ||
|
|
||
| - name: Run Semantic Release | ||
| id: release | ||
| uses: python-semantic-release/python-semantic-release@b700dbeb1f431a0fcc30a79f3f0869407fe07278 # v10.7.0 | ||
| with: | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| git_committer_name: "github-actions" | ||
| git_committer_email: "actions@users.noreply.github.com" | ||
| # Commit, tag, push and build, but don't create the GitHub release. | ||
| # We create it ourselves in the next step so that the distributions | ||
| # are attached before the release is published. See that step for why. | ||
| vcs_release: "false" | ||
| # Release notes live only on the GitHub Release page; no changelog file. | ||
| changelog: "false" | ||
|
|
||
| # The openedx org has immutable releases enabled, which freezes a release's | ||
| # assets the moment it is published, so assets cannot be attached | ||
| # afterwards. `gh release create` handles this by creating the release as a | ||
| # draft, uploading the assets, and only then publishing it: | ||
| # https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/immutable-releases | ||
| - name: Create GitHub Release with Assets | ||
| if: steps.release.outputs.released == 'true' | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| # Reuse the release notes python-semantic-release generated for us. | ||
| RELEASE_NOTES: ${{ steps.release.outputs.release_notes }} | ||
| TAG: ${{ steps.release.outputs.tag }} | ||
| run: | | ||
| # Write the release notes to a file so arbitrary content (backticks, | ||
| # $(...), quotes) passes through unexpanded. | ||
| printf '%s' "$RELEASE_NOTES" > "$RUNNER_TEMP/release_notes.md" | ||
| # Create the release as a draft, attach the dists, then publish. | ||
| gh release create "$TAG" \ | ||
| --verify-tag \ | ||
| --title "$TAG" \ | ||
| --notes-file "$RUNNER_TEMP/release_notes.md" \ | ||
| dist/* | ||
|
|
||
| - name: Upload distribution artifacts | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | ||
| if: steps.release.outputs.released == 'true' | ||
| with: | ||
| name: distribution-artifacts | ||
| path: dist | ||
| if-no-files-found: error | ||
|
|
||
| outputs: | ||
| released: ${{ steps.release.outputs.released || 'false' }} | ||
| version: ${{ steps.release.outputs.version }} | ||
|
|
||
| publish_to_pypi: | ||
| runs-on: ubuntu-latest | ||
| needs: release | ||
| if: github.ref_name == 'main' && needs.release.outputs.released == 'true' | ||
|
|
||
| permissions: | ||
| contents: read | ||
| id-token: write # Required for OIDC trusted publishing | ||
|
|
||
| steps: | ||
| - name: Download build artifacts | ||
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | ||
| with: | ||
| name: distribution-artifacts | ||
| path: dist | ||
|
|
||
| - name: Publish to PyPI | ||
| uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2 |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,10 @@ | ||
| include LICENSE.txt | ||
| include README.rst | ||
| include requirements/base.in | ||
| include requirements/constraints.txt | ||
| recursive-include platform_plugin_aspects *.html *.png *.gif *.js *.css *.jpg *.jpeg *.svg | ||
| # Exclude development, test, and documentation folders | ||
| prune .github | ||
| prune docs | ||
| prune tests | ||
|
|
||
| # Exclude root level configuration and build files | ||
| exclude Makefile | ||
| exclude conftest.py | ||
| exclude .gitignore | ||
| exclude tox.ini |
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch, fixed