Skip to content

Save session name in Func #717

@MicaelJarniac

Description

@MicaelJarniac

How would this feature be useful?

The session name manually provided at @nox.session(name="foo") does get sent to nox._decorators.Func(name="foo"), but it's then ignored, and not saved to the instance.

Also, if the session name isn't manually provided, it'll be inferred from the function name, but then won't even be sent to Func.

name: str | None = None,

nox/nox/registry.py

Lines 88 to 89 in 720f1ea

fn = Func(func, python, reuse_venv, name, venv_backend, venv_params, tags=tags)
_REGISTRY[name or func.__name__] = fn

Saving the session name, be it manually provided or automatically inferred, would make it easier for other developers to extend Nox functionality with other libraries.

Describe the solution you'd like

I'd like for the session name, regardless of whether it was manually provided, to be sent to Func and saved as an instance variable there.

Describe alternatives you've considered

No response

Anything else?

I believe this is a simple and quick enough change, so I'll be sending a PR with a possible implementation.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions