python-project-structure

Bootstrap Python projects with a src-layout and pyproject.toml configuration.

Updated Jan 24, 2026
One-click install
npx skills add https://github.com/amaozhao/MySkills --skill python-project-structure
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-project-structure
Source: https://github.com/amaozhao/MySkills/tree/main/skills/python-project-structure
Command: npx skills add https://github.com/amaozhao/MySkills --skill python-project-structure

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill guides developers to start and structure Python projects with a robust src-layout and pyproject.toml configuration, preventing common import and packaging issues.

Core Features & Use Cases

  • Structured starter: Provides a recommended directory layout with a dedicated src/ package to prevent import conflicts.
  • Tooling setup: Demonstrates pyproject.toml configuration for modern packaging, testing, and tooling.
  • Project hygiene: Includes standard directories like tests/ and README.md to promote maintainable development practices.

Quick Start

Create a new project directory, enable the src-layout pattern, and add a pyproject.toml configuration as shown in this guide. Then initialize a basic package under src/mypackage and set up a minimal tests/ folder to validate imports.

Frequently Asked Questions about python-project-structure

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

FAQPage Schema
Why use src-layout for Python project structure?

Src-layout for Python project structure separates the package code into a src/ directory, preventing local import conflicts and ensuring tests run against the installed package. This layout promotes reliable development and maintainable project hygiene.

How do I set up pyproject.toml for a new Python project?

To set up pyproject.toml for a new Python project, create the file in your root directory and define modern packaging, testing, and tooling configurations. This replaces legacy setup.py files and establishes a standard build process.

What is the best way to bootstrap a Python project with clean imports?

The best way to bootstrap a Python project with clean imports is using a src-layout directory. Place your package under src/mypackage and add a minimal tests/ folder to validate imports, avoiding accidental local module shadowing.

Do I need a tests directory when using src-layout in Python?

Yes, when using src-layout in Python, a dedicated tests/ directory is recommended. It promotes maintainable development practices by keeping test files separate and ensuring they validate the installed package rather than local source files.

Can I restructure an existing Python codebase to use src-layout and pyproject.toml?

Yes, you can restructure an existing Python codebase to use src-layout and pyproject.toml. Moving your code into a src/ directory and updating your configuration file resolves import conflicts and modernizes your project tooling.

What to include in a Python project scaffold for reliable development?

A Python project scaffold for reliable development should include a src/ directory for package code, a pyproject.toml for modern configuration, a tests/ folder for validation, and a README.md to promote maintainable project hygiene.