Git Product home page Git Product logo

Comments (3)

peterschutt avatar peterschutt commented on May 22, 2024 1

Hi, thanks for looking at this so quickly! I can confirm the fix works. I couldn't work out how to tell tox to install a build dependency from a local version so I made a bash script that creates a minimal package/poetry/tox/git setup and makes the same set of calls that tox makes to generate the errors. If you pass in the location of the wheel as a positional argument it will install p-d-v from that and all runs fine. E.g.,

Fails with above errors:
$ /bin/bash script.sh

Outputs tmpl-package-0.1.0.tar.gz:
$ /bin/bash script.sh ~/Downloads/poetry_dynamic_versioning-0.12.2a1-py3-none-any.whl

It feels to me like the first error looks like an import side-effect, as seems to happen before anything has executed in the tox build_requires.py helper which is raising the error. I haven't looked at it in any depth though so might be way off the mark!

Here's the script:

#!/bin/bash

# get loc. of pdv from arg, or use pypi.
PDV=${1:-"poetry_dynamic_versioning"}

# Create a temporary directory and store its name in a variable ...
TMPDIR=$(mktemp -d)

# Bail out if the temp directory wasn't created successfully.
if [ ! -e $TMPDIR ]; then
    >&2 echo "Failed to create temp directory"
    exit 1
fi
# Make sure it gets removed even if the script exits abnormally.
trap "exit 1"           HUP INT PIPE QUIT TERM
trap 'rm -rf "$TMPDIR"' EXIT

echo "Created $TMPDIR"
cd $TMPDIR
mkdir -p src/tmpl-package
touch src/tmpl-package/__init__.py

# make pyproject.toml
cat >./pyproject.toml  <<EOL
[tool.poetry]
name = "tmpl-package"
version = "0.0.0"
description = "something"
authors = ["me <[email protected]>"]
packages =[{include = "tmpl-package", from = "src"}]

[tool.poetry-dynamic-versioning]
enable = true

[build-system]
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning"]
build-backend = "poetry.core.masonry.api"
EOL

# make tox.ini
cat >./tox.ini <<EOL
[tox]
envlist=py39
isolated_build=true
EOL

git init && git add . && git commit -m "testing" && git tag v0.1.0

python -m venv .venv
source .venv/bin/activate
PYTHON=$(which python)
SITE_PACKAGES=$(python -c 'import site; print(site.getsitepackages()[0])')
echo $PYTHON
echo $SITE_PACKAGES
python -m pip install tox

$PYTHON -m virtualenv --no-download --python $PYTHON .package
.package/bin/python -m pip install 'poetry-core>=1.0.0' $PDV
.package/bin/python /home/peter/.pyenv/versions/3.9.1/lib/python3.9/site-packages/tox/helper/build_requires.py poetry.core.masonry.api '' ''
.package/bin/python /home/peter/.pyenv/versions/3.9.1/lib/python3.9/site-packages/tox/helper/build_isolated.py .tox/dist poetry.core.masonry.api '' ''

from poetry-dynamic-versioning.

mtkennerly avatar mtkennerly commented on May 22, 2024

Thanks for this report! I think I've identified a fix for both errors (although I don't quite understand how the first one managed to happen). Would you mind trying this wheel?

poetry_dynamic_versioning-0.12.2a1-py3-none-any.zip

It has the changes from the commit that I just pushed.

from poetry-dynamic-versioning.

mtkennerly avatar mtkennerly commented on May 22, 2024

Excellent! I've just released the fix as v0.12.2 :D

from poetry-dynamic-versioning.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.