Skip to content
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

Publish to PyPI. #37

Merged
merged 8 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
on:
push:
branches: [ main ]
tags: [ v* ]
pull_request:
branches: [ main ]

name: Publish package
jobs:
build:
name: Build distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install pypa/build
run: |
python -m pip install build
- name: Build a binary wheel and a source tarball
run: |
python -m build
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: python-artifacts
path: dist

# This assumes a PyPI Trusted Publisher has been configured for the `pyorderly` package.
# See https://docs.pypi.org/trusted-publishers/ for more details.
publish-to-pypi:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
name: Publish Python distribution to PyPI
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/pyorderly
permissions:
# This permission is needed for the workflow to authenticate against PyPI
id-token: write
steps:
- name: Download the artifacts
uses: actions/download-artifact@v3
with:
name: python-artifacts
path: dist/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ checkout:
hatch run pip install /path/to/outpack_server
```

## Releasing

- Increment the version number using [the `hatch version` command](https://hatch.pypa.io/latest/version/#updating).
- Commit the changes and create a PR.
- Get the PR approved and merged to main.
- Create a [GitHub release](https://github.com/mrc-ide/pyorderly/releases/new):
- Set the tag name as `vX.Y.Z`, matching the version reported by hatch.
- Write some release notes (possibly using the `Generate release notes` button).
- Publish the release!
- Sit back and relax while the release gets built and published.
- Check that the new version is available on [PyPI](https://pypi.org/project/pyorderly/#history).

## License

Expand Down
2 changes: 1 addition & 1 deletion src/pyorderly/__about__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SPDX-FileCopyrightText: 2023-present Rich FitzJohn <r.fitzjohn@imperial.ac.uk>
#
# SPDX-License-Identifier: MIT
__version__ = "0.0.1"
__version__ = "0.1.0"
__name__ = "pyorderly"
5 changes: 5 additions & 0 deletions src/pyorderly/outpack/filestore.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ def onerror(func, path, _exc_info):
if not os.access(path, os.W_OK):
os.chmod(path, stat.S_IWUSR)
func(path)
else:
# This is always called by rmtree from within a try-catch
# block, but the linter doesn't see that and complains about
# the argument-less `raise` statement.
raise # noqa: PLE0704
Copy link
Member Author

@plietar plietar Aug 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd removed this line in #57 to appease the linter, but turns out the line is actually useful and removing it breaks the tests on Windows.


shutil.rmtree(self._path, onerror=onerror)

Expand Down
Loading