-
Notifications
You must be signed in to change notification settings - Fork 1
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
_httpdomain.py: import both collections and collections.abc #1
Conversation
At some point, apparently Python 3.3, collections.Mapping moved to collections.abc.Mapping [0]. Update the import accordingly. [0] https://docs.python.org/3/library/collections.abc.html
Hi and thanks for the report and PR! I'm a bit surprised, because I didn't get any error when testing locally, or when we build the online docs for Cilium. I'm not a Python expert though so I'm ready to believe you, but could you please provide more details on the error you got? I'd like to understand better what's going on here |
I got this error when trying to render docs using sphinx. It might be you didn't invoke that specific code path when building cilium docs? This was with python 3.9, and which attributes exist, which don't, and which show deprecation warnings can be easily inspected from the console:
As can be seen,
collections is in fact collections.abc (from your import above).
|
Interesting, I confirm I've not seen this before. We usually build the docs in a container, running |
The makefile is super minimal and standard, I doubt there's anything interesting here:
I essentially invoke All this happens in an environment with python 3.9 (due to ikalnytskyi/picobox#55). I have no idea I wasn't able to get the cilium Makefile to work, and I'm not really to involved enough to get it to work. Can you trigger a new build with this code applied and check? I guess for quick testing, you could literally simply edit the Dockerfile to copy over the updated file to |
OK, I looked at the PR from which you link this one, above. The bit of context I was missing is that you're using the fork for another project. I thought you were only trying to build Cilium's docs and somehow seeing failures that I didn't while doing so. So yeah, maybe we just don't go through the same paths in the code.
I can do better, I can pull directly your fork in the container by simply editing the requirements file:
|
As a side note, I'd recommend being very careful if you use the Cilium fork for this project. We forked it because we needed the switch to mdinclude, but we don't particularly intend to maintain this fork over time, and it could as well be removed in the future if we find a better solution upstream. So do keeping a copy of a functional version of the fork just in case might be a good idea. Ideally, I would like to contribute the changes in this branch to the upstream version of openapi. I haven't yet, because the test suite was not passing because mdinclude doesn't support docutils 0.19 (not sure what's the chain of failure but as far as I remember it's what it came down to), so I filed this issue in the meantime. [edit: issue now at https://github.com/omnilib/sphinx-mdinclude/issues/8).] |
184a41c
to
4f6bc2e
Compare
Understood - I'd also like to see upstream getting fixed. I'll try to keep an eye on the issue. On the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, this works for me when testing locally. Let me just give it a try with our CI tomorrow to make sure I don't break the build there (I don't see a reason why it would, but let's check anyway).
One nit, would you mind explaining why we can drop the Python 3.3 guard in your commit log, please?
On the
sphinx-mdinclude
issue, I sent the patch I'm using to get it to work with more recent versions of docutils.
Thanks a lot for that! Let's see if they pick it up. Might be worth opening a PR directly in a few days otherwise.
While a1d4fca fixed the import for collections.Mapping, using collections.defaultdict broke. Import both packages, and use them where appropriate. The conditional code for Python < 3.3 can be dropped, as setup.py already sets python_requires=">=3.6".
4f6bc2e
to
24c99c8
Compare
Thanks!
Sure thing! Added to the commit log and pushed again!
Yes! Same probably applies to ikalnytskyi/picobox#55, and I wonder why you're not running into the issues there, but that's definitely out of scope for this PR. |
OK this worked fine, I'm merging. Thanks! |
Thanks! |
PR to upstream the changes: sphinx-contrib#127 |
While a1d4fca fixed the import for
collections.Mapping, using collections.defaultdict broke.
Import both packages, and use them where appropriate.