{"id":1578,"library":"namex","title":"Namex: Python API Surface Management","description":"Namex is a Python utility that helps package developers define and manage their public API surface, primarily by simplifying the construction of the `__all__` attribute in `__init__.py`. It prevents accidental exposure of internal details and ensures a consistent public interface. The current version is 0.1.0, and it is likely to see active development with potential for API evolution.","status":"active","version":"0.1.0","language":"en","source_language":"en","source_url":"https://github.com/namex-project/namex","tags":["api-management","package-development","utility","__all__"],"install":[{"cmd":"pip install namex","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"note":"The core configuration class for defining API behavior.","symbol":"Config","correct":"from namex import Config"},{"note":"Function to generate the `__all__` list based on a Config object.","symbol":"get_api","correct":"from namex import get_api"}],"quickstart":{"code":"# my_package/__init__.py\nfrom namex import Config, get_api\n\nconfig = Config(\n    modules=[\"my_package.module_a\", \"my_package.module_b\"],\n    excludes=[\"my_package.module_a.private_func\"]\n)\n__all__ = get_api(config)\n\n# my_package/module_a.py\ndef public_func_a():\n    pass\ndef _private_func_a(): # Excluded by convention\n    pass\ndef private_func(x): # Explicitly excluded\n    pass\n\n# my_package/module_b.py\nclass PublicClassB:\n    pass\n","lang":"python","description":"This example demonstrates how to set up `namex` in a package's `__init__.py` to define its public API. It imports `Config` and `get_api`, then configures which modules to scan and which specific symbols to exclude. The resulting `__all__` ensures only specified public members are exposed."},"warnings":[{"fix":"Consult the latest documentation and release notes for updates when upgrading. Pin your version for production environments.","message":"As an early-stage library (v0.1.0), the public API of `namex` is subject to rapid evolution. Breaking changes may occur in minor releases until a stable API is established (e.g., v1.0.0).","severity":"gotcha","affected_versions":"0.1.x"},{"fix":"Thoroughly review the generated `__all__` content and adhere strictly to naming conventions and explicit configuration rules within your package.","message":"Namex relies on conventions (e.g., leading underscores for private members) and explicit configuration (e.g., `excludes`). Misunderstandings of these conventions can lead to unintended API exposure or hidden public components.","severity":"gotcha","affected_versions":"0.1.0"},{"fix":"Use Namex as the sole authority for managing your package's `__all__` attribute within its scope to ensure consistent and predictable API definition.","message":"Mixing Namex with manual `__all__` management or other API surface management tools within the same package can lead to unpredictable behavior and difficult-to-debug import errors.","severity":"gotcha","affected_versions":"0.1.0"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}