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

build: automatic nb stripping and pypi upload #1267

Merged
merged 3 commits into from
Sep 6, 2024
Merged

Conversation

janfb
Copy link
Contributor

@janfb janfb commented Sep 4, 2024

  • add script for stripping notebook output
  • add it to docs CI to automatically strip notebooks before building the docs
  • add workflow for the automatic upload to PyPI upon a new release.
  • add trusted publisher to sbi PyPI project

Relevant links

@janfb janfb marked this pull request as draft September 4, 2024 10:32
Copy link

codecov bot commented Sep 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.28%. Comparing base (becc93c) to head (5f5cf9e).
Report is 3 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1267       +/-   ##
===========================================
- Coverage   89.24%   78.28%   -10.96%     
===========================================
  Files         119      119               
  Lines        8691     8698        +7     
===========================================
- Hits         7756     6809      -947     
- Misses        935     1889      +954     
Flag Coverage Δ
unittests 78.28% <ø> (-10.96%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 33 files with indirect coverage changes

@janfb
Copy link
Contributor Author

janfb commented Sep 5, 2024

My fist approach was to using the full tutorial template from https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/

With this approach, we would make a test release on every push to main using testPyPI. However, this fails because the version number would be the same, which is not allowed by PyPI (see pypa/packaging.python.org#804).

A solution would be using setuptools-scm to automatically determine version numbers also during development, i.e., in between public releases (explained here https://stackoverflow.com/questions/73605607/how-to-use-setuptools-scm). But my feeling is that this would be an overkill for now.

Thus, I suggest that we "just" use a GH Action triggered when we do a manual release via GitHub (bump version manually, update the changelog, paste changelog into release section and create a tag). This action will build the sbi distribution, upload it to PyPI, and create a signed release with SigStore.

@janfb janfb force-pushed the add-release-to-ci branch from 919e89e to cb244cb Compare September 5, 2024 07:45
@janfb janfb marked this pull request as ready for review September 5, 2024 08:02
@janfb janfb force-pushed the add-release-to-ci branch from cb244cb to 4971863 Compare September 5, 2024 08:04
@janfb janfb requested a review from tomMoral September 5, 2024 08:07
Copy link
Contributor

@michaeldeistler michaeldeistler left a comment

Choose a reason for hiding this comment

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

This is awesome! Questions and comments below :)

.github/workflows/build_docs.yml Show resolved Hide resolved
.github/workflows/publish.yml Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
tests/strip_notebook_outputs.py Show resolved Hide resolved
@janfb janfb force-pushed the add-release-to-ci branch from 4971863 to 5f5cf9e Compare September 6, 2024 05:13
Copy link
Contributor

@michaeldeistler michaeldeistler left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@janfb janfb merged commit e5573da into main Sep 6, 2024
6 checks passed
@janfb janfb deleted the add-release-to-ci branch September 6, 2024 06:30
Copy link
Contributor

@tomMoral tomMoral left a comment

Choose a reason for hiding this comment

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

Late to the party but it looks super nice :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants