-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
22.5.0: pep517 build fails because is requires hatch-fancy-pypi-readme
during build
#13
Comments
Works for me:
|
So you have installed in build env hatch-fancy-pypi-readme>=22.4.0. But again: code of requires version is in build tree and many other modules is possible to build self bootstrapping (whey, build) |
This isn't a build backend it's a plugin |
It works for you because you executed |
@ofek is there a way around this or is every distro gonna complain about this now? :-/ |
No as long as you are requiring in pyprojest.toml module %build
export PYTHONPATH=$PWD/src
%pyproject_wheel or %build
export PYTHONPATH=$PWD
%pyproject_wheel to break self dependencies. |
fixed by 2f17c36 💔 |
cc other Linux distro experts @musicinmybrain @frenzymadness @stefanor @hroncok Is there really no way for a package to depend on itself? I wanted Hatchling to start using hatch-vcs so I can version using Git. Is that impossible? |
It should be possible to:
|
it may be possible, but such a package cannot depend on itself in |
or if there is a a Python way to "register" a hatch plugin, the build backend could be set to a local script that imports the plugin, registers it and "returns" the hatch backend |
It looks like a place to touch: https://github.com/pypa/hatch/blob/master/backend/src/hatchling/plugin/manager.py#L97 |
Pseudo-code: [build-system]
requires = ["hatch"]
build-backend = "intree_plugin_loader:build"
backend-path = ["tools", "src"] # tools/intree_plugin_loader.py
from hatchling import build as build_original
from hatch import register_plugin_xxx
__all__ = ['build']
def build(*args, **kwargs):
register_plugin_xxx(...)
return build_original(*args, **kwargs) |
Ah okay I think I understand for Hatchling, ty! Though I don't understand why this package can't depend on an older version of itself for builds. The code is under |
It can technically depend on itself only when it is already packaged as a wheel. It makes it impossible to bootstrap from the source. That it a distro maintainers' problem to solve but OTOH it's always nice to try to avoid it. I think some of the relevant PEPs discourages this but I am not entirely sure. |
Ohhhh right distros build from source all the way down. I get it now, bummer. Thank you! |
PEP 517 even forbids this, see https://www.python.org/dev/peps/pep-0517/#build-requirements
|
I do wonder if by cycle it implicitly means package only or the traditional package + version. |
See the discussion in pypa/wheel#429 for some details. |
It does not. It prohibits making cycles, not depending on local code. |
Yes. "depending on self" is a cycle. I was answering to
|
Agree. On the older version is a cycle. It will be nice to have some citations or paraphrases for context. |
So to make this work:
Does that sound right? |
That is a way to do it. Maybe hatch could have a configuration section that would made the plugin lookup from sys.path more explicit. |
I got an idea: Since the configuration already has:
Hatch could also load the plugin entrypoints from the pyproject.toml it is reading. That should be easier than "a way to load plugins based on file system paths" |
Clever! I will do that 🚀 |
To confirm, my plan is to load all |
Looks like now
hatch-fancy-pypi-readme
requires its own code to pass pep517 buildWhy not use during build `hatch-fancy-pypi-readme1 code from build tree? 🤔
The text was updated successfully, but these errors were encountered: