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

MAINT: Work around for pyproject / poetry / pip #1261

Merged
merged 1 commit into from
Apr 23, 2023

Conversation

HaoZeke
Copy link
Member

@HaoZeke HaoZeke commented Mar 25, 2023

Seems restrictive to force users to have a setup.py by default. Closes #1241. Probably also closes #903.

Comment on lines +881 to +886
elif has_file('poetry.lock'):
cmd = [
"python -mpip install poetry",
"poetry install",
"poetry build --format wheel --output {build_cache_dir}"
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as long as the build-backend is specified in pyproject.toml, then pip install should use poetry or pdm or whatever other backend, right? Or does that not respect .lock files?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that poetry and pdm are usually installed system-wide (at the user level with their own install scripts) and not always part of the requirements.txt. This is problematic because some projects use pdm or poetry for dependencies / development / tool management but still have setuptools as the build backend, which leads to errors, since asv doesn't pick up pdm or poetry from system-wide installs.

One way around this is to add logic in asv to look for pdm and poetry but this seemed less invasive.

@mattip
Copy link
Contributor

mattip commented Apr 23, 2023

Let's go with this now, and as the ecosystem matures we may be able to improve upon it in the future.

@mattip mattip merged commit 48d5315 into airspeed-velocity:master Apr 23, 2023
@mattip
Copy link
Contributor

mattip commented Apr 23, 2023

Thanks @HaoZeke

cmd = [
"python -mpip install poetry",
"poetry install",
"poetry build --format wheel --output {build_cache_dir}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am getting an error when running with poetry and python 3.10, The option "--output" does not exist, when either setting the build command in asv.conf.json or running this branch directly without a build command specified in the config. I don't see the --output option specified anywhere in poetry's (or pdm's) docs for the build command. Where does that option come from?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It used to be passed build transparently at some point, however currently pending python-poetry/poetry#7208 this needs to be reworked. Great catch!

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 this pull request may close these issues.

ENH: Support pdm, poetry asv does not recognize build-time dependencies in pyproject.toml
4 participants