python-project-structure

Define Python project structure guidelines with modular design and explicit __all__ exports.

3|2|Updated Mar 23, 2026
One-click install
npx skills add https://github.com/wesleyegberto/software-engineering-skills --skill python-project-structure-wesleyegberto
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-project-structure
Source: https://github.com/wesleyegberto/software-engineering-skills/tree/main/plugins/python/skills/python-project-structure
Command: npx skills add https://github.com/wesleyegberto/software-engineering-skills --skill python-project-structure-wesleyegberto

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Python project organization, module architecture, and public API design. Use when setting up new projects, organizing modules, defining public interfaces with all, or planning directory layouts.

Core Features & Use Cases

  • Module cohesion and explicit interfaces with all
  • Flat directory structures and scalable layouts
  • Use cases: starting new projects, reorganizing existing code, designing library packages

Quick Start

Create a minimal, flat Python project layout (src/your_package, tests/), and expose the public API via init.py.

Frequently Asked Questions about python-project-structure

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure a Python project for scalable and maintainable code?

Use a flat directory layout with src/your_package and tests/ to structure your Python project for scalable code. This approach enforces explicit public interfaces and modular design for long-term maintainability.

What is the best way to define a public API in a Python package?

Define a public API in Python by assigning names to the __all__ variable in __init__.py. This explicitly declares exported modules and functions, hiding internal implementation details and maintaining a clear package interface.

How do I organize Python modules when reorganizing existing code?

Reorganize existing Python code by grouping related modules into a flat directory layout under src/. Focus on module cohesion and define explicit interfaces using __all__ to clarify boundaries during the refactoring process.

Where should I place tests in a Python project directory layout?

Place tests in a dedicated tests/ directory at the root of your Python project structure. This flat layout keeps testing separate from application logic while maintaining straightforward import paths to source modules.

Does a flat directory layout work for designing Python library packages?

Yes, a flat directory layout works well for designing Python library packages. It enforces modular design and uses explicit __all__ exports to define the public API, ensuring the library remains scalable and maintainable.

When should I use __all__ to manage module imports in Python?

Use __all__ in Python when setting up new projects, reorganizing code, or designing library packages. It enforces an explicit public interface, preventing unintended internal module access and ensuring a scalable architecture.