Skip to content
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

Error: No module named build #172

Open
mauritsvanrees opened this issue Oct 23, 2024 · 2 comments
Open

Error: No module named build #172

mauritsvanrees opened this issue Oct 23, 2024 · 2 comments

Comments

@mauritsvanrees
Copy link
Contributor

I have check-manifest installed in a Buildout (the core Plone development buildout). Running check-manifest works in some repos (plone.api) but not in others (zope.interface):

$ ../../bin/check-manifest 
['/Users/maurits/community/plone-coredev/6.1/bin/python3.12', '-m', 'build', '--sdist', '.', '--outdir', '/var/folders/26/1plvhxbs6yx7g_82v2xdxc500000gn/T/check-manifest-h6nvj8ay-sdist'] failed (status 1):
/Users/maurits/community/plone-coredev/6.1/bin/python3.12: No module named build

In the one that works, there is a pyproject.toml with this:

[build-system]
requires = ["setuptools>=68.2"]

The one where it fails, has this:

[build-system]
requires = ["setuptools<74"]
build-backend = "setuptools.build_meta"

The important difference is the build-backend line (which I might actually need to add in the first repo as well), as this makes check-manifest call python -m build. This fails because build is not available in the python. Buildout creates a script like this:

$ cat ../../bin/check-manifest
#!/Users/maurits/community/plone-coredev/6.1/bin/python3.12

import sys
sys.path[0:0] = [
...
  '/Users/maurits/shared-eggs/cp312/check_manifest-0.49-py3.12.egg',
  '/Users/maurits/shared-eggs/cp312/build-1.2.2.post1-py3.12.egg',
...

So the build module is available in the script, but not in the Python.

If check-manifest is installed in a Python venv instead of by Buildout it should work fine. But maybe check-manifest could take over some lines from zest.releaser which imports the build module to use it in Python code.

The alternative would be for me (and others who have this problem) to pip install build in the venv that Buildout uses. I already think it likely that I will add build as dependency of zc.buildout 4, which would also solve this.

@mgedmin
Copy link
Owner

mgedmin commented Oct 23, 2024

Well, build has API documentation, hinting that maybe it has a supported public API for invoking it from Python code directly rather than from a script. Unfortunately it doesn't have any usage examples, so than you for linking to zest.releaser's use of it.

As you can see, I had already considered calling the Python code directly, so all that needs to happen is someone needs to figure out how to build an sdist while optionally skipping build isolation, and do that while intercepting any output from going to sys.stdout/stderr, but printing it only if an error happens.

Would you be interested in opening a PR?

@mauritsvanrees
Copy link
Contributor Author

Would you be interested in opening a PR?

I might, but realistically I won't have time this year.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants