Skip to content

Install guide: verify step calls nu.__version__, which does not exist #3

Description

@tamohannes

docs/how-to/install.md gives this as the verify step:

uv run python -c "import nu; print(nu.__version__)"

It fails on a correctly installed tree:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: module 'nu' has no attribute '__version__'

src/nu/__init__.py does not define __version__; the version lives only in pyproject.toml (version = "0.1.0").

This is the step a user runs to confirm the install worked, so it reads as a broken install rather than a broken doc.

Two ways to fix

Add the attribute (keeps the doc as written, and nu.__version__ is what people will reach for anyway):

# src/nu/__init__.py
from importlib.metadata import version as _version

__version__ = _version("nu")

Or change the doc to something that already works:

uv run python examples/basic.py   # prints 42

The first seems better since the docs already promise the attribute, but the second is zero risk.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions