Skip to content

Privata

Keep Python module interfaces intentional

Privata logo

Privata scans Python source roots and reports public symbols that are only used inside their own module. It also reports private module imports that cross package boundaries.

PyPI package ยท GitHub repository

Quick Start

uv tool install privata
privata .

Continue with Getting Started, or see the usage guide for the full checker behavior.

Features

  • Finds public module-level functions, classes, variables, and type aliases that can be made private.
  • Ignores test imports when deciding whether a symbol is public.
  • Detects private modules imported from outside their owning package subtree.
  • Detects private top-level symbols imported by another production module.
  • Validates literal __all__ declarations for stale and missing exports.
  • Honors package __init__.py re-exports and literal __all__ declarations.
  • Honors pyproject.toml console entry points, Uvicorn shell entry points, and Tach interfaces.
  • Uses Tach source_roots, src/, or the project root depending on the repository layout.
  • Uses only the Python standard library at runtime.

Example

Found 2 public symbols that could be made private:

  src/example/service.py:12: function `helper`
  src/example/service.py:21: class `InternalState`