Skip to content

chore: swap ignore-installed with upgrade flag in nox#17259

Open
ohmayr wants to merge 5 commits into
mainfrom
switch-ignore-installed-with-upgrade
Open

chore: swap ignore-installed with upgrade flag in nox#17259
ohmayr wants to merge 5 commits into
mainfrom
switch-ignore-installed-with-upgrade

Conversation

@ohmayr
Copy link
Copy Markdown
Contributor

@ohmayr ohmayr commented May 26, 2026

If a local PR package has the same version number as the PyPI package already in the environment, package managers (pip or uv) will silently skip the local install. Our old workaround (--ignore-installed) forced the install, but it corrupted test environments by leaving behind duplicate .dist-info metadata.

Solution:
We split the dependency installation to handle local and external code differently:

Local packages (-e): We now use editable symlinks. Why we need this: It completely bypasses the version-matching cache. This guarantees the CI tests the unreleased PR code, without needing forceful overwrites, while dropping local installation time to zero.

PyPI packages (--upgrade): We use standard upgrades for external dependencies. It cleanly uninstalls old versions (preventing metadata corruption) while allowing the resolver to safely use its standard network cache for speed.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request replaces the --ignore-installed flag with --upgrade in several session.install calls within noxfile.py.j2. The reviewer points out that using --upgrade for local paths and local dependency paths might cause pip to skip installation if the package version has not changed, potentially ignoring local code modifications. They suggest using --force-reinstall instead to ensure local changes are always picked up.

Comment on lines +534 to +535
if local_paths:
session.install(*local_paths, "--no-deps", "--ignore-installed")
session.install(*local_paths, "--no-deps", "--upgrade")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using --upgrade for local paths can cause pip to skip installation if the package version has not changed. This means local code changes might not be reflected in the test session. To ensure local changes are always reinstalled, use --force-reinstall instead of --upgrade.

    if local_paths:
        session.install(*local_paths, "--no-deps", "--force-reinstall")

dep_paths = [str(deps_dir / dep) for dep in core_dependencies_from_source]

session.install(*dep_paths, "--no-deps", "--ignore-installed")
session.install(*dep_paths, "--no-deps", "--upgrade")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For local dependency paths, using --upgrade might prevent pip from reinstalling them if the version hasn't been bumped. Using --force-reinstall ensures that local modifications are always picked up.

    session.install(*dep_paths, "--no-deps", "--force-reinstall")

@ohmayr ohmayr marked this pull request as ready for review May 27, 2026 18:33
@ohmayr ohmayr requested a review from a team as a code owner May 27, 2026 18:34
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