Skip to content

Conversation

@MusicalNinjaDad
Copy link
Contributor

As per our conversation in #123 - here is a quick overview of how to get ipytest running in CI. It turned out to be a little more involved than a simple one-liner.

Feel free to suggest, or directly make, any adjustments to the style or content. (I've granted you rights on the fork)

I hope to be able to offer a simpler approach soon with a pytest plugin (MusicalNinjaDad/pytest-ipynb2) which would collect and run any ipytest cells alongside other tests. I'll let you know how I get on...

@chmp
Copy link
Owner

chmp commented Feb 14, 2025

@MusicalNinjaDad Thanks a lot. I will have a look this weekend!

@MusicalNinjaDad
Copy link
Contributor Author

No problem.
FWIW I hope to have the instructions simplified to

pip install pytest-ipynb2
pytest --notebooks

In a few days

@chmp
Copy link
Owner

chmp commented Feb 16, 2025

@MusicalNinjaDad Thanks a lot. I reworded the section and adapted it closer to my style. As for the startup scripts: I am not sure they are all that relevant, TBH, but I left a note in.

Re you tool: happy to include a link to it once, you're happy with its state, both in the new CI section and related packages. I would probably still keep the current section, as I like to explain how things work.

What do you think?

@MusicalNinjaDad MusicalNinjaDad changed the title Running in ciInstructions for running in CI Instructions for running in CI Feb 16, 2025
@MusicalNinjaDad
Copy link
Contributor Author

@chmp - that is a lot easier to understand!

I've suggested two minor / nit-picky adjustments...

Looks good to go to me.

And yes, I'll drop you a note once I'm happier with the plugin (and will use your suggested ipytest.autoconfig(raise_on_error="GITHUB_ACTIONS" in os.environ) as one of the core test cases.

@chmp chmp changed the base branch from main to rewrite-with-uv February 16, 2025 17:38
@chmp
Copy link
Owner

chmp commented Feb 16, 2025

Perfect. Love it. Thanks a lot.

I noticed since the last release, poetry changed quite a bit so that the current package does no longer build correctly. I will merge in a temporary branch and fix uv there before merging both changes.

@chmp chmp merged commit 56314b8 into chmp:rewrite-with-uv Feb 16, 2025
1 check failed
@MusicalNinjaDad
Copy link
Contributor Author

I never befriended myself with poetry - seemed, overly complex and added a ton of stuff I felt was not pythonic for lib-focused development. Just had to spend a few days working in a poetry repo at work and that confirmed my feelings 100x

uv however, just found that this year ... that's the right balance for me. Can't wait to see red knot's first public release and replace pytype...

@MusicalNinjaDad
Copy link
Contributor Author

@chmp - I've got my plugin MusicalNinjaDad/pytest-ipynb2 to a point where I'm happy with the overall shape. There are still a few gaps but I'd be really interested in your opinion...

@chmp
Copy link
Owner

chmp commented Feb 19, 2025

IPython's excution model is quite complex and I could imagine that your collection of cells and then using excec can break quite easily. For example, my guess is that assertion rewriting, for which I use the ast transformer mechanism of IPython, is not working for your plugin.

Therefore, I am skeptical of any option that is not using a proper kernel. But once you are running a full kernel you start to reimplement nbval and I am not sure about the benefits.

That said: if it works for you and you see added value, I am happy to include it in the related packages section.

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.

2 participants