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

2.14.0: create temporary directory in source tree before build trashes build #1197

Closed
6 tasks done
kloczek opened this issue Sep 4, 2024 · 6 comments · Fixed by #1198
Closed
6 tasks done

2.14.0: create temporary directory in source tree before build trashes build #1197

kloczek opened this issue Sep 4, 2024 · 6 comments · Fixed by #1198
Assignees

Comments

@kloczek
Copy link

kloczek commented Sep 4, 2024

Describe the bug
Looks like some bits are still missing in pyproject.toml and create temporary directory during packaging process (SPECPARTS) trashes build. Here is build output:

+ /usr/bin/python3 -sBm build -w --no-isolation
* Getting build dependencies for wheel...
No `packages` or `py_modules` configuration, performing automatic discovery.
`flat-layout` detected -- analysing .
discovered packages -- ['aiobotocore', 'SPECPARTS', 'aiobotocore.retries']
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
    main()
  File "/usr/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 335, in main
    json_out['return_val'] = hook(**hook_input['kwargs'])
  File "/usr/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
    return hook(config_settings)
  File "/usr/lib/python3.10/site-packages/setuptools/build_meta.py", line 332, in get_requires_for_build_wheel
    return self._get_build_requires(config_settings, requirements=[])
  File "/usr/lib/python3.10/site-packages/setuptools/build_meta.py", line 302, in _get_build_requires
    self.run_setup()
  File "/usr/lib/python3.10/site-packages/setuptools/build_meta.py", line 318, in run_setup
    exec(code, locals())
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.10/site-packages/setuptools/__init__.py", line 117, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 158, in setup
    dist.parse_config_files()
  File "/usr/lib/python3.10/site-packages/setuptools/dist.py", line 608, in parse_config_files
    pyprojecttoml.apply_configuration(self, filename, ignore_option_errors)
  File "/usr/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py", line 71, in apply_configuration
    config = read_configuration(filepath, True, ignore_option_errors, dist)
  File "/usr/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py", line 143, in read_configuration
    return expand_configuration(asdict, root_dir, ignore_option_errors, dist)
  File "/usr/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py", line 168, in expand_configuration
    return _ConfigExpander(config, root_dir, ignore_option_errors, dist).expand()
  File "/usr/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py", line 216, in expand
    self._expand_all_dynamic(dist, package_dir)
  File "/usr/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py", line 261, in _expand_all_dynamic
    version=self._obtain_version(dist, package_dir),
  File "/usr/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py", line 312, in _obtain_version
    self._obtain(dist, "version", package_dir)  # pyright: ignore[reportArgumentType]
  File "/usr/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py", line 299, in _obtain
    return self._expand_directive(
  File "/usr/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py", line 293, in _expand_directive
    return _expand.read_attr(directive["attr"], package_dir, root_dir)
  File "/usr/lib/python3.10/site-packages/setuptools/config/expand.py", line 179, in read_attr
    path = _find_module(module_name, package_dir, root_dir)
  File "/usr/lib/python3.10/site-packages/setuptools/config/expand.py", line 225, in _find_module
    path_start = find_package_path(module_name, package_dir or {}, root_dir)
  File "/usr/lib/python3.10/site-packages/setuptools/config/expand.py", line 440, in __len__
    return len(self._target())
  File "/usr/lib/python3.10/site-packages/setuptools/config/expand.py", line 433, in _target
    self._value = self._obtain()
  File "/usr/lib/python3.10/site-packages/setuptools/config/expand.py", line 403, in _get_package_dir
    self()
  File "/usr/lib/python3.10/site-packages/setuptools/config/expand.py", line 388, in __call__
    self._dist.set_defaults(name=False)  # Skip name, we can still be parsing
  File "/usr/lib/python3.10/site-packages/setuptools/discovery.py", line 346, in __call__
    self._analyse_package_layout(ignore_ext_modules)
  File "/usr/lib/python3.10/site-packages/setuptools/discovery.py", line 380, in _analyse_package_layout
    or self._analyse_flat_layout()
  File "/usr/lib/python3.10/site-packages/setuptools/discovery.py", line 437, in _analyse_flat_layout
    return self._analyse_flat_packages() or self._analyse_flat_modules()
  File "/usr/lib/python3.10/site-packages/setuptools/discovery.py", line 443, in _analyse_flat_packages
    self._ensure_no_accidental_inclusion(top_level, "packages")
  File "/usr/lib/python3.10/site-packages/setuptools/discovery.py", line 473, in _ensure_no_accidental_inclusion
    raise PackageDiscoveryError(cleandoc(msg))
setuptools.errors.PackageDiscoveryError: Multiple top-level packages discovered in a flat-layout: ['SPECPARTS', 'aiobotocore'].

To avoid accidental inclusion of unwanted files or directories,
setuptools will not proceed with this build.

If you are trying to create a single distribution with multiple packages
on purpose, you should not rely on automatic discovery.
Instead, consider the following options:

1. set up custom discovery (`find` directive with `include` or `exclude`)
2. use a `src-layout`
3. explicitly set `py_modules` or `packages` with a list of names

To find more information, look for "package discovery" on setuptools docs.

ERROR Backend subprocess exited when trying to invoke get_requires_for_build_wheel

Checklist

  • I have reproduced in environment where pip check passes without errors
  • I have provided pip freeze results
  • I have provided sample code or detailed way to reproduce
  • I have tried the same code in botocore to ensure this is an aiobotocore specific issue
  • I have tried similar code in aiohttp to ensure this is is an aiobotocore specific issue
  • I have checked the latest and older versions of aiobotocore/aiohttp/python to see if this is a regression / injection

pip freeze results

aiohappyeyeballs==2.4.0
aiohttp==3.10.5
aioitertools==0.11.0
aiosignal==1.3.1
alabaster==0.7.16
async-timeout==4.0.3
attrs==24.2.0
Babel==2.15.0
blinker==1.7.0
boto3==1.35.10
botocore==1.35.10
build==1.2.1
cffi==1.16.0
charset-normalizer==3.3.2
click==8.1.7
cryptography==42.0.8
defusedxml==0.7.1
dill==0.3.8
distro==1.9.0
dnf==4.20.0
docker==7.1.0
docutils==0.20.1
exceptiongroup==1.1.3
Flask==3.0.3
Flask-Cors==5.0.0
frozenlist==1.4.1
idna==3.7
imagesize==1.4.1
importlib_metadata==8.0.0
iniconfig==2.0.0
installer==0.7.0
itsdangerous==2.1.2
Jinja2==3.1.4
jmespath==1.0.1
jsonschema==4.20.0
jsonschema-path==0.3.3
jsonschema-specifications==2023.12.1
lazy-object-proxy==1.10.0
libdnf==0.73.3
MarkupSafe==2.1.5
moto==4.1.0.dev0
multidict==6.0.5
openapi-schema-validator==0.6.2
openapi-spec-validator==0.7.1
packaging==24.0
pathable==0.4.3
pluggy==1.5.0
ply==3.11
pycparser==2.22
Pygments==2.18.0
pyproject_hooks==1.0.0
pytest==8.2.2
pytest-asyncio==0.23.8
python-dateutil==2.9.0.post0
pyupgrade==3.16.0
PyYAML==6.0.2
referencing==0.32.0
requests==2.32.3
responses==0.25.3
rfc3339_validator==0.1.4
rpds-py==0.20.0
rpm==4.19.1.1
ruff==0.6.3
s3transfer==0.10.2
snowballstemmer==2.2.0
Sphinx==8.0.2
sphinxcontrib-applehelp==1.0.8
sphinxcontrib-devhelp==1.0.6
sphinxcontrib-htmlhelp==2.0.5
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.7
sphinxcontrib-serializinghtml==2.0.0
tokenize_rt==6.0.0
tomli==2.0.1
typing_extensions==4.12.2
urllib3==2.2.2
Werkzeug==3.0.3
wrapt==1.16.0
xmltodict==0.13.0
yarl==1.9.7
zipp==3.19.2

Environment:

  • Python Version: 3.10.14
  • OS name and version: Linux x86/64

Additional context
Add any other context about the problem here.

@jakob-keller
Copy link
Collaborator

Thank you for providing this detailed report.

The issue appears to be triggered by the presence of SPECPARTS. Where does that come from?

We get the expected results with build isolation being enabled. Is there a reason to set the --no-isolation flag in your context?

@jakob-keller jakob-keller added the question Further information is requested label Sep 4, 2024
@jakob-keller
Copy link
Collaborator

I just saw that there was rpm-software-management/rpm#2532 when other Python projects switched to automatic discovery. Is that the same issue you're dealing with?

@kloczek
Copy link
Author

kloczek commented Sep 4, 2024

In this case it is problem however issue will popup on create any temporary directory.
As long as source tree contains exact and only one module source it does not make to much sense to use automatic discovery.

@jakob-keller
Copy link
Collaborator

I guess that makes sense. I will revert related changes from #1160.

jakob-keller added a commit to jakob-keller/aiobotocore that referenced this issue Sep 4, 2024
@jakob-keller jakob-keller self-assigned this Sep 4, 2024
@jakob-keller jakob-keller removed the question Further information is requested label Sep 4, 2024
@jakob-keller
Copy link
Collaborator

This should be fixed now. Do you need a new release?

@kloczek
Copy link
Author

kloczek commented Sep 4, 2024

No 😄 .. it can wait.
Thank you very much 👍

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

Successfully merging a pull request may close this issue.

2 participants