-
Notifications
You must be signed in to change notification settings - Fork 70
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
Build python with --enable-shared
#130
Conversation
This enables python packages that embed python into binaries to be documented with readthedocs. The PR associated with this commit links an example.
@eric-wieser I assume you've already tried this, but have you looked into mocking the imports? We really try to avoid needing complex local environments for doc generation, when at all possible. |
Mocking the imports isn't really an option, because the failure happens at build time not import time. We opted for using conda for our docs, which has a python binary built with The main argument for doing this is that system python installations are typically built with this flag present - you can check with |
@eric-wieser well the goal of mocking would be to not have to install your library, but to be able to import it with mocked dependencies. It definitely doesn't work everywhere. Thanks for the info, it will help us with considering this PR 👍 |
Well the library in question is one we hope to generate documentation for - mocking it would lose all the docstrings. There are things we've considered in our project to avoid needing this, which I'm the long run made sense - but this PR or switching to conda were a lot easier. |
I double-checked this and I can confirm that the Python version that comes with Ubuntu 20.04 LTS has this enabled and the Python we are compiling ourselves don't. So, I'm fine adding this flag to the new Docker images in #166 |
Hi @eric-wieser! In #166 we implemented the ability to install extra tools --which is still in beta. Together with that change, now, we are also compiling Python with build:
os: "ubuntu-20.04"
tools:
python: "3.9"
Thanks! |
This enables python packages that embed python into binaries to be documented with readthedocs.
This is in response to cocotb/cocotb#1569, which we concluded was due to python being built without
--enable-shared
.Taken from https://github.com/pyenv/pyenv/wiki#how-to-build-cpython-with---enable-shared