Skip to content

Make editable installs work for local projects, and document them (refs #338) - #468

Open
federicocabrera1978-svg wants to merge 1 commit into
PyAr:masterfrom
federicocabrera1978-svg:issue_338_check_updates_file_deps
Open

federicocabrera1978-svg wants to merge 1 commit into
PyAr:masterfrom
federicocabrera1978-svg:issue_338_check_updates_file_deps

Conversation

@federicocabrera1978-svg

Copy link
Copy Markdown

Refs #338.

As suggested in the issue comment, instead of re-creating the virtualenv when a local project changes, this recommends installing it in editable mode. While testing that, I found a few glitches:

  • --pip-options=--editable didn't work: the options were put after the dependency, so pip got pip install file:///path --editable and failed with "--editable option requires 1 argument". The same happened with --uv-pip-options=--editable. Now the options go before the dependency, in both PipManager and UvManager.
  • --check-updates added an empty pypi entry to the dependencies when there were no PyPI ones (e.g. only a file:// dependency), which made fades not find the already created virtualenv and create a new one. Now check_pypi_updates returns the dependencies untouched in that case.
  • Documented in the README that file:// dependencies are copied into the virtualenv (so --check-updates doesn't see later changes), and how to use them in editable mode (--pip-options=--editable, or -d "-e file:///..." when there are other dependencies too).

Tests: added tests for options that need the dependency (pip and uv) and for check_pypi_updates without PyPI dependencies; adjusted the existing option tests to the new order. Full suite passes (369 tests), flake8/pydocstyle clean. Also checked manually with a real local project: editable installs pick up changes without re-creating the venv.

Note (not changed here): since pip options are not part of the venv cache key, if a non-editable venv for the same file:// dependency already exists, --pip-options=--editable will reuse it. Using -d "-e file:///..." avoids that, as it's a different dependency.

Local projects passed as 'file://' dependencies are copied into the
virtualenv, so later changes in the project are never seen, not even
with --check-updates (which only applies to PyPI dependencies).

The recommended way is to install them in editable mode, but
'--pip-options=--editable' (and '--uv-pip-options=--editable') didn't
work, as the options were put after the dependency and pip/uv got
'--editable' without its value. Now the options go before the
dependency.

Also, --check-updates added an empty 'pypi' entry to the dependencies
when there were none from PyPI, which made fades to not find the
already created virtualenv.

Documented in the README how to use local projects in editable mode.
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.

1 participant