From 1ff8fc09475fc405971c89efd9d72f1df526eb0b Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Thu, 26 Jun 2025 13:09:04 -0500 Subject: [PATCH] Use Flit instead of Poetry for uninstall tests (#14285) Investigating https://github.com/astral-sh/uv/issues/14158 --- crates/uv/tests/it/pip_uninstall.rs | 32 ++-- scripts/packages/flit_editable/.gitignore | 162 ++++++++++++++++++ .../flit_editable/flit_editable/__init__.py | 6 + scripts/packages/flit_editable/pyproject.toml | 17 ++ 4 files changed, 201 insertions(+), 16 deletions(-) create mode 100644 scripts/packages/flit_editable/.gitignore create mode 100644 scripts/packages/flit_editable/flit_editable/__init__.py create mode 100644 scripts/packages/flit_editable/pyproject.toml diff --git a/crates/uv/tests/it/pip_uninstall.rs b/crates/uv/tests/it/pip_uninstall.rs index 5e6cbf6f9..c72b92876 100644 --- a/crates/uv/tests/it/pip_uninstall.rs +++ b/crates/uv/tests/it/pip_uninstall.rs @@ -176,7 +176,7 @@ fn uninstall_editable_by_name() -> Result<()> { "-e {}", context .workspace_root - .join("scripts/packages/poetry_editable") + .join("scripts/packages/flit_editable") .as_os_str() .to_str() .expect("Path is valid unicode") @@ -187,22 +187,22 @@ fn uninstall_editable_by_name() -> Result<()> { .assert() .success(); - context.assert_command("import poetry_editable").success(); + context.assert_command("import flit_editable").success(); // Uninstall the editable by name. uv_snapshot!(context.filters(), context.pip_uninstall() - .arg("poetry-editable"), @r###" + .arg("flit-editable"), @r###" success: true exit_code: 0 ----- stdout ----- ----- stderr ----- Uninstalled 1 package in [TIME] - - poetry-editable==0.1.0 (from file://[WORKSPACE]/scripts/packages/poetry_editable) + - flit-editable==0.1.0 (from file://[WORKSPACE]/scripts/packages/flit_editable) "### ); - context.assert_command("import poetry_editable").failure(); + context.assert_command("import flit_editable").failure(); Ok(()) } @@ -216,7 +216,7 @@ fn uninstall_by_path() -> Result<()> { requirements_txt.write_str( context .workspace_root - .join("scripts/packages/poetry_editable") + .join("scripts/packages/flit_editable") .as_os_str() .to_str() .expect("Path is valid unicode"), @@ -228,22 +228,22 @@ fn uninstall_by_path() -> Result<()> { .assert() .success(); - context.assert_command("import poetry_editable").success(); + context.assert_command("import flit_editable").success(); // Uninstall the editable by path. uv_snapshot!(context.filters(), context.pip_uninstall() - .arg(context.workspace_root.join("scripts/packages/poetry_editable")), @r###" + .arg(context.workspace_root.join("scripts/packages/flit_editable")), @r###" success: true exit_code: 0 ----- stdout ----- ----- stderr ----- Uninstalled 1 package in [TIME] - - poetry-editable==0.1.0 (from file://[WORKSPACE]/scripts/packages/poetry_editable) + - flit-editable==0.1.0 (from file://[WORKSPACE]/scripts/packages/flit_editable) "### ); - context.assert_command("import poetry_editable").failure(); + context.assert_command("import flit_editable").failure(); Ok(()) } @@ -257,7 +257,7 @@ fn uninstall_duplicate_by_path() -> Result<()> { requirements_txt.write_str( context .workspace_root - .join("scripts/packages/poetry_editable") + .join("scripts/packages/flit_editable") .as_os_str() .to_str() .expect("Path is valid unicode"), @@ -269,23 +269,23 @@ fn uninstall_duplicate_by_path() -> Result<()> { .assert() .success(); - context.assert_command("import poetry_editable").success(); + context.assert_command("import flit_editable").success(); // Uninstall the editable by both path and name. uv_snapshot!(context.filters(), context.pip_uninstall() - .arg("poetry-editable") - .arg(context.workspace_root.join("scripts/packages/poetry_editable")), @r###" + .arg("flit-editable") + .arg(context.workspace_root.join("scripts/packages/flit_editable")), @r###" success: true exit_code: 0 ----- stdout ----- ----- stderr ----- Uninstalled 1 package in [TIME] - - poetry-editable==0.1.0 (from file://[WORKSPACE]/scripts/packages/poetry_editable) + - flit-editable==0.1.0 (from file://[WORKSPACE]/scripts/packages/flit_editable) "### ); - context.assert_command("import poetry_editable").failure(); + context.assert_command("import flit_editable").failure(); Ok(()) } diff --git a/scripts/packages/flit_editable/.gitignore b/scripts/packages/flit_editable/.gitignore new file mode 100644 index 000000000..3a8816c9e --- /dev/null +++ b/scripts/packages/flit_editable/.gitignore @@ -0,0 +1,162 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm-project.org/#use-with-ide +.pdm.toml +.pdm-python +.pdm-build/ + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ diff --git a/scripts/packages/flit_editable/flit_editable/__init__.py b/scripts/packages/flit_editable/flit_editable/__init__.py new file mode 100644 index 000000000..4076f6c86 --- /dev/null +++ b/scripts/packages/flit_editable/flit_editable/__init__.py @@ -0,0 +1,6 @@ +def main(): + print("Hello world!") + + +if __name__ == "__main__": + main() diff --git a/scripts/packages/flit_editable/pyproject.toml b/scripts/packages/flit_editable/pyproject.toml new file mode 100644 index 000000000..02f431543 --- /dev/null +++ b/scripts/packages/flit_editable/pyproject.toml @@ -0,0 +1,17 @@ +[project] +name = "flit-editable" +version = "0.1.0" +description = "Example Flit project" +authors = [ + {name = "konstin", email = "konstin@mailbox.org"}, +] +dependencies = [] +requires-python = ">=3.11" +license = {text = "MIT"} + +[project.scripts] +flit-editable = "flit_editable:main" + +[build-system] +requires = ["flit_core>=3.4,<4"] +build-backend = "flit_core.buildapi"