Skip to content

Default value for filename in nox.project.load_toml #843

@paduszyk

Description

@paduszyk

How would this feature be useful?

I think most people will use the nox.project.load_toml function (added in #811) with their pyproject.toml. In fact, the name of the function itself suggests loading from a TOML.

Describe the solution you'd like

I would update the function's signature:

def load_toml(filename: os.PathLike[str] | str) -> dict[str, Any]:

with:

def load_toml(filename: os.PathLike[str] | str = "pyproject.toml") -> dict[str, Any]: 

or set the default to None and evaluate the file location from pwd:

def load_toml(filename: os.PathLike[str] | str | None = None) -> dict[str, Any]: 
    if filename is None:
        filename = Path.cwd() / "pyproject.toml"

    # ...

Describe alternatives you've considered

Alternatively, the path to the pyproject.toml can be set via nox.options.

Anything else?

No response

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