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

ci: Minor reorganizations #1190

Merged
merged 21 commits into from Jan 13, 2024
Merged

ci: Minor reorganizations #1190

merged 21 commits into from Jan 13, 2024

Conversation

LecrisUT
Copy link
Contributor

@LecrisUT LecrisUT commented Dec 4, 2023

Copy link

github-actions bot commented Dec 4, 2023

Thank you for making this pull request.

Did you know? You can try it on Binder: Binder:lab or Binder:notebook.

Also, the version of Jupytext developed in this PR can be installed with pip:

pip install git+https://github.com/LecrisUT/jupytext.git@ci/organize

(this requires nodejs, see more at Developing Jupytext)

Copy link

codecov bot commented Dec 4, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (0606f03) 97.73% compared to head (1870d19) 96.74%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1190      +/-   ##
==========================================
- Coverage   97.73%   96.74%   -0.99%     
==========================================
  Files          29       29              
  Lines        4456     4456              
==========================================
- Hits         4355     4311      -44     
- Misses        101      145      +44     
Flag Coverage Δ
external ?
functional ?
integration ?
unit ?

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@LecrisUT LecrisUT force-pushed the ci/organize branch 8 times, most recently from 858b829 to d4a633d Compare December 4, 2023 16:06
@LecrisUT
Copy link
Contributor Author

LecrisUT commented Dec 4, 2023

About the codecov issue (Unable to locate build via Github Actions API). Ping me if it happens again, and we can try setting env_vars 12

Footnotes

  1. https://docs.codecov.com/docs/cli-options#do-upload

  2. https://github.com/codecov/codecov-action#arguments

.github/workflows/ci.yml Outdated Show resolved Hide resolved
Comment on lines +79 to +96
release:
needs: [ publish ]
name: Create release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- uses: softprops/action-gh-release@v1
with:
name: Jupytext ${{ inputs.ref || github.ref_name }}
draft: true
prerelease: ${{ contains(inputs.ref || github.ref, 'rc') }}
generate_release_notes: true
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of reinventing the wheel, I would suggest to look into jupyter-releaser. It will work out-of-the-box nicely to publish to both PyPI and NPM.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, open to suggestions on this one, can you propose the change so I can look at what it does and check if it's equivalent? I'm curious if it works with Trusted publishing and how that works when being used with both PyPI and NPM

Copy link
Contributor

Choose a reason for hiding this comment

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

It does work with Trusted publishing which is very neat. For NPM we still need to use a token as a secret to publish.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I need to read it carefully, because the workflow seems incompatible:
https://github.com/jupyter-server/jupyter_releaser/blob/43d510770f1fe039e133890936416956b927e250/jupyter_releaser/actions/populate_release.py#L42

(This workflow runs on tag release, while the jupyter_releasser creates the new tag) 🤔. Indeed there are good points like the bumpimg of package.json, but then how do you specify the tag?

Copy link
Contributor

Choose a reason for hiding this comment

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

This is a manual workflow. So, the maintainer will kickstart a release process by prepping a release -> https://jupyter-releaser.readthedocs.io/en/latest/get_started/making_release_from_repo.html#prep-release

And this will produce the artifacts and updated changelog. Once the maintainer is happy with everything, they can go ahead with release -> https://jupyter-releaser.readthedocs.io/en/latest/get_started/making_release_from_repo.html#publish-release

Copy link
Contributor Author

@LecrisUT LecrisUT Dec 4, 2023

Choose a reason for hiding this comment

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

Ok, I think we have two possible workflows here:

  • run on tag: use the current approach and run pre-release to bump to the next version. I think we can mix individual steps from the releaser as long as we order them appropriately
  • run on dispatch: use the reusable workflows there

It is a bit weird because of the mixing of dynamic-version via git on the python sideand the static version of npm. Normally I prefer to bump versions after a release in order to clearly communicate the difference in versions (e.g. main vs tag release)

Copy link
Contributor

Choose a reason for hiding this comment

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

Well, my original suggestion was to replace the current release.yml file with the ones from jupyter-releaser instead of mixing them with current one. But I see few potential blockers adopting jupyter-releaser:

  • jupyter-releaser expects package.json to be in root of the repo for it to build and release NPM packages.
  • And NPM package and Python package should have same version for consistency. For example, JupyterLab has few dozens of NPM packages and they all have consistent version with main JupyterLab Python package.

dynamic-version via git on the python sideand the static version of npm

We do not use dynamic version (if you mean like versioneer creating a new version string for each commit). What hatch will do is bump NPM version in package.json and then make sure that Python package will use that same version as package.json. Currently, versions of NPM package and Python package of Jupytext are diverged and hence, it does not work out-of-the-box.

Your suggestion of creating our own workflows based on jupyter-releaser might work. Something like splitting like these workflows for Python and NPM packages separately. But that increases the maintainence burden. As @mwouts is the one who is making releases, it depends on how much complexity he is willing to handle.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, my original suggestion was to replace the current release.yml file with the ones from jupyter-releaser instead

Slight nuance because you still need a release.yml with an on:workflow_dispatch. But yeah, what you suggest is about the second approach in my last comment. We just need to have a light wrapper to forward the inputs.

We do not use dynamic version (if you mean like versioneer creating a new version string for each commit).

Ah you're right src/jupytext/version.py is a static file. I confused it with tool.hatch.build.hooks.vcs.version-file. Would the version bumping work on the python side?

Currently, versions of NPM package and Python package of Jupytext are diverged and hence, it does not work out-of-the-box.

Good point. In either case it needs to re-converge the versioning number, unless there are more complicated tag forms.

Your suggestion of creating our own workflows based on jupyter-releaser might work. Something like splitting like these workflows for Python and NPM packages separately.

Indeed, looking back there are quite a few changes necessary. And in either case we need to test these workflows because there seems to be quite a few things to look out for. @mahendrapaipuri can the jupyter-releaser be tested locally on a fork, like uploading to GitHub package repo. And indeed the main question is @mwouts, which one do you prefer: tag push, calling workflow, or manual commits?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah you're right src/jupytext/version.py is a static file. I confused it with tool.hatch.build.hooks.vcs.version-file. Would the version bumping work on the python side?

Ah, I thought we are already using hatch to do version bumping. But currenctly version string is set manually I assume. Yes, we can do the bumping using hatch

can the jupyter-releaser be tested locally on a fork, like uploading to GitHub package repo

Yes, there is a check-release workflow that dry runs all the release steps on local PyPI and mock GitHub instance in CI. So, if and when we decide to use jupyter-releaser tools in release workflows, we can adopt a similar solution to test it locally on mock instances.

Copy link
Owner

@mwouts mwouts Jan 12, 2024

Choose a reason for hiding this comment

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

Thanks @LecrisUT and @mahendrapaipuri for this. I am afraid this is too unfamiliar to me. I am happy with the current process for releasing, i.e. editing the CHANGELOG.md and version files manually, and then adding a tag in the GitHub interface, so if you don't mind I might left this change for later and revert to the previous state of publish.yml for now.

@LecrisUT LecrisUT force-pushed the ci/organize branch 2 times, most recently from 0327f0b to 7556316 Compare December 5, 2023 11:11
@LecrisUT LecrisUT marked this pull request as ready for review December 5, 2023 11:13
@LecrisUT LecrisUT force-pushed the ci/organize branch 2 times, most recently from e3d6c25 to 903e871 Compare December 5, 2023 13:21
@LecrisUT LecrisUT mentioned this pull request Dec 5, 2023
@mwouts
Copy link
Owner

mwouts commented Dec 7, 2023

Hi @LecrisUT , thank you for making this PR! I have a busy week but I will certainly look into this over the coming days. Thanks!

@mwouts mwouts added this to the 1.17.0 milestone Jan 7, 2024
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
Copy link
Owner

@mwouts mwouts left a comment

Choose a reason for hiding this comment

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

Sounds great! Thank you for the PR! As mentioned above I might revert the change on release.yml as I am not ready for that one, but other than that I am looking forward to merging this!

Comment on lines +79 to +96
release:
needs: [ publish ]
name: Create release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- uses: softprops/action-gh-release@v1
with:
name: Jupytext ${{ inputs.ref || github.ref_name }}
draft: true
prerelease: ${{ contains(inputs.ref || github.ref, 'rc') }}
generate_release_notes: true
Copy link
Owner

@mwouts mwouts Jan 12, 2024

Choose a reason for hiding this comment

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

Thanks @LecrisUT and @mahendrapaipuri for this. I am afraid this is too unfamiliar to me. I am happy with the current process for releasing, i.e. editing the CHANGELOG.md and version files manually, and then adding a tag in the GitHub interface, so if you don't mind I might left this change for later and revert to the previous state of publish.yml for now.

- python-version: "3.x"
markdown-it-py-version: ""
markdown-it-py: false
Copy link
Owner

Choose a reason for hiding this comment

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

Testing that Jupytext works without markdown-it-py in the CI seems very hard to achieve! It does not seem to be working on main, but I am not sure it is working here neither. I will have a look.

Cf. https://github.com/mwouts/jupytext/actions/runs/7506308274/job/20437528721 which does not run the 'uninstall markdown-it-py' step:
image

- name: Uninstall markdown-it-py
# Markdown-it-py is a dependency of Jupytext,
# but Jupytext should still work if it is not installed
if: ${{ matrix.markdown-it-py-version == '' }}
if: ${{ matrix.markdown-it-py == 'false' }}
Copy link
Owner

Choose a reason for hiding this comment

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

Maybe this should be == false? Maybe I'll switch to using a flag like no_kernel or quarto which works and also has the advantage of being more explicit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes you're right. Github workflow is annoying like that where sometimes the variable is converted to a string, sometimes it's the original json type. In the case of matrix it's the latter.

Copy link
Owner

Choose a reason for hiding this comment

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

FYI I have added an additional no_markdown-it-py (false/true) at #1204

- python-version: "3.x"
pip-flags: "--pre --upgrade --upgrade-strategy eager"
dependency_type: "pre"
Copy link
Owner

Choose a reason for hiding this comment

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

Thanks for this! At the moment the pre-pip tests are not passing (an issue with the pytest release candidate). Do you think there is a way to mark this step as experimental, i.e. get a red box for that particular one but still get a pass globally?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Owner

Choose a reason for hiding this comment

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

Interesting! I am not familiar with the inputs yet but yes this seems to be the way to go. I've added the experimental flag in this PR, on top of yours: #1204

"mdit_py_plugins",
"markdown-it-py>=1.0.0",
"mdit-py-plugins",
"markdown-it-py>=2.0",
Copy link
Owner

Choose a reason for hiding this comment

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

I am planning to release this PR in jupytext_1.16.1 so I'd rather let this change of dependencies on markdown-it-py for jupytext_1.17.0.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, let me add the CI to run for 1.0 in this case then revert the commit after that

Copy link
Owner

Choose a reason for hiding this comment

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

Great idea! Thanks

@mwouts mwouts mentioned this pull request Jan 12, 2024
@mwouts mwouts modified the milestones: 1.17.0, 1.16.1 Jan 12, 2024
@mwouts mwouts merged commit 9046930 into mwouts:main Jan 13, 2024
24 of 27 checks passed
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.

None yet

3 participants