-
Notifications
You must be signed in to change notification settings - Fork 15
Modernize python tooling #136
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
salman2013
wants to merge
6
commits into
openedx:master
Choose a base branch
from
salman2013:modernize-python-tooling
base: master
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
6 commits
Select commit
Hold shift + click to select a range
2ee711a
chore: migrate package metadata to pyproject.toml (PEP 621)
salman2013 ab1d810
chore: switch dependency management from pip-tools to uv
salman2013 37f68ed
chore: add python-semantic-release and commitlint workflows
salman2013 50bb672
fix: exclude .venv from pycodestyle check
salman2013 bbe32a0
fix: rename workflow to Semantic Release in release.yml
salman2013 b4b18bd
chore: switch PyPI publishing to OIDC trusted publisher
salman2013 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 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,32 +1,30 @@ | ||
| name: Python CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
| pull_request: | ||
| branches: | ||
| - '**' | ||
| workflow_call: | ||
|
|
||
| jobs: | ||
| run_tests: | ||
| name: Tests | ||
| runs-on: ${{ matrix.os }} | ||
| name: quality | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| os: | ||
| - ubuntu-latest | ||
| python-version: ['3.12'] | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| - name: setup python | ||
| uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | ||
| - name: Setup uv | ||
| uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| architecture: x64 | ||
| enable-cache: true | ||
| python-version: "${{ matrix.python-version }}" | ||
|
|
||
| - name: Install dependencies | ||
| run: pip install -r requirements/ci.txt | ||
| - name: Install quality dependencies | ||
| run: uv sync --group quality | ||
|
|
||
| - name: Run Tests | ||
| run: pycodestyle . --max-line-length=419 # TODO 419 --> 120 | ||
| - name: Run quality checks | ||
| run: uv run pycodestyle . --max-line-length=419 --exclude=.venv |
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,67 @@ | ||
| name: Semantic Release | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
|
|
||
| jobs: | ||
| run_tests: | ||
| uses: ./.github/workflows/ci.yml | ||
| secrets: inherit | ||
| permissions: | ||
| contents: read | ||
|
|
||
| release: | ||
| name: Release | ||
| needs: run_tests | ||
| if: github.ref_name == 'master' | ||
| runs-on: ubuntu-latest | ||
| concurrency: | ||
| group: ${{ github.workflow }}-release | ||
| cancel-in-progress: false | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| ref: ${{ github.ref_name }} | ||
|
|
||
| - run: git reset --hard ${{ github.sha }} | ||
|
|
||
| - name: Python Semantic Release | ||
| id: release | ||
| uses: python-semantic-release/python-semantic-release@350c48fcb3ffcdfd2e0a235206bc2ecea6b69df0 # v10.5.3 | ||
| with: | ||
| git_committer_name: "github-actions[bot]" | ||
| git_committer_email: "github-actions[bot]@users.noreply.github.com" | ||
| changelog: "false" | ||
|
|
||
| - name: Upload dist artifacts | ||
| if: steps.release.outputs.released == 'true' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: dist | ||
| path: dist/ | ||
|
|
||
| outputs: | ||
| released: ${{ steps.release.outputs.released }} | ||
| version: ${{ steps.release.outputs.version }} | ||
|
|
||
| publish_to_pypi: | ||
| name: Publish to PyPI | ||
| needs: release | ||
| if: needs.release.outputs.released == 'true' | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
| steps: | ||
| - name: Download dist artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: dist | ||
| path: dist/ | ||
|
|
||
| - name: Publish to PyPI | ||
| uses: pypa/gh-action-pypi-publish@release/v1 | ||
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 |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| [build-system] | ||
| requires = ["setuptools>=64", "setuptools-scm>=8.0"] | ||
| build-backend = "setuptools.build_meta" | ||
|
|
||
| [project] | ||
| name = "recommender-xblock" | ||
| dynamic = ["version"] | ||
| description = "recommender XBlock" | ||
| readme = "README.rst" | ||
| license = "AGPL-3.0" | ||
| license-files = ["LICENSE"] | ||
| authors = [ | ||
| {name = "edX", email = "oscm@edx.org"}, | ||
| ] | ||
| requires-python = ">=3.12" | ||
| classifiers = [ | ||
| "Development Status :: 4 - Beta", | ||
| "Intended Audience :: Developers", | ||
| "Natural Language :: English", | ||
| "Programming Language :: Python :: 3", | ||
| "Programming Language :: Python :: 3.12", | ||
| "Framework :: Django", | ||
| "Framework :: Django :: 4.2", | ||
| "Framework :: Django :: 5.2", | ||
| ] | ||
| dependencies = [ | ||
| "bleach", | ||
| "edx-i18n-tools", | ||
| "fs", | ||
| "simplejson", | ||
| "web-fragments", | ||
| "webob", | ||
| ] | ||
|
|
||
| [project.urls] | ||
| Homepage = "https://github.com/openedx/RecommenderXBlock" | ||
|
|
||
| [project.entry-points."xblock.v1"] | ||
| recommender = "recommender.recommender:RecommenderXBlock" | ||
|
|
||
| [tool.setuptools_scm] | ||
| version_scheme = "only-version" | ||
| local_scheme = "no-local-version" | ||
|
|
||
| [tool.setuptools.packages.find] | ||
| where = ["."] | ||
|
|
||
| [tool.setuptools.package-data] | ||
| recommender = [ | ||
| "static/**/*", | ||
| "templates/**/*", | ||
| "translations/**/*", | ||
| "public/**/*", | ||
| ] | ||
|
|
||
| [tool.setuptools.exclude-package-data] | ||
| "*" = ["tests*", "*.tests*", "spec*", "*.spec*"] | ||
|
|
||
| [tool.coverage.run] | ||
| branch = true | ||
| source = ["recommender"] | ||
| omit = [ | ||
| "*/tests/*", | ||
| "*/migrations/*", | ||
| "*/__pycache__/*", | ||
| "*/settings.py", | ||
| ] | ||
|
|
||
| [tool.coverage.report] | ||
| show_missing = true | ||
| exclude_lines = [ | ||
| "pragma: no cover", | ||
| "def __repr__", | ||
| "raise AssertionError", | ||
| "raise NotImplementedError", | ||
| "if __name__ == .__main__.:", | ||
| "if TYPE_CHECKING:", | ||
| ] | ||
|
|
||
| [tool.coverage.html] | ||
| directory = "htmlcov" | ||
|
|
||
| [dependency-groups] | ||
| quality = [ | ||
| "pycodestyle", | ||
| ] | ||
|
|
||
| [tool.edx_lint] | ||
| uv_constraints = [] | ||
|
|
||
| [tool.semantic_release] | ||
| build_command = "python -m pip install --upgrade build && SETUPTOOLS_SCM_PRETEND_VERSION=$NEW_VERSION python -m build" | ||
| allow_zero_version = true | ||
| major_on_zero = false | ||
|
|
||
| [tool.uv] | ||
| package = true |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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.
Suggested by GPT 5.6-Sol