-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
poetry-core does not execute build
function in build.py
#7470
Comments
probably broken by python-poetry/poetry-core#318, try [tool.poetry.build]
script = "build.py"
generate-setup-file = true |
That does allow it to work! Does create a unwanted setup.py file. Is this simply new behavior, or will this be something fixed in later versions, that poetry-core will be able to call |
setting this explicitly is simply restoring the old behaviour - the default changed |
Got ya, thank you for the fast help @dimbleby ! |
Synapse has frequent releases, we can limit poetry-core to <1.5.0 now and wait for the next version where the issue will be solved. Bug: https://bugs.gentoo.org/893244 See-also: matrix-org/synapse#14949 See-also: python-poetry/poetry#7470 Signed-off-by: Petr Vaněk <arkamar@atlas.cz>
Synapse has frequent releases, we can limit poetry-core to <1.5.0 now and wait for the next version where the issue will be solved. Bug: https://bugs.gentoo.org/893244 See-also: matrix-org/synapse#14949 See-also: python-poetry/poetry#7470 Signed-off-by: Petr Vaněk <arkamar@atlas.cz>
Synapse has frequent releases, we can limit poetry-core to <1.5.0 now and wait for the next version where the issue will be solved. Bug: https://bugs.gentoo.org/893244 See-also: matrix-org/synapse#14949 See-also: python-poetry/poetry#7470 Signed-off-by: Petr Vaněk <arkamar@atlas.cz> Closes: #29379 Signed-off-by: Sam James <sam@gentoo.org>
mistaken OP
[tool.poetry]
build = "build.py"
[tool.poetry.build]
script = "build.py"
generate-setup-file = true
I totally got mixed up across tests of editable installs, wheel builds, and toggling the flag above. However, I think I now know what it does in each situation:
Given those last two are mutually exclusive and import sys
from pathlib import Path
from shutil import rmtree
from subprocess import check_call
SRC_DIR = Path(__file__).parent.parent.absolute() / "src". # NOTE: I have this in a `scripts/` dir next to `src/`, adjust if necessary
CYTHON_MODULES = sorted(SRC_DIR.rglob("*.pyx"))
if __name__ == "__main__":
if CYTHON_MODULES:
# NOTE: The PATH doesn't seem to always be set correctly when called via Poetry, so ensure we use the cythonize
# relative to our python binary (which may be from the build isolation venv).
check_call([str(Path(sys.executable).parent / "cythonize"), "-i", *CYTHON_MODULES])
# If using namespace packages, cythonize will create build/ dirs above the nearest `__init__.py`, which may
# incorrectly be bundled into the wheel.
for build_dir in SRC_DIR.rglob("build/"):
rmtree(build_dir) NOTE: I also had to add (also, hey @cdgriffith, small world 😄) |
@dimbleby is there a plan to make a more stable API around this ? I've started building a plugin to try to handle Cython building like this. The fact it's an unstable API at the moment makes it unfortunately more work to rely on this behaviour as understandable change-logs won't mention behaviour changes like this. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
-vvv
option) and have included the output below.Issue
Trying to switch to the lighter
poetry-core
for building wheels, but thebuild
function is not executed inside thebuild.py
file.Using
poetry.core
as the build backend, I will only seeBuild File Imported
(custom print statements inbuild.py
) and neitherbuild
function is called.However if I switch the build system back to the old method of just
poetry
:Everything will work fine when I run
pip wheel . -v
and show both:build.py
Package itself is https://github.com/cdgriffith/Box/blob/master/pyproject.toml and issue brought up by cdgriffith/Box#244
The text was updated successfully, but these errors were encountered: