-
Notifications
You must be signed in to change notification settings - Fork 13
feat: migrate to modern PyPI packaging (v2.1.0) #119
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
coketaste
wants to merge
8
commits into
develop
Choose a base branch
from
coketaste/v2-pypi
base: develop
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
8 commits
Select commit
Hold shift + click to select a range
f2f7455
feat: migrate to modern PyPI packaging with hatchling
coketaste 81eed01
docs: update CHANGELOG for v2.1.0 with PyPI packaging migration
coketaste f5c8c4d
fix(ci): add fetch-depth to lint job, flake8 config, and asset checks
coketaste d269572
chore: remove MANIFEST.in (unused by hatchling build backend)
coketaste e0ff8cc
style: format codebase with black + isort, fix unused imports/vars
coketaste 8187fdc
fix(ci): exclude e2e tests that require Docker and GPU
coketaste 71420a7
fix(ci): remove pytest.ini that overrode pyproject.toml and collected…
coketaste 4939561
fix(test): strip ANSI codes before asserting CLI help content
coketaste 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 |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| [flake8] | ||
| max-line-length = 88 | ||
| extend-ignore = | ||
| E203, | ||
| E266, | ||
| E402, | ||
| E501, | ||
| E741, | ||
| F541, | ||
| F811, | ||
| F824, | ||
| W503, | ||
| W291, | ||
| W293, | ||
| W391 | ||
| per-file-ignores = | ||
| tests/*:F401,F811,F405,F403,F841,E402,E712,E713 | ||
| exclude = | ||
| .git, | ||
| __pycache__, | ||
| build, | ||
| dist, | ||
| .eggs, | ||
| *.egg-info, | ||
| venv, | ||
| .venv, | ||
| src/madengine/scripts/, | ||
| tests/fixtures/dummy/scripts/ |
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,43 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [develop, main] | ||
| pull_request: | ||
| branches: [develop, main] | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| python-version: ['3.9', '3.10', '3.11', '3.12'] | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| - name: Install dependencies | ||
| run: pip install -e ".[dev]" | ||
| - name: Run tests | ||
| run: pytest -m "not slow and not integration" --ignore=tests/e2e/ | ||
|
|
||
| lint: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.11' | ||
| - name: Install dependencies | ||
| run: pip install -e ".[dev]" | ||
| - name: Check formatting (black) | ||
| run: black --check src/ tests/ | ||
| - name: Check imports (isort) | ||
| run: isort --check src/ tests/ | ||
| - name: Lint (flake8) | ||
| run: flake8 src/ tests/ | ||
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,109 @@ | ||
| name: Publish to PyPI | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
| workflow_dispatch: | ||
| inputs: | ||
| target: | ||
| description: 'Publish target' | ||
| required: true | ||
| default: 'testpypi' | ||
| type: choice | ||
| options: | ||
| - testpypi | ||
| - pypi | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.11' | ||
| - name: Install build tools | ||
| run: pip install build | ||
| - name: Build sdist and wheel | ||
| run: python -m build | ||
| - uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: dist | ||
| path: dist/ | ||
|
|
||
| test-install: | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| python-version: ['3.9', '3.10', '3.11', '3.12'] | ||
| steps: | ||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| - uses: actions/download-artifact@v4 | ||
| with: | ||
| name: dist | ||
| path: dist/ | ||
| - name: Install wheel | ||
| run: pip install dist/*.whl | ||
| - name: Verify CLI entry point | ||
| run: madengine --help | ||
| - name: Verify import and version | ||
| run: python -c "import madengine; print(madengine.__version__)" | ||
| - name: Verify package assets | ||
| run: | | ||
| python -c " | ||
| from pathlib import Path | ||
| import madengine | ||
| pkg = Path(madengine.__file__).parent | ||
| missing = [] | ||
| for p in [ | ||
| 'scripts/common/tools.json', | ||
| 'deployment/templates/kubernetes/job.yaml.j2', | ||
| 'deployment/templates/slurm/job.sh.j2', | ||
| 'py.typed', | ||
| ]: | ||
| if not (pkg / p).exists(): | ||
| missing.append(p) | ||
| if missing: | ||
| raise SystemExit(f'Missing package assets: {missing}') | ||
| print('All package assets verified') | ||
| " | ||
|
|
||
|
coketaste marked this conversation as resolved.
|
||
| publish-testpypi: | ||
| needs: test-install | ||
| if: >- | ||
| github.event_name == 'workflow_dispatch' && | ||
| github.event.inputs.target == 'testpypi' | ||
| runs-on: ubuntu-latest | ||
| environment: testpypi | ||
| permissions: | ||
| id-token: write | ||
| steps: | ||
| - uses: actions/download-artifact@v4 | ||
| with: | ||
| name: dist | ||
| path: dist/ | ||
| - uses: pypa/gh-action-pypi-publish@release/v1 | ||
| with: | ||
| repository-url: https://test.pypi.org/legacy/ | ||
|
|
||
| publish-pypi: | ||
| needs: test-install | ||
| if: >- | ||
| github.event_name == 'release' || | ||
| (github.event_name == 'workflow_dispatch' && | ||
| github.event.inputs.target == 'pypi') | ||
| runs-on: ubuntu-latest | ||
| environment: pypi | ||
| permissions: | ||
| id-token: write | ||
| steps: | ||
| - uses: actions/download-artifact@v4 | ||
| with: | ||
| name: dist | ||
| path: dist/ | ||
| - 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
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.
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.
Uh oh!
There was an error while loading. Please reload this page.