pawamoy / markdown-exec

Utilities to execute code blocks in Markdown files.
https://pawamoy.github.io/markdown-exec
ISC License
111 stars 8 forks source link

bug: 1.9.0 sdist is missing tests #55

Closed mgorny closed 5 months ago

mgorny commented 5 months ago

Description of the bug

The 1.9.0 sdist tarball no longer includes the tests directory. As a result, we can no longer run tests when building the Gentoo package from it.

To Reproduce

$ wget https://files.pythonhosted.org/packages/33/f6/cf5be34d03d508261464ad11bad0f63bd5d3e94a15591089b0069105b757/markdown_exec-1.9.0.tar.gz
$ tar -tf markdown_exec-1.9.0.tar.gz | grep test

Full traceback

n/a

Expected behavior

Tests included in the archive, as they were in 1.8.2.

Environment information

n/a

Additional context

n/a

pawamoy commented 5 months ago

Oops! Thanks for the heads up. It's probably because I now specify source-includes = ["share"] in pyproject.toml. I thought this would add to rather than overwrite defaults. Let me fix this.

pawamoy commented 5 months ago

By the way @mgorny, I never really paid attention to what I include in my source dists: do you need anything else apart from the tests folder? How can I make your life easier? Do you prefer handling the test dependencies yourself or should I include a requirements file of some kind? If you don't have time to teach me system packaging, feel free to just point me at online resources :smile:

pawamoy commented 5 months ago

Pushed a fix as 1.9.1 :slightly_smiling_face: Closing, but happy to continue chatting!

mgorny commented 5 months ago

Pushed a fix as 1.9.1 🙂 Closing, but happy to continue chatting!

Thanks.

By the way @mgorny, I never really paid attention to what I include in my source dists: do you need anything else apart from the tests folder? How can I make your life easier? Do you prefer handling the test dependencies yourself or should I include a requirements file of some kind? If you don't have time to teach me system packaging, feel free to just point me at online resources 😄

Well, for our purposes, test files (and any test data, should that be required) is enough. In general, we also recommend including documentation sources, since users sometimes wish to be able to use documentation offline, though FWICS we've never used them for markdown-exec.

As for dependencies, my personal recommendation is to put them in pyproject.toml optional-dependencies section, e.g. as test optional. Then it's easy to install them e.g. via pip install .[test].

pawamoy commented 5 months ago

Thanks. I'm always conflicted with the idea of listing "development dependencies" in optional-dependencies, since "extras" are, IIUC, rather used to declare additional groups of "production" dependencies, allowing more features to be used.

But more than "development" dependencies, they could be called "packaging" dependencies too :thinking: But then if I include test deps, and docs sources, I should include docs deps, and all scripting around it, which might become necessary, and therefore every other dev deps used by these scripts. Quickly I end up with all my dev-deps in optional dependencies and all my custom scripts in the source dist :thinking:

Anyway, I'll try to think about it and find resources that talk about it.

mgorny commented 5 months ago

I suppose some projects work around that problem by installing tests within the package, and making it possible to run them after installing it (i.e. to verify that it still works). But that's rather a controversial topic.

Actually thinking about it, if you're going to list test dependencies in a file, please include it in sdist. Whenever I'm updating the Gentoo package, I'm looking at the diff, so having the dependencies there would help me know that I need to update the package as well. I generally check setup.*, pyproject.toml and *requirement*, so any file like that would work.

pawamoy commented 5 months ago

Sounds good! Including more stuff in the sdist is the least I can do. You might hate me a bit though... my dev-deps requirements file is called devdeps.txt 🙈