Open gitonthescene opened 1 year ago
I think this might confirm my guess.
This is what the output looks like with the latest poetry release:
➜ csv-reconcile git:(develop) ✗ poetry build
Preparing build environment with build-system requirements poetry>=0.12, cython, setuptools!=50.0, wheel
Building csv-reconcile (0.3.2)
➜ csv-reconcile git:(develop) ✗
This is only triggered in Poetry projects using the undocumented build script support.
Here's a minimal repro:
# pyproject.toml
[tool.poetry]
name = "example"
version = "0.1.0"
description = ""
authors = ["your name <you@example.com>"]
build = "build.py"
[tool.poetry.dependencies]
python = "^3.11"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
# build.py
def build(setup_kwargs):
pass
# noxfile.py
from nox_poetry import session
@session
def test(session):
session.poetry.installroot(distribution_format="sdist")
The rest of the files as generated by poetry new
and poetry lock
.
Running nox:
❯ nox
nox > Running session test
nox > Creating virtual environment (virtualenv) using python in .nox/test
nox > poetry build --format=sdist --no-ansi
Preparing build environment with build-system requirements poetry-corenox > poetry --version --no-ansi
nox > poetry export --format=requirements.txt --without-hashes
nox > pip uninstall --yes 'file:///private/var/folders/x1/jpjk1s6n39qbb5wxldt5ms6c0000gn/T/tmp.i3TGU7yXyi/example/dist/%280.1.0%29#egg=example'
nox > pip cache remove example
nox > python -m pip install --constraint=.nox/test/tmp/requirements.txt 'file:///private/var/folders/x1/jpjk1s6n39qbb5wxldt5ms6c0000gn/T/tmp.i3TGU7yXyi/example/dist/%280.1.0%29#egg=example'
nox > Command python -m pip install --constraint=.nox/test/tmp/requirements.txt 'file:///private/var/folders/x1/jpjk1s6n39qbb5wxldt5ms6c0000gn/T/tmp.i3TGU7yXyi/example/dist/%280.1.0%29#egg=example' failed with exit code 1:
Processing ./dist/(0.1.0)
ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/private/var/folders/x1/jpjk1s6n39qbb5wxldt5ms6c0000gn/T/tmp.i3TGU7yXyi/example/dist/(0.1.0)'
nox > Session test failed.
Running Poetry:
❯ poetry build
Preparing build environment with build-system requirements poetry-core
Building example (0.1.0)
Running Poetry without build script:
❯ poetry build
Building example (0.1.0)
- Building sdist
- Built example-0.1.0.tar.gz
- Building wheel
- Built example-0.1.0-py3-none-any.whl
Nox currently doesn't have a good way to invoke PEP 517 build hooks like build_sdist
(which would take the build directory and return the name of the generated file). So I'd suggest the following, less appealing fix in the nox_poetry.poetry.Poetry.build
method:
poetry build
, as before.dist
directory, return it.nox_poetry.poetry.Config
)dist
directory, return it.Note that tool.poetry.version
may not match the version component in the sdist filename. The version could be computed dynamically, and it could be non-PEP 440 format. So this is not perfect, but likely good enough for now?
I'm open for better suggestions. Calling the build hook in a robust, cross-platform way would be great, but I don't really see how. If there was a mechanism to invoke poetry build
in a pristine build directory (rather than cleaning out files ourselves), that would also be a great option. Again, this doesn't seem to be supported.
The poetry version --short
command gives the version for the current Poetry project. Might that work?
Hi, I recently upgraded poetry to the latest release and I'm having issues running nox tests. I haven't changed anything other than upgrading poetry and nox.
Here's my noxfile.py. (Last edited two years ago...)
It looks like the SDIST usage varies from what I found in current documentation, but changing that to use the string didn't seem to help.
Here's the error I'm seeing:
As a wild guess It looks like maybe that
(0.3.2)
comes from processing poetry output which might have changed??Using
poetry build
manually produces the following files:I'm not sure where to start debugging this. Any advice you can offer would be greatly appreciated.
Regards