-
Notifications
You must be signed in to change notification settings - Fork 33
Modernize Python tooling (uv, pyproject.toml, src layout, semantic release) #563
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
base: master
Are you sure you want to change the base?
Changes from all commits
269e9f5
e698ff7
19174c3
f056a2d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| name: Semantic Release | ||
|
|
||
| on: | ||
| push: | ||
| branches: [master] | ||
|
|
||
| jobs: | ||
| run_tests: | ||
| uses: ./.github/workflows/ci.yml | ||
| secrets: inherit | ||
|
|
||
| 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@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
| with: | ||
| fetch-depth: 0 | ||
| 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" | ||
| git_committer_email: "github-actions@github.com" | ||
| changelog: "false" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| - name: Upload dist | ||
| if: steps.release.outputs.released == 'true' | ||
| uses: actions/upload-artifact@601987b96cf95d5f9a5fe5e0ec0e34c5583d7fc6 # v4.4.3 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a fabricated commit SHA -- |
||
| with: | ||
| name: dist | ||
| path: dist/ | ||
| outputs: | ||
| released: ${{ steps.release.outputs.released }} | ||
| version: ${{ steps.release.outputs.version }} | ||
|
|
||
| publish_to_pypi: | ||
| needs: release | ||
| if: needs.release.outputs.released == 'true' | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
| steps: | ||
| - uses: actions/download-artifact@fa0a91b85d4f404e444306234e16dac3d6cce7b0 # v4.1.8 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same issue -- fabricated SHA, verified via |
||
| with: | ||
| name: dist | ||
| path: dist/ | ||
| - uses: pypa/gh-action-pypi-publish@release/v1 | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,126 @@ | ||
| [build-system] | ||
| requires = ["setuptools", "setuptools-scm>8.1"] | ||
| build-backend = "setuptools.build_meta" | ||
|
|
||
| [project] | ||
| name = "edx-lint" | ||
| dynamic = ["version"] | ||
| description = "edX-authored pylint checkers" | ||
| readme = "README.rst" | ||
| license = "Apache-2.0" | ||
| license-files = ["LICENSE.txt"] | ||
| requires-python = ">=3.12" | ||
| authors = [ | ||
| {name = "edX", email = "oscm@edx.org"}, | ||
| ] | ||
| classifiers = [ | ||
| "Environment :: Console", | ||
| "Intended Audience :: Developers", | ||
| "Operating System :: OS Independent", | ||
| "Programming Language :: Python :: 3.12", | ||
| "Topic :: Software Development :: Quality Assurance", | ||
| ] | ||
| dependencies = [ | ||
| "code-annotations>=1.1.0", | ||
| "click>=8.0", | ||
| "click-log>=0.4.0", | ||
| "pylint>=4.0", | ||
| "pylint-django>=2.6", | ||
| "pylint-celery>=0.3", | ||
| "six>=1.16.0", | ||
| "tomlkit>=0.10.0", | ||
| ] | ||
|
|
||
| [project.urls] | ||
| Homepage = "https://github.com/openedx/edx-lint" | ||
|
|
||
| [project.scripts] | ||
| edx_lint = "edx_lint.cmd.main:main" | ||
| lint-amnesty = "edx_lint.cmd.amnesty:pylint_amnesty" | ||
|
|
||
| [tool.setuptools_scm] | ||
| version_scheme = "only-version" | ||
| local_scheme = "no-local-version" | ||
| fallback_version = "0.0.0.dev0" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| [tool.setuptools.packages.find] | ||
| where = ["src"] | ||
| include = ["edx_lint*"] | ||
| exclude = ["test*"] | ||
|
|
||
| [tool.setuptools.package-data] | ||
| "edx_lint" = [ | ||
| "files/*", | ||
| "files/.*", | ||
| ] | ||
|
|
||
| [dependency-groups] | ||
| test-base = [ | ||
| "coverage", | ||
| "pytest", | ||
| ] | ||
| test = [ | ||
| {include-group = "test-base"}, | ||
| "Django>=5.2,<6.0", | ||
| ] | ||
| django42 = [ | ||
| {include-group = "test-base"}, | ||
| "Django>=4.2,<4.3", | ||
| ] | ||
| quality = [ | ||
| {include-group = "test"}, | ||
| "edx-lint", | ||
| "pylint", | ||
| "pycodestyle", | ||
| ] | ||
| ci = [ | ||
| "tox", | ||
| "tox-uv>=1", | ||
| ] | ||
| dev = [ | ||
| {include-group = "quality"}, | ||
| {include-group = "ci"}, | ||
| ] | ||
|
|
||
| [tool.semantic_release] | ||
| # No version_toml — version is dynamic via setuptools-scm | ||
| 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] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| package = true | ||
| conflicts = [ | ||
| [{group = "test"}, {group = "django42"}], | ||
| ] | ||
|
|
||
| # DO NOT EDIT constraint-dependencies DIRECTLY. | ||
| # This list is managed by `edx_lint write_uv_constraints` | ||
| # and will be overwritten the next time `make upgrade` is run. | ||
| # - GLOBAL constraints: edit edx_lint/files/common_constraints.txt | ||
| # - REPO-SPECIFIC constraints: edit [tool.edx_lint].uv_constraints in this file | ||
| constraint-dependencies = [ | ||
| "Django<6.0", | ||
| "elasticsearch<7.14.0", | ||
| "social-auth-app-django<6.0.0", | ||
| "social-auth-core<5.0.0", | ||
| ] | ||
|
|
||
| [tool.coverage.run] | ||
| branch = true | ||
| source = ["edx_lint"] | ||
| omit = ["*/tests/*", "*/migrations/*", "*/__pycache__/*", "test/input/*"] | ||
|
|
||
| [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" | ||
This file was deleted.
This file was deleted.
This file was deleted.
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.
Missing
fetch-depth: 0. Without it,setuptools-scmcan't see git tags during test runs and falls back tofallback_version(see the pyproject.toml comment) on every CI run, not just release.yml. release.yml's own checkout correctly has this set.