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
Source-less python distributions + PEP3147 #95827
Comments
Hello @vstinner, do you think you could have a look at this issue that is affecting us in the Buildroot project? Thanks a lot! |
@warsaw As the author of the PEP, do you have thoughts on this? |
@vfazio I'm not sure exactly what you're asking. PEP 3147, Case 4 specifically describes pyc locations. I would say that if a pyc location is found outside of |
@warsaw thanks for taking the time to respond. I think the first and most important question is: does Python support and plan to continue to support source-less distributions? If it's not a long term goal and will (or is even currently) a deprecated idea, then the rest is moot. You mention "So by implication Python itself supports source-less imports", and I agree, this support appears to be only implied and not explicitly stated. If I read between the lines of PEP 3147, Case 4 it implies that source-less distributions are "legacy" because they only work with legacy file placements and likely not considered "supported", or "guaranteed", long term since there is no analogue for this distribution type with the "new" format in If source-less distributions are not part of regression tests and are not taken into consideration when making future roadmap decisions then I would consider them unsupported and "try at your own risk". If source-less distros are supported:I think you answered the other question, that there is no documentation about considerations for source-less distros that packages need to take into account. Having a clearly documented mention of support would be useful for consumers of the source-less distro to point to when raising issues to 3rd party packages. Short of some official documentation, at least being able to point to, say, this issue would be useful in saying "This method of distribution is intentional and supported, please consider adding support in your package". This way we could go to PIP and point to https://github.com/vfazio/pip/blob/main/src/pip/_vendor/pep517/in_process/__init__.py#L13 and say "hey, that may not work for source-less distros" If source-less distros are not supported:As I mentioned in my previous comment, source-less distros are useful in embedded/space-constrained environments so having this ability is very useful and I'd ask that they be reconsidered. @tpetazzoni @yann-morin-1998 please chime in with any other concerns you may have as it relates to BR |
Sourceless imports are tested.
PEP 3147, Contributions welcome! Also @brettcannon for visibility. |
Hmm ok, i'll have to look into this further. I guess I was expecting to see more rigor than that a single sourceless import worked and more like the entire python3 test suite being run on a source-less distro. That's probably a github action we could add to ensure everything works as expected. We do have some limited evidence that sourceless distros work as i would have expected more issues would have cropped up from the Buildroot community if it didn't, but this would still be a good test to add. I'm up for making a contribution if we can determine the correct place to add the documentation and discuss what the content should encompass including any known gotchas and exceptions. |
Sounds good. I will try to find some time to review your proposals / PRs. |
I don't expect Also understand that |
This is a situation that is very common on embedded devices:
So, it is very convenient to pre-compile the modules at build time, and drop the sources on production builds: this regains some space, and noticeably lowers startup time. |
PEP 3147 (https://peps.pythondiscord.com/pep-3147/) makes mention of "continue to support source-less distributions" by using legacy pyc file placements when no py file is adjacent. Blurb here: https://peps.pythondiscord.com/pep-3147/#case-4-legacy-pyc-files-and-source-less-imports
What is not clear is if the term "legacy" applies to just the pyc file placement or if it applies to both the pyc file placement and source-less distributions.
Are source-less distributions first-class citizens in terms of support? They're often used for embedded environments (Buildroot, for example, generates a source-less distribution) so it would make sense that they are supported.
If source-less distributions are first-class citizens and should continue to be supported, is there documentation about what that implies for consumers of a distribution? Some things that we've seen are:
The text was updated successfully, but these errors were encountered: