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
Circular dependency with mkdocstrings-python-legacy
#376
Comments
Hi @cpcloud! Thanks a lot, I'm glad you're enjoying mkdocstrings 😄 Now about the issue at hand. It's true the dependencies are circular, just as you stated: mkdocstrings depends on mkdocstrings-python-legacy which depends on mkdocstrings. But Python resolvers (pip, PDM, Poetry) all seem to be able to resolve this fine. Maybe there's something to do on poetry2nix's side? We're probably their first case of circular dependencies 😄 ? |
By the way, how does poetry2nix work on PDM projects? PDM generates a pdm.lock file (different name but same format), and we don't even version it. (@adisbladis) |
Err, that's too bad 😕 |
Yeah, pdm is incidental in our case. poetry2nix can work with any of the major Python build tools.
Possibly, though it's a bit surprising this hasn't come up before outside the various common leaf dependencies like
Would you mind elaborating a bit on the rationale for the circularity? It seems like We have a similar problem in ibis, where the Do you see any issue with leaving |
Same here, I am creating conda packages for mkdocstring (see conda-forge/staged-recipes#17960 and conda-forge/mkdocstrings-feedstock#17). Circular dependencies are making the packaging harder (the snake eating itself). If it's possible to break it, I would favor doing it as I am not sure having circular deps (even your package manager supports it) is a good thing. |
Sure! In fact, removing the dependency on When imported, the legacy handler warns users that the extra will become mandatory in the next release. This is to make sure nobody gets a bad surprise while upgrading, as I believe the way to deprecate things is, well, to use [deprecation/user] warnings for a short period at least. It brings us to this: next version of As to why the circular dependency in the first place: extras are convenient and allow us to depend on |
Not at the moment. I think it's something the conda folks are thinking about, but it's probably going to take a while. So usually, it's up to the package maintainer to do what he thinks is best: either include all the extra, none of them or only a few subsets of them. For the conda packages, extra are not really an issue to me. The circular deps are more critical. But if it's only temporary, then I think it's fine, and I'll upgrade the conda packages once it has been resolved. |
@hadim Thanks for the explanation, that's reassuring. In your case, I believe including no extras at all would be fine since users can explicitely depend on the handlers themselves. |
@pawamoy Circling back here, I think making I tested this by removing the dependency by from |
We were able to get the conda-forge package built with all the dependencies needed. I documented the process in conda-forge/mkdocstrings-feedstock#19, but everything is up to date now! |
Have you tried with mach-nix? |
@pawamoy I looked into this some more, and simply making mkdocstrings-python or mkdocstrings-python-legacy optional will not solve the problem. Ultimately to work with I can work around this problem on my side, but only if both Is it possible to keep all the various rendering addons as pure optional dependencies? |
I second that. I'm currently patching the sed -i "s/^.*\"mkdocstrings>=.*$//" pyproject.toml but that can't be the solution in the long term. (Note: I'm using Nix flakes directly, without |
If this installs properly with normal python tooling, can't it be a bug in poetry2nix? |
I kinda agree with @yajo here: extras (optional dependencies) is a pretty standard concept in the Python packaging ecosystem. I'd really like to keep the extras on mkdocstrings 😕 Our circular dependency can't possibly be the only one in the whole ecosystem. It seems poetry2nix special-cases some libraries that cause such circularity, see nix-community/poetry2nix#538, maybe mkdocstrings could be special-cased there as well? Tagging @adisbladis again 👋 I'd appreciate if we could explore a few possibilities, and if everything fails, then I'll remove the extras 🙂 |
This also affects Bazel projects 👎🏻
Project looks great by the way - looking forward to using it! |
Hi all, just released v0.19, which does not directly depend on mkdocstrings-python-legacy anymore. I would appreciate if you could try again your different tools to see if that still poses a cyclic issue or not. |
Thanks for your great work! |
This works with poetry2nix now, with the following caveat: you can't use the mkdocstrings = { version = "...", extras = ["python"] } Instead, you have to add the handler as a separate dependency: mkdocstrings = "..."
mkdocstrings-python = "..." After that, I'm able to get past infinite recursion though |
Here's the (unrelated) griffe issue. Linking here in case anyone hits it later: mkdocstrings/griffe#72. |
First off, great work on this project.
We recently converted our API docs at https://docs.ibis-project.org over to
mkdocstrings
and are extremely happy with the results, so thank you for all the work that you do here.Describe the bug
We are using
poetry2nix
to manage dependencies for development environments.poetry2nix
will turnpoetry.lock
into nix expressions each of which maps to a single Python package.To do this, poetry2nix will traverse the transitive closure of the set of dependencies specified in
poetry.lock
. However, it is unable to do so when a project hasmkdocstrings==0.18
as a dependency becausemkdocstrings
0.18 depends onmkdocstrings-python-legacy
which itself depends onmkdocstrings
0.18, resulting in infinite recursion.To Reproduce
Steps to reproduce the behavior:
nix build
Expected behavior
I expect this to work with
poetry2nix
without infinite recursion.Information (please complete the following information):
mkdocstrings
version: 0.18.0The text was updated successfully, but these errors were encountered: