Skip to content
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

URL dependencies are sometimes silently ignored in PEP 723 noxfiles #934

Open
gschaffner opened this issue Feb 14, 2025 · 0 comments · May be fixed by #935
Open

URL dependencies are sometimes silently ignored in PEP 723 noxfiles #934

gschaffner opened this issue Feb 14, 2025 · 0 comments · May be fixed by #935
Labels

Comments

@gschaffner
Copy link
Contributor

Current Behavior

URL dependencies in a noxfile's PEP 723 dependencies are silently ignored in some cases.

Expected Behavior

Nox should not ignore any PEP 723 dependencies.

Steps To Reproduce

Minimal reproducer:

  1. noxfile.py:

    # /// script
    # requires-python = ">= 3.9"
    # dependencies = [
    #     "nox @ git+https://github.com/wntrblm/[email protected]",
    # ]
    # ///
    
    import importlib.metadata
    
    import nox
    
    
    @nox.session(python=False)
    def a(session: nox.Session) -> None:
        print(importlib.metadata.version("nox"))
    
    
    if __name__ == "__main__":
        import nox.__main__
    
        nox.__main__.main()
  2. Run nox

    Behavior:

    $ nox
    nox > Running session a
    2025.2.9
    nox > Session a was successful.

    Expected behavior:

    $ nox
    nox > Running session a
    2024.10.09
    nox > Session a was successful.

    For comparison:

    $ pipx run noxfile.py
    nox > Running session a
    2024.10.9
    nox > Session a was successful.
    $ uv run -s noxfile.py
    nox > Running session a
    2024.10.9
    nox > Session a was successful.

Environment

- OS: Arch Linux
- Python: CPython 3.13.2
- Nox: 2025.2.9

Anything else?

Whether Nox ignores a requirement depends on both the requirement and on the environment of the calling nox. For example, if we modify the example above:

 # dependencies = [
-#     "nox @ git+https://github.com/wntrblm/[email protected]",
+#     "nox[uv] @ git+https://github.com/wntrblm/[email protected]",
 # ]

then now nox will no longer ignore the requirement if nox is installed a venv without uv, but nox will still ignore the requirement if uv is installed in the same venv as it.

Another example:

# /// script
# requires-python = ">= 3.9"
# dependencies = [
#     "nox >= 2025.2.9",
#     "httpx @ git+https://github.com/encode/[email protected]",
# ]
# ///

import importlib.metadata

import nox


@nox.session(python=False)
def a(session: nox.Session) -> None:
    print(importlib.metadata.version("httpx"))


if __name__ == "__main__":
    nox.main()

With this one, Nox will ignore the httpx requirement if (for example) httpx==0.28.1 is installed in the same venv as nox.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

1 participant