mcpField
P
pyproject-config

pyproject-config

github.com/brojonatDevelopment144 installsUpdated 2w ago
Repository

About pyproject-config

A Python project configuration template for projects using setuptools, Ruff, and pytest. It documents a src/ package layout, editable installs, and common configuration for packaging and tests.

Key features

  1. 01setuptools build configuration
  2. 02src/ package layout
  3. 03Ruff lint settings
  4. 04pytest test discovery
  5. 05Console script configuration

Use cases

  1. 01Starting a Python package with src/ layout
  2. 02Configuring linting and pytest
  3. 03Adding an executable project command

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/brojonat/llmsrules --skill pyproject-config

After installing, type/pyproject-configin Claude Code to confirm it loaded.

Details

From the project README

pyproject.toml Configuration

Standard configuration for Python projects using setuptools, ruff, and pytest.

Console Scripts

[project.scripts]
my-tool = "your_package.cli:main"

Build System (src layout)

[build-system]
requires = ["setuptools>=68.0.0"]
build-backend = "setuptools.build_meta"

[tool.setuptools]
package-dir = {"" = "src"}

[tool.setuptools.packages.find]
where = ["src"]

This enables uv pip install -e . for editable installs with a src/ layout.

Ruff

[tool.ruff]
target-version = "py313"
line-length = 100
src = ["src", "tests"]

[tool.ruff.lint]
select = ["E", "F", "I"]
ignore = ["E203", "W503"]

[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false

Pytest

[tool.pytest.ini_options]
python_files = ["test_*.py", "*_test.py", "*_tests.py"]

Project Layout

.
    pyproject.toml                  # project metadata, deps, tooling
    Makefile                        # common tasks (run, lint, test, build)
    .env.server                     # server env vars
    src/                            # application/CLI package (editable install)
        cli.py                      # Click CLI entrypoint
    server/                         # FastAPI app
        main.py                     # ASGI entrypoint
        templates/                  # Jinja2 templates
        static/                     # static assets
    data/                           # datasets and outputs
    plots/                          # generated figures

Keep a src/ layout for packages so editable installs work cleanly. Use .env.server and .env.client for local development with .env.example files alongside code.

Comments

Markdown supported