Conventions

Package-wide conventions I prefer.

Naming

  1. Ctx Managers: {}_ctx.

  2. Enums: {}_e.

  3. Flags: {}_f.

  4. Hooks: {}_h.

  5. Interfaces: {}_i.

  6. Loggers: {}_l.

  7. Mixins: {}_m.

  8. Protocols: {}_p.

  9. Slot-based Data: {}_d.

  10. Specs: {}_c.

  11. Structs: {}_s.

  12. util not utils.

Package Structure

Top Level Package Structure. Note the in-tree rst documentation.

<package>/
├── __init__.py
├── py.typed
├── index.rst
├── _abstract/
├── _docs/
   └── conf.py
   └── _static/
   └── _templates/
├── <module>/

Module Structure

Module structure is similar to top level package structure. Interfaces, protocols, simple data structures etc go into the _interface.py file.

<module>/
├── __init__.py
├── _interface_.py
├── index.rst
└── __tests/
   └── __init__.py
   └── test_{class}.py
└── __examples/