#283
gdtest_namespace_src
OK
CONFIG
Namespace package with src/ layout and dotted module name
Namespace package using src/ layout with dotted module name (nspkg.core). Code lives at src/nspkg/core/__init__.py and the great-docs.yml sets module: nspkg.core. Tests discovery of namespace packages in src/ layout via griffe search_paths and dotted path resolution in _find_package_init.
Build Mode
● Has great-docs.yml
This package ships a pre-supplied config.
The great-docs init step is skipped and
great-docs build uses the spec-defined configuration directly.
Tests specific config options and their rendered output.
Dimensions
A2 A12 B1 C4 D1 E6 F6 G1 H7
A2src/ layoutlayout
A12Namespace packagelayout
B1Explicit __all__exports
C4Mixed class+funcobjects
D1NumPydocstrings
E6No directivesdirectives
F6No user guideuser_guide
G1README.mdlanding
H7No extrasextras
Source Files
src/
nspkg/
core/
__init__.py
"""Core sub-package of the nspkg namespace."""
__version__ = "0.1.0"
__all__ = ["Config", "connect", "disconnect"]
class Config:
"""
Configuration holder for connections.
Parameters
----------
host
Server hostname.
port
Port number.
Examples
--------
>>> cfg = Config("localhost", 5432)
>>> cfg.host
'localhost'
"""
def __init__(self, host: str, port: int = 5432):
self.host = host
self.port = port
def as_dict(self) -> dict:
"""
Return configuration as a dictionary.
Returns
-------
dict
Keys are ``host`` and ``port``.
"""
return {"host": self.host, "port": self.port}
def validate(self) -> bool:
"""
Validate the configuration.
Returns
-------
bool
True if the configuration is valid.
Raises
------
ValueError
If the host is empty or port is out of range.
"""
if not self.host:
raise ValueError("Host cannot be empty")
if not (1 <= self.port <= 65535):
raise ValueError("Port must be between 1 and 65535")
return True
def connect(config: Config) -> str:
"""
Establish a connection using the given config.
Parameters
----------
config
The connection configuration.
Returns
-------
str
Connection URI string.
"""
return f"{config.host}:{config.port}"
def disconnect(connection: str) -> bool:
"""
Close an active connection.
Parameters
----------
connection
The connection string to close.
Returns
-------
bool
True if disconnection succeeded.
"""
return True__init__.py
"""Namespace top-level package."""
README.md
# gdtest-namespace-src Tests namespace package discovery with src/ layout and dotted module name.
great-docs.yml
module: nspkg.core