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

invalid pyproject.toml #899

Closed
Rongronggg9 opened this issue Mar 24, 2022 · 5 comments · Fixed by #900
Closed

invalid pyproject.toml #899

Rongronggg9 opened this issue Mar 24, 2022 · 5 comments · Fixed by #900

Comments

@Rongronggg9
Copy link
Contributor

  • asyncpg version: irrelevant
  • PostgreSQL version: irrelevant
  • Do you use a PostgreSQL SaaS? If so, which? Can you reproduce the issue with a local PostgreSQL install?: irrelevant
  • Python version: Python 3.10.3 (main, Mar 18 2022, 05:09:31) [GCC 10.2.1 20210110] on linux
  • Platform: Linux ecd864aa501c 5.10.60-sunxi64 #21.08.1 SMP Wed Aug 25 18:29:57 UTC 2021 aarch64 GNU/Linux
  • Do you use pgbouncer?: irrelevant
  • Did you install asyncpg with pip?: yes
  • If you built asyncpg locally, which version of Cython did you use?: irrelevant
  • Can the issue be reproduced under both asyncio and uvloop?: irrelevant

In most cases, it is not really a problem because we have prebuilt wheels. However, this is not true for aarch64 (#870). I'd always built it by myself, but after a recent update of Python (or setuptools or some other?), I could never build it successfully.

After some tests, I found this issue occurs on amd64 too.

According to PEP 621, [project] must contain the name of the project.


sudo docker run --rm -it python:3.10-slim bash
apt-get update && apt-get install -y build-essential git --no-install-recommends
pip install -U pip setuptools

Build from PyPI:

pip install asyncpg --no-binary :all:

Or, Build from source:

pip install git+https://github.com/MagicStack/asyncpg.git@master

Output:

Collecting git+https://github.com/MagicStack/asyncpg.git@master
Cloning https://github.com/MagicStack/asyncpg.git (to revision master) to /tmp/pip-req-build-1y0lh4k8
Running command git clone --filter=blob:none --quiet https://github.com/MagicStack/asyncpg.git /tmp/pip-req-build-1y0lh4k8
Resolved https://github.com/MagicStack/asyncpg.git to commit a2f093df6aceec7842709eaf92c5ff9df093efae
Running command git submodule update --init --recursive -q
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... error
error: subprocess-exited-with-error

× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [515 lines of output]
/tmp/pip-build-env-mutsvdr9/overlay/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py:100: _ExperimentalProjectMetadata: Support for project metadata in `pyproject.toml` is still experimental and may be removed (or change) in future releases.
warnings.warn(msg, _ExperimentalProjectMetadata)
configuration error: `project` must contain ['name'] properties
DESCRIPTION:
Data structure for the **project** table inside ``pyproject.toml`` (as
initially defined in :pep:`621`)

GIVEN VALUE:
{
"requires-python": ">=3.6"
}

OFFENDING RULE: 'required'

DEFINITION:
...
...
<omitted>
...
...

Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py",line 363, in <module>
main()
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py",line 345, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py",line 130, in get_requires_for_build_wheel
return hook(config_settings)
File "/tmp/pip-build-env-9b_16u9a/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 177, in get_requires_for_build_wheel
return self._get_build_requires(
File "/tmp/pip-build-env-9b_16u9a/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 159, in _get_build_requires
self.run_setup()
File "/tmp/pip-build-env-9b_16u9a/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 174, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 248, in <module>
setuptools.setup(
File "/tmp/pip-build-env-9b_16u9a/overlay/lib/python3.10/site-packages/setuptools/__init__.py", line 77, in setup
return distutils.core.setup(**attrs)
File "/tmp/pip-build-env-9b_16u9a/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 122, in setup
dist.parse_config_files()
File "/tmp/pip-build-env-9b_16u9a/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 836, in parse_config_files
pyprojecttoml.apply_configuration(self, filename, ignore_option_errors)
File "/tmp/pip-build-env-9b_16u9a/overlay/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py", line 52, in apply_configuration
config = read_configuration(filepath, True, ignore_option_errors, dist)
File "/tmp/pip-build-env-9b_16u9a/overlay/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py", line 114, in read_configuration
validate(subset, filepath)
File "/tmp/pip-build-env-9b_16u9a/overlay/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py", line 43, in validate
raise error from None
ValueError: invalid pyproject.toml config: `project`
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
hint: See above for details.
@Rongronggg9
Copy link
Contributor Author

For those who can't wait for the next release, you may temporarily use my fork. It just added the name of the project into pyproject.toml and fixed this bug. I've opened a PR too.

pip install git+https://github.com/Rongronggg9/asyncpg.git@fix/pep-621

@Whatislove118
Copy link

I confirm. Faced this problem today. Thx @Rongronggg9 for this solution

@kunansy
Copy link

kunansy commented Mar 25, 2022

Exactly the same trouble

@Talpik
Copy link

Talpik commented Mar 25, 2022

For temporary fixing you can use this instructions in your Dockerfile - and delete asyncpg from requirements.txt

RUN pip install --upgrade pip
RUN pip install wheel
RUN pip install check-wheel-contents
RUN git clone https://github.com/Rongronggg9/asyncpg.git --recursive
RUN cd asyncpg && python3 setup.py bdist_wheel && cd ..

RUN pip install asyncpg/dist/*

@Rongronggg9
Copy link
Contributor Author

For temporary fixing you can use this instructions in your Dockerfile - and delete asyncpg from requirements.txt

RUN pip install --upgrade pip
RUN pip install wheel
RUN pip install check-wheel-contents
RUN git clone https://github.com/Rongronggg9/asyncpg.git --recursive
RUN cd asyncpg && python3 setup.py bdist_wheel && cd ..

RUN pip install asyncpg/dist/*

In fact, there is a pretty simple solution:
In the requirements.txt, replace asyncpg with git+https://github.com/Rongronggg9/asyncpg.git@fix/pep-621 and that's it!

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.

4 participants