Skip to content

Commit 539992f

Browse files
committed
Add a basic development guide markdown
1 parent 0e62fff commit 539992f

5 files changed

Lines changed: 117 additions & 0 deletions

File tree

‎copier.yml‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,14 @@ include_notebooks:
142142
no: false
143143
when: "{{ include_docs }}"
144144

145+
include_dev_guide:
146+
help: Do you want to include a development guide markdown file for your repository?
147+
type: bool
148+
default: yes
149+
choices:
150+
yes: true
151+
no: false
152+
145153
include_benchmarks:
146154
help: Do you want to enable benchmarking?
147155
type: bool

‎docs/index.rst‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,5 @@ please :doc:`/source/contact`
5353
practices/sphinx
5454
practices/publishing_package
5555
practices/customizing_project
56+
practices/development_guide
5657

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
Development Guide Files
2+
===============================================================================
3+
4+
What is it? Why do it?
5+
-------------------------------------------------------------------------------
6+
7+
Development guide files are markdown files that can be used by both humans and AI agents to provide guidance on development practices within a project. They can explain high level design decisions, help ensure consistency, and describe the best practices used throughout the project. When used in combination with AI agents, these files can both optimize the development workflow (by providing overviews) and assist in maintaining high code quality standards.
8+
9+
Developers should extend this file and add information as the project progresses to capture the current state of both the code and the best practices.
10+
11+
12+
Common Sections
13+
-------------------------------------------------------------------------------
14+
15+
We recommend including sections on the following topics:
16+
17+
- Overview of the project, including how it is structured, its main components, and how it will be used.
18+
- Design "North Stars" (key guiding principles for the project's development)
19+
- How to set up the development environment
20+
- How to run tests and linting (common commands)
21+
- Repository structure (especially for projects with subdirectories)
22+
- Coding standards and style guidelines
23+
- Project specific considerations such as default units.
24+
25+
Default Information
26+
-------------------------------------------------------------------------------
27+
28+
The default DEVELOPMENT_GUIDE.md file is generated with recommendations and principles corresponding to the Python Project Template.
29+
30+
For example, the default "North Stars" provided are:
31+
- Correctness is the Top Priority.
32+
- Code should be modular and use a few consistent APIs.
33+
- Make Easy Things Easy, Hard Things Possible.
34+
- Code should follow a standard format.
35+
- Code should be documented.
36+
37+
Developers should edit any of the information in the DEVELOPMENT_GUIDE.md file to reflect their design goals and philosophy.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Agent Instructions
2+
3+
Read [DEVELOPMENT_GUIDE.md](DEVELOPMENT_GUIDE.md) before making any changes. It is the canonical reference and may include information on design principles, core abstractions, API conventions, development workflow, and best-practices.
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# {{project_name}} Development Guide
2+
3+
This document provides a guide for contributing to the development of this project, and can include information such as design principles, core abstractions, API conventions, development workflow, and best-practices.
4+
5+
## Design Goals and North Stars
6+
**CRITICAL: Always keep these design principles in mind when making changes to the project.**
7+
8+
**Correctness is the Top Priority.** The code should include thorough tests. Any approximations should be clearly documented and communicated to the user.
9+
10+
**Code should be modular and use a few consistent APIs.**
11+
12+
**Make Easy Things Easy, Hard Things Possible.** Common use cases should require minimal configuration or set up, but users should also be able to perform complex work.
13+
14+
**Code should follow a standard format** with automatic formatting supported by `ruff`.
15+
16+
**Code should be documented.** Docstrings should provide sufficient API information, such as parameter explanations, for users to understand the code.
17+
18+
19+
20+
## Common Commands
21+
22+
```bash
23+
# All tests
24+
python -m pytest
25+
26+
# Parallel tests
27+
python -m pytest -n auto
28+
29+
# Lint and format (let the linter fix style — do not hand-tune)
30+
{% if 'ruff_lint' in enforce_style or 'ruff_format' in enforce_style -%}
31+
ruff check src/ tests/
32+
ruff format src/ tests/
33+
{% endif -%}
34+
{% if 'black' in enforce_style -%}
35+
black src/
36+
black test/
37+
{% endif -%}
38+
39+
40+
# Pre-commit (runs ruff lint/format, workflow/pyproject schema checks, pytest, etc.)
41+
pre-commit run --all-files
42+
43+
{% if include_docs -%}
44+
# Build docs
45+
sphinx-build -M html ./docs ./_readthedocs
46+
{% endif -%}
47+
```
48+
49+
## Repository Structure
50+
51+
```
52+
src/{{package_name}}/ Main package
53+
tests/{{package_name}}/ Test suite
54+
{% if include_docs -%}
55+
docs/ Sphinx documentation sources
56+
{% endif -%}
57+
{% if include_benchmarks -%}
58+
benchmarks/ ASV performance benchmarks
59+
{% endif -%}
60+
```
61+
62+
63+
## Testing Conventions
64+
65+
- **File naming:** `tests/{{package_name}}/<SUBDIR>/test_<name>.py`, mirroring the `src/{{package_name}}/` layout.
66+
- **Fixtures:** defined in `tests/conftest.py`. Use existing fixtures, do not duplicate test data.
67+
- Default test run: `python -m pytest`
68+

0 commit comments

Comments
 (0)