Skip to content

Port uv test improvements to other package manager tests #1834

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

Merged
merged 1 commit into from
Jul 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
def hello():
print("Hello pyproject.toml!")
print("Hello from pyproject.toml!")
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
def hello():
print("Hello setup.py!")
print("Hello from setup.py!")
3 changes: 3 additions & 0 deletions spec/fixtures/pipenv_editable/bin/test-entrypoints.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ cd .heroku/python/lib/python*/site-packages/
grep --extended-regexp --only-matching -- '/\S+' *.pth __editable___*_finder.py | sort
echo

echo -n "Running entrypoint for the current package: "
pipenv-editable

echo -n "Running entrypoint for the pyproject.toml-based local package: "
local_package_pyproject_toml

Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
def hello():
print("Hello pyproject.toml!")
print("Hello from pyproject.toml!")
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
def hello():
print("Hello setup.py!")
print("Hello from setup.py!")
2 changes: 2 additions & 0 deletions spec/fixtures/pipenv_editable/pipenv_editable/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def main() -> None:
print("Hello from pipenv-editable!")
3 changes: 3 additions & 0 deletions spec/fixtures/pipenv_editable/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name = "pipenv-editable"
version = "0.0.0"
requires-python = ">=3.13"

[project.scripts]
pipenv-editable = "pipenv_editable:main"

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# The version here intentionally doesn't match `python_version` in Pipfile.lock
3.13
10 changes: 10 additions & 0 deletions spec/fixtures/pipenv_mismatched_python_version/Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
typing-extensions = "*"

[requires]
python_version = "3.12"
30 changes: 30 additions & 0 deletions spec/fixtures/pipenv_mismatched_python_version/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions spec/fixtures/poetry_editable/bin/test-entrypoints.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ cd .heroku/python/lib/python*/site-packages/
grep --extended-regexp --only-matching -- '/\S+' *.pth __editable___*_finder.py | sort
echo

echo -n "Running entrypoint for the current package: "
poetry-editable

echo -n "Running entrypoint for the pyproject.toml-based local package: "
local_package_pyproject_toml

Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
def hello():
print("Hello pyproject.toml!")
print("Hello from pyproject.toml!")
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
def hello():
print("Hello setup.py!")
print("Hello from setup.py!")
2 changes: 2 additions & 0 deletions spec/fixtures/poetry_editable/poetry_editable/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def main() -> None:
print("Hello from poetry-editable!")
3 changes: 3 additions & 0 deletions spec/fixtures/poetry_editable/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ gunicorn = { git = "https://github.com/benoitc/gunicorn.git", develop = true }
local-package-pyproject-toml = { path = "packages/local_package_pyproject_toml", develop = true }
local-package-setup-py = { path = "packages/local_package_setup_py", develop = true }

[tool.poetry.scripts]
poetry-editable = 'poetry_editable:main'

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# The version here intentionally doesn't match requires-python in pyproject.toml
3.13
18 changes: 18 additions & 0 deletions spec/fixtures/poetry_mismatched_python_version/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions spec/fixtures/poetry_mismatched_python_version/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[project]
name = "poetry-mismatched-python-version"
version = "0.0.0"
# This Python version intentionally doesn't match that in .python-version.
# The version here also matches the distro Python version in Ubuntu 24.04,
# so we can also test Poetry doesn't fall back to system Python.
requires-python = "3.12.*"
dependencies = [
"typing-extensions"
]

[tool.poetry]
package-mode = false
20 changes: 10 additions & 10 deletions spec/hatchet/pip_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@
remote: gunicorn.egg-link:/app/.heroku/python/src/gunicorn
remote: local-package-setup-py.egg-link:/tmp/build_.+/packages/local_package_setup_py
remote:
remote: Running entrypoint for the pyproject.toml-based local package: Hello pyproject.toml!
remote: Running entrypoint for the setup.py-based local package: Hello setup.py!
remote: Running entrypoint for the pyproject.toml-based local package: Hello from pyproject.toml!
remote: Running entrypoint for the setup.py-based local package: Hello from setup.py!
remote: Running entrypoint for the VCS package: gunicorn \\(version 20.1.0\\)
remote: -----> Inline app detected
remote: easy-install.pth:/app/.heroku/python/src/gunicorn
Expand All @@ -118,8 +118,8 @@
remote: gunicorn.egg-link:/app/.heroku/python/src/gunicorn
remote: local-package-setup-py.egg-link:/tmp/build_.+/packages/local_package_setup_py
remote:
remote: Running entrypoint for the pyproject.toml-based local package: Hello pyproject.toml!
remote: Running entrypoint for the setup.py-based local package: Hello setup.py!
remote: Running entrypoint for the pyproject.toml-based local package: Hello from pyproject.toml!
remote: Running entrypoint for the setup.py-based local package: Hello from setup.py!
remote: Running entrypoint for the VCS package: gunicorn \\(version 20.1.0\\)
REGEX

Expand All @@ -131,8 +131,8 @@
gunicorn.egg-link:/app/.heroku/python/src/gunicorn
local-package-setup-py.egg-link:/app/packages/local_package_setup_py

Running entrypoint for the pyproject.toml-based local package: Hello pyproject.toml!
Running entrypoint for the setup.py-based local package: Hello setup.py!
Running entrypoint for the pyproject.toml-based local package: Hello from pyproject.toml!
Running entrypoint for the setup.py-based local package: Hello from setup.py!
Running entrypoint for the VCS package: gunicorn (version 20.1.0)
OUTPUT

Expand All @@ -147,8 +147,8 @@
remote: gunicorn.egg-link:/app/.heroku/python/src/gunicorn
remote: local-package-setup-py.egg-link:/tmp/build_.+/packages/local_package_setup_py
remote:
remote: Running entrypoint for the pyproject.toml-based local package: Hello pyproject.toml!
remote: Running entrypoint for the setup.py-based local package: Hello setup.py!
remote: Running entrypoint for the pyproject.toml-based local package: Hello from pyproject.toml!
remote: Running entrypoint for the setup.py-based local package: Hello from setup.py!
remote: Running entrypoint for the VCS package: gunicorn \\(version 20.1.0\\)
remote: -----> Inline app detected
remote: easy-install.pth:/app/.heroku/python/src/gunicorn
Expand All @@ -157,8 +157,8 @@
remote: gunicorn.egg-link:/app/.heroku/python/src/gunicorn
remote: local-package-setup-py.egg-link:/tmp/build_.+/packages/local_package_setup_py
remote:
remote: Running entrypoint for the pyproject.toml-based local package: Hello pyproject.toml!
remote: Running entrypoint for the setup.py-based local package: Hello setup.py!
remote: Running entrypoint for the pyproject.toml-based local package: Hello from pyproject.toml!
remote: Running entrypoint for the setup.py-based local package: Hello from setup.py!
remote: Running entrypoint for the VCS package: gunicorn \\(version 20.1.0\\)
REGEX
# Test that the VCS repo checkout was cached correctly.
Expand Down
41 changes: 31 additions & 10 deletions spec/hatchet/pipenv_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -407,17 +407,19 @@
remote: __editable___local_package_setup_py_0_0_1_finder.py:/tmp/build_.+/packages/local_package_setup_py/local_package_setup_py'}
remote: _pipenv_editable.pth:/tmp/build_.+
remote:
remote: Running entrypoint for the pyproject.toml-based local package: Hello pyproject.toml!
remote: Running entrypoint for the setup.py-based local package: Hello setup.py!
remote: Running entrypoint for the current package: Hello from pipenv-editable!
remote: Running entrypoint for the pyproject.toml-based local package: Hello from pyproject.toml!
remote: Running entrypoint for the setup.py-based local package: Hello from setup.py!
remote: Running entrypoint for the VCS package: gunicorn \\(version 23.0.0\\)
remote: -----> Inline app detected
remote: __editable___gunicorn_23_0_0_finder.py:/app/.heroku/python/src/gunicorn/gunicorn'}
remote: __editable___local_package_pyproject_toml_0_0_1_finder.py:/tmp/build_.+/packages/local_package_pyproject_toml/local_package_pyproject_toml'}
remote: __editable___local_package_setup_py_0_0_1_finder.py:/tmp/build_.+/packages/local_package_setup_py/local_package_setup_py'}
remote: _pipenv_editable.pth:/tmp/build_.+
remote:
remote: Running entrypoint for the pyproject.toml-based local package: Hello pyproject.toml!
remote: Running entrypoint for the setup.py-based local package: Hello setup.py!
remote: Running entrypoint for the current package: Hello from pipenv-editable!
remote: Running entrypoint for the pyproject.toml-based local package: Hello from pyproject.toml!
remote: Running entrypoint for the setup.py-based local package: Hello from setup.py!
remote: Running entrypoint for the VCS package: gunicorn \\(version 23.0.0\\)
REGEX

Expand All @@ -428,8 +430,9 @@
__editable___local_package_setup_py_0_0_1_finder.py:/app/packages/local_package_setup_py/local_package_setup_py'}
_pipenv_editable.pth:/app

Running entrypoint for the pyproject.toml-based local package: Hello pyproject.toml!
Running entrypoint for the setup.py-based local package: Hello setup.py!
Running entrypoint for the current package: Hello from pipenv-editable!
Running entrypoint for the pyproject.toml-based local package: Hello from pyproject.toml!
Running entrypoint for the setup.py-based local package: Hello from setup.py!
Running entrypoint for the VCS package: gunicorn (version 23.0.0)
OUTPUT

Expand All @@ -445,23 +448,41 @@
remote: __editable___local_package_setup_py_0_0_1_finder.py:/tmp/build_.+/packages/local_package_setup_py/local_package_setup_py'}
remote: _pipenv_editable.pth:/tmp/build_.+
remote:
remote: Running entrypoint for the pyproject.toml-based local package: Hello pyproject.toml!
remote: Running entrypoint for the setup.py-based local package: Hello setup.py!
remote: Running entrypoint for the current package: Hello from pipenv-editable!
remote: Running entrypoint for the pyproject.toml-based local package: Hello from pyproject.toml!
remote: Running entrypoint for the setup.py-based local package: Hello from setup.py!
remote: Running entrypoint for the VCS package: gunicorn \\(version 23.0.0\\)
remote: -----> Inline app detected
remote: __editable___gunicorn_23_0_0_finder.py:/app/.heroku/python/src/gunicorn/gunicorn'}
remote: __editable___local_package_pyproject_toml_0_0_1_finder.py:/tmp/build_.+/packages/local_package_pyproject_toml/local_package_pyproject_toml'}
remote: __editable___local_package_setup_py_0_0_1_finder.py:/tmp/build_.+/packages/local_package_setup_py/local_package_setup_py'}
remote: _pipenv_editable.pth:/tmp/build_.+
remote:
remote: Running entrypoint for the pyproject.toml-based local package: Hello pyproject.toml!
remote: Running entrypoint for the setup.py-based local package: Hello setup.py!
remote: Running entrypoint for the current package: Hello from pipenv-editable!
remote: Running entrypoint for the pyproject.toml-based local package: Hello from pyproject.toml!
remote: Running entrypoint for the setup.py-based local package: Hello from setup.py!
remote: Running entrypoint for the VCS package: gunicorn \\(version 23.0.0\\)
REGEX
end
end
end

# This tests that Pipenv doesn't fall back to system Python if the Python version in
# pyproject.toml doesn't match that in Pipfile / Pipfile.lock.
context 'when requires-python in pyproject.toml is incompatible with .python-version',
skip: 'this is currently broken upstream: https://github.com/pypa/pipenv/issues/6403' do
let(:app) { Hatchet::Runner.new('spec/fixtures/pipenv_mismatched_python_version', allow_failure: true) }

it 'fails the build' do
app.deploy do |app|
expect(clean_output(app.output)).to include(<<~OUTPUT)
remote: -----> Installing dependencies using 'pipenv install --deploy'
remote: <TODO whatever error message Pipenv displays if they fix their bug>
OUTPUT
end
end
end

# This tests not only our handling of failing dependency installation, but also that we're running
# Pipenv in such a way that it errors if the lockfile is out of sync, rather than simply updating it.
context 'when the Pipfile.lock is out of sync with Pipfile' do
Expand Down
41 changes: 31 additions & 10 deletions spec/hatchet/poetry_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,19 @@
remote: __editable___local_package_setup_py_0_0_1_finder.py:/tmp/build_.+/packages/local_package_setup_py/local_package_setup_py'}
remote: poetry_editable.pth:/tmp/build_.+
remote:
remote: Running entrypoint for the pyproject.toml-based local package: Hello pyproject.toml!
remote: Running entrypoint for the setup.py-based local package: Hello setup.py!
remote: Running entrypoint for the current package: Hello from poetry-editable!
remote: Running entrypoint for the pyproject.toml-based local package: Hello from pyproject.toml!
remote: Running entrypoint for the setup.py-based local package: Hello from setup.py!
remote: Running entrypoint for the VCS package: gunicorn \\(version 23.0.0\\)
remote: -----> Inline app detected
remote: __editable___gunicorn_23_0_0_finder.py:/app/.heroku/python/src/gunicorn/gunicorn'}
remote: __editable___local_package_pyproject_toml_0_0_1_finder.py:/tmp/build_.+/packages/local_package_pyproject_toml/local_package_pyproject_toml'}
remote: __editable___local_package_setup_py_0_0_1_finder.py:/tmp/build_.+/packages/local_package_setup_py/local_package_setup_py'}
remote: poetry_editable.pth:/tmp/build_.+
remote:
remote: Running entrypoint for the pyproject.toml-based local package: Hello pyproject.toml!
remote: Running entrypoint for the setup.py-based local package: Hello setup.py!
remote: Running entrypoint for the current package: Hello from poetry-editable!
remote: Running entrypoint for the pyproject.toml-based local package: Hello from pyproject.toml!
remote: Running entrypoint for the setup.py-based local package: Hello from setup.py!
remote: Running entrypoint for the VCS package: gunicorn \\(version 23.0.0\\)
REGEX

Expand All @@ -136,8 +138,9 @@
__editable___local_package_setup_py_0_0_1_finder.py:/app/packages/local_package_setup_py/local_package_setup_py'}
poetry_editable.pth:/app

Running entrypoint for the pyproject.toml-based local package: Hello pyproject.toml!
Running entrypoint for the setup.py-based local package: Hello setup.py!
Running entrypoint for the current package: Hello from poetry-editable!
Running entrypoint for the pyproject.toml-based local package: Hello from pyproject.toml!
Running entrypoint for the setup.py-based local package: Hello from setup.py!
Running entrypoint for the VCS package: gunicorn (version 23.0.0)
OUTPUT

Expand All @@ -161,17 +164,19 @@
remote: __editable___local_package_setup_py_0_0_1_finder.py:/tmp/build_.+/packages/local_package_setup_py/local_package_setup_py'}
remote: poetry_editable.pth:/tmp/build_.+
remote:
remote: Running entrypoint for the pyproject.toml-based local package: Hello pyproject.toml!
remote: Running entrypoint for the setup.py-based local package: Hello setup.py!
remote: Running entrypoint for the current package: Hello from poetry-editable!
remote: Running entrypoint for the pyproject.toml-based local package: Hello from pyproject.toml!
remote: Running entrypoint for the setup.py-based local package: Hello from setup.py!
remote: Running entrypoint for the VCS package: gunicorn \\(version 23.0.0\\)
remote: -----> Inline app detected
remote: __editable___gunicorn_23_0_0_finder.py:/app/.heroku/python/src/gunicorn/gunicorn'}
remote: __editable___local_package_pyproject_toml_0_0_1_finder.py:/tmp/build_.+/packages/local_package_pyproject_toml/local_package_pyproject_toml'}
remote: __editable___local_package_setup_py_0_0_1_finder.py:/tmp/build_.+/packages/local_package_setup_py/local_package_setup_py'}
remote: poetry_editable.pth:/tmp/build_.+
remote:
remote: Running entrypoint for the pyproject.toml-based local package: Hello pyproject.toml!
remote: Running entrypoint for the setup.py-based local package: Hello setup.py!
remote: Running entrypoint for the current package: Hello from poetry-editable!
remote: Running entrypoint for the pyproject.toml-based local package: Hello from pyproject.toml!
remote: Running entrypoint for the setup.py-based local package: Hello from setup.py!
remote: Running entrypoint for the VCS package: gunicorn \\(version 23.0.0\\)
REGEX
end
Expand Down Expand Up @@ -236,6 +241,22 @@
end
end

# This tests that Poetry doesn't download its own Python or fall back to system Python
# if the Python version in pyproject.toml doesn't match that in .python-version.
context 'when requires-python in pyproject.toml is incompatible with .python-version',
skip: 'this is currently broken upstream: https://github.com/python-poetry/poetry/issues/10226' do
let(:app) { Hatchet::Runner.new('spec/fixtures/poetry_mismatched_python_version', allow_failure: true) }

it 'fails the build' do
app.deploy do |app|
expect(clean_output(app.output)).to include(<<~OUTPUT)
remote: -----> Installing dependencies using 'poetry sync --only main'
remote: <TODO whatever error message Poetry displays if they fix their bug>
OUTPUT
end
end
end

# This tests not only our handling of failing dependency installation, but also that we're running
# Poetry in such a way that it errors if the lockfile is out of sync, rather than simply updating it.
context 'when poetry.lock is out of sync with pyproject.toml' do
Expand Down