Add context manifest and reference documentation
- ContextManifest.md: URLs for recreating external context dependencies - KeepaContributingfile.md: Keep a Contributing-File V0.0.1 format reference - KeepaTodofile.md: Keep a Todofile V0.0.1 format reference - PythonVibes.md: Python project best practices reference These files preserve the external documentation standards used throughout the project for reproducible context and consistent agent behavior. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
4
context/ContextManifest.md
Normal file
4
context/ContextManifest.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
KeepaContributingfile.md: https://coulomb.social/open/KeepaContributingfile
|
||||||
|
KeepaTodofile.md: https://coulomb.social/open/KeepaTodofile
|
||||||
|
PythonVibes.md: https://coulomb.social/open/PythonVibes
|
||||||
|
|
||||||
152
context/KeepaContributingfile.md
Normal file
152
context/KeepaContributingfile.md
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
# keep a contributing file
|
||||||
|
|
||||||
|
*Don't accept broken windows and keep you codebase organized.*
|
||||||
|
|
||||||
|
# Version 0.0.1
|
||||||
|
|
||||||
|
~~~
|
||||||
|
|
||||||
|
# Contributing
|
||||||
|
|
||||||
|
This is a Contributing file, used to specify how the repository is and should stay organized.
|
||||||
|
|
||||||
|
The format is based on [Keep a Contributing-File V0.0.1](https://coulomb.social/open/KeepaContributingfile).
|
||||||
|
|
||||||
|
The structure originates from best practices for setting up python repositories as documented for [PythonVibes](https://coulomb.social/open/PythonVibes).
|
||||||
|
|
||||||
|
Use agent-keepa-contributing-file.md to help maintaining this file.
|
||||||
|
|
||||||
|
This document outlines how to get started, how we organise work, and how to help maintain the quality & clarity of our contributions.
|
||||||
|
|
||||||
|
*Thank you for your interest in contributing!*
|
||||||
|
|
||||||
|
***
|
||||||
|
|
||||||
|
TODO: add sensible boilerplate...
|
||||||
|
|
||||||
|
~~~
|
||||||
|
|
||||||
|
## What is a contributing file?
|
||||||
|
A CONTRIBUTING.md file is a dedicated document, typically written in Markdown and placed in the root directory of a software repository (often alongside the README.md and LICENSE files).
|
||||||
|
|
||||||
|
It serves as a guide, roadmap, and welcome mat for anyone interested in helping develop the project. It outlines the specific rules, expectations, and steps for different types of contributions, which can include:
|
||||||
|
- Reporting bugs
|
||||||
|
- Suggesting new features
|
||||||
|
- Submitting code changes (via Pull Requests)
|
||||||
|
- Improving documentation
|
||||||
|
|
||||||
|
When a contributor initiates an issue or a pull request on platforms like GitHub, a direct link to the CONTRIBUTING.md file is often displayed, making it immediately visible.
|
||||||
|
|
||||||
|
## Why keep a contributing file?
|
||||||
|
The main reasons for maintaining a contributing file are to streamline workflow and foster a healthy community:
|
||||||
|
- Lower Barrier to Entry: It provides clear, step-by-step instructions, making the first contribution less intimidating for newcomers.
|
||||||
|
- Improve Quality: It sets expectations for code style, testing, and documentation, ensuring submissions meet the project's standards.
|
||||||
|
- Reduce Maintainer Burden: It answers frequently asked questions (FAQs) about the process, reducing the time maintainers spend clarifying how to contribute.
|
||||||
|
- Set Standards/Tone: It establishes a professional tone and often links to the Code of Conduct, clearly defining behavioral expectations for the community.
|
||||||
|
- Define Contribution Types: It clarifies that contributions aren't just code—documentation, testing, design, and feedback are also welcome.
|
||||||
|
- Provide Recognition: It can explain how contributors are acknowledged, encouraging continued participation.
|
||||||
|
|
||||||
|
## Who needs a contributing file?
|
||||||
|
Essentially, anyone who could potentially be involved with your project beyond simply using it:
|
||||||
|
- Potential Contributors: They need a roadmap for submitting high-quality work without wasting time on incorrect formatting or workflow.
|
||||||
|
- Core Maintainers: They need a single, consistent reference point to direct users to, ensuring all contributions adhere to the same process.
|
||||||
|
- New Team Members: They need to quickly onboard to the project's internal development standards (e.g., branching, testing, commit message style).
|
||||||
|
- Users Reporting Issues: They need guidance on providing complete and actionable bug reports (e.g., environment details, reproduction steps).
|
||||||
|
|
||||||
|
## How do I make a good contributing file?
|
||||||
|
A good CONTRIBUTING.md is friendly, concise, and structured. It should prioritize clarity over complexity.
|
||||||
|
|
||||||
|
### Guiding Principles
|
||||||
|
|
||||||
|
#### Welcome & Code of Conduct:
|
||||||
|
- Start with a friendly thank you and a clear statement that contributions are welcome.
|
||||||
|
- Must include a link to the project's CODE_OF_CONDUCT.md file (if one exists).
|
||||||
|
|
||||||
|
#### Types of Contributions:
|
||||||
|
- List the different ways people can help: Code, Documentation, Reporting Issues, Feature Requests, Design.
|
||||||
|
|
||||||
|
#### Getting Started (Development Setup):
|
||||||
|
- Provide the necessary technical steps:
|
||||||
|
- How to fork and clone the repository.
|
||||||
|
- How to set up the virtual environment and install dependencies (e.g., poetry install or pip install -r requirements.txt).
|
||||||
|
|
||||||
|
#### Issue Reporting Guidelines:
|
||||||
|
- Explain what to include in a bug report (e.g., version, OS, clear steps to reproduce).
|
||||||
|
- Point to (or embed) an Issue Template if you use one.
|
||||||
|
|
||||||
|
#### Pull Request (PR) Submission Workflow:
|
||||||
|
- Detail the expected workflow: Create a new branch, keep it up to date with main, ensure tests pass.
|
||||||
|
- Testing: How to run the test suite locally (pytest).
|
||||||
|
- Coding Style: Specify the standards (e.g., PEP 8) and the tools used (e.g., "Run black . and ruff . before committing").
|
||||||
|
- Commit Messages: Define the required format (e.g., Conventional Commits).
|
||||||
|
|
||||||
|
#### Contact & Communication:
|
||||||
|
- List channels for questions or discussion (e.g., Slack, Discord, Mailing List, GitHub Discussions).
|
||||||
|
|
||||||
|
### How can I reduce the effort required to maintain a contributing file?
|
||||||
|
You can significantly reduce the effort required to maintain a contributing file by using automation, templating, and strategic delegation.
|
||||||
|
|
||||||
|
#### Link to Standard Tools
|
||||||
|
Instead of writing out detailed style guides (e.g., how to use Black or Ruff), simply state the project uses those tools and link to the tool's official documentation or your project's pyproject.toml file where the configuration lives. This delegates the burden of explaining technical standards.
|
||||||
|
|
||||||
|
#### Use GitHub/GitLab Templates
|
||||||
|
Use the platform's native Issue and Pull Request templates (.github/ISSUE_TEMPLATE.md, etc.). Your CONTRIBUTING.md should then only link to these files, not replicate their content. If you update a template, you don't need to update the main contributing guide.
|
||||||
|
|
||||||
|
#### Reference External Documentation
|
||||||
|
For complex topics like your development environment setup or architecture, create separate, dedicated documents (e.g., DEVELOPMENT.md) and only link to them from your CONTRIBUTING.md. This keeps the primary file concise and easy to update.
|
||||||
|
|
||||||
|
#### Keep it High-Level
|
||||||
|
Focus the CONTRIBUTING.md on the workflow and expectations (the "why" and "when"), and leave the how-to details for the files maintained by the tools themselves.
|
||||||
|
|
||||||
|
### Can contributing files be bad?
|
||||||
|
|
||||||
|
Yes, a poorly constructed or maintained contributing file can actually be detrimental to a project.
|
||||||
|
|
||||||
|
#### 1. Outdated or Inaccurate Information
|
||||||
|
If the guide describes a workflow or tool the project no longer uses (e.g., referencing a dependency manager that was replaced), it leads to contributor frustration and wastes their time, making them less likely to contribute again.
|
||||||
|
|
||||||
|
#### 2. Being Too Demanding or Intimidating
|
||||||
|
Overly long, bureaucratic, or complex documents with dozens of rigid rules can scare away new contributors. The file should be a welcome mat, not an obstacle course.
|
||||||
|
|
||||||
|
#### 3. Unwelcoming Tone
|
||||||
|
If the file is written in a harsh, overly formal, or demanding tone, it can convey that the project is unfriendly or closed to external ideas, immediately damaging community morale.
|
||||||
|
|
||||||
|
#### 4. Lack of Templates
|
||||||
|
If the file demands specific information for bug reports but doesn't provide a template, contributors are likely to submit incomplete or unstructured issues, increasing the burden on maintainers.
|
||||||
|
|
||||||
|
*There's more*: Help me collect these antipatterns by *opening an issue* or a *pull request*.
|
||||||
|
|
||||||
|
TODO: setup keep-a-contributingfile as a repo with proper domain and issue tracking.
|
||||||
|
|
||||||
|
## Frequently Asked Questions
|
||||||
|
|
||||||
|
### Is there a standard contributing file format?
|
||||||
|
Yes, Markdown (.md) is the universal standard format.
|
||||||
|
|
||||||
|
### What should the contributing file be named?
|
||||||
|
CONTRIBUTING.md (usually capitalized).
|
||||||
|
|
||||||
|
### How can I contribute?
|
||||||
|
|
||||||
|
This document is not the truth; it’s my carefully considered opinion, along with information and examples I gathered.
|
||||||
|
|
||||||
|
This is because I want our community to reach a consensus. I believe the discussion is as important as the end result.
|
||||||
|
|
||||||
|
So please *pitch in*.
|
||||||
|
|
||||||
|
TODO: setup zulip space to collect feedback and improvements.
|
||||||
|
|
||||||
|
## Conversations
|
||||||
|
|
||||||
|
Discussions and ideas round and about [CoulombSocial](https://coulomb.social) spiked this manifest. Let's keep
|
||||||
|
integrating and refining to make this useful as can be. Feel free to check out how to cocreate and engage with
|
||||||
|
the community there.
|
||||||
|
|
||||||
|
## Kudos
|
||||||
|
|
||||||
|
Thanks to [Oliver Lacan](https://olivierlacan.com/) for providing the inspiriation to try and establish a baseline for keeping
|
||||||
|
repositories organized with a contributing file. I hope some of us will find it useful.
|
||||||
|
|
||||||
|
This manifest adapts the excellent principles of [keepachangelog.com](https://keepachangelog.com) for maintaining a shared mental model in a fast-paced coding session. If you **"Keep a TODO Manifest"** (let's call it `TODO.md`), you establish a clear, structured shortterm plan that both the human coder and the coding assistant can use as the single source of truth for what to do next.
|
||||||
|
|
||||||
|
xxx
|
||||||
172
context/KeepaTodofile.md
Normal file
172
context/KeepaTodofile.md
Normal file
@@ -0,0 +1,172 @@
|
|||||||
|
# keep a todofile
|
||||||
|
|
||||||
|
*Don't let your mind or coding agent loose context and mess up your coding flow.*
|
||||||
|
|
||||||
|
# Version 0.0.1
|
||||||
|
|
||||||
|
~~~
|
||||||
|
|
||||||
|
# Todofile
|
||||||
|
|
||||||
|
This is a "to do next" file, particularly useful to keep the human and a coding assistant in sync.
|
||||||
|
|
||||||
|
The format is based on [Keep a Todofile V0.0.1](https://coulomb.social/open/KeepaTodofile).
|
||||||
|
|
||||||
|
The structure organizes **future tasks** by their impact, just as a changelog organizes past changes by their impact.
|
||||||
|
|
||||||
|
***
|
||||||
|
|
||||||
|
## Keep a TODO Manifest Structure (TODO.md)
|
||||||
|
|
||||||
|
The document should always have an **Unreleased** section for immediate, in-progress, or newly discovered tasks, and then ordered sections for future planned versions.
|
||||||
|
|
||||||
|
### **\[Unreleased\]** - *Active Vibe-Coding State* 💡
|
||||||
|
|
||||||
|
This section is for tasks currently being discussed with or worked on by the coding assistant. These are the ephemeral, flow-of-thought tasks.
|
||||||
|
|
||||||
|
* **To Add:**
|
||||||
|
* Implement the `getUserProfile()` function in the `data-service.js` file.
|
||||||
|
* Add a temporary mock data endpoint for the dashboard widget.
|
||||||
|
* **To Refactor:**
|
||||||
|
* Change the variable name `d` to `dataObject` in the primary API handler.
|
||||||
|
* **To Fix:**
|
||||||
|
* The `LoginButton` component flashes briefly on mount due to missing key prop.
|
||||||
|
* **To Remove:**
|
||||||
|
* Delete the unused `legacy-utils.ts` file before committing.
|
||||||
|
|
||||||
|
***
|
||||||
|
|
||||||
|
## **\[0.1.0\] - Short-Term Feature Commit** - *First Planned Increment*
|
||||||
|
|
||||||
|
This version represents the first set of concrete, planned features and cleanup tasks you aim to complete before the next logical interruption or commit boundary.
|
||||||
|
|
||||||
|
### **To Add**
|
||||||
|
* Implement **User Authentication** via basic email/password (stubbed out for now).
|
||||||
|
* Create the initial **Dashboard View** with three empty placeholder widgets.
|
||||||
|
* Add **Input Validation** library (`yup` or similar) to the project dependencies.
|
||||||
|
|
||||||
|
### **To Refactor**
|
||||||
|
* Migrate all configuration constants from inline code to a central **`config.json`** file.
|
||||||
|
* Rename the core service class from `CoreLogic` to **`TaskProcessor`** for better clarity.
|
||||||
|
|
||||||
|
### **To Fix**
|
||||||
|
* Resolve the **environment variable loading issue** that prevents the database connection from starting in development mode.
|
||||||
|
* Ensure that all API responses correctly use a **snake\_case** naming convention for JSON keys, not camelCase.
|
||||||
|
|
||||||
|
### **To Deprecate**
|
||||||
|
* Plan to remove the older **`POST /api/v0/task`** endpoint entirely in version 0.2.0, in favor of the new, more flexible `POST /api/v1/tasks` endpoint.
|
||||||
|
|
||||||
|
### **To Secure**
|
||||||
|
* Set up a basic **CORS configuration** to allow requests only from `localhost:3000`.
|
||||||
|
|
||||||
|
### **To Remove**
|
||||||
|
* Delete the boilerplate **README.md** content and replace it with project-specific documentation and setup instructions.
|
||||||
|
|
||||||
|
~~~
|
||||||
|
|
||||||
|
## What is a todofile?
|
||||||
|
A simple, usually plain text or Markdown file (TODO.md), located within a project's source code, that explicitly lists uncompleted tasks, required fixes, refactorings, and next steps for the current development effort.
|
||||||
|
|
||||||
|
## Why keep a todofile?
|
||||||
|
To offload mental state, maintain focus during coding flow ("vibe coding"), and create a single, shared, immediately accessible source of truth for both the human coder and any coding assistant regarding the project's most immediate and granular future state.
|
||||||
|
|
||||||
|
## Who needs a todofile?
|
||||||
|
The individual developer (especially when working alone or in short, intense sessions) and, critically in the modern workflow, any AI coding assistant that needs to maintain context and contribute to the immediate, next-step plan.
|
||||||
|
|
||||||
|
## How do I make a good todofile?
|
||||||
|
|
||||||
|
### Guiding Principles
|
||||||
|
- For Humans & AI: The TODO.md is the single source of truth for the current development state and immediate next steps.
|
||||||
|
- Track by Impact: Group future tasks by the nature of the change they will introduce (e.g., To Add, To Fix, To Refactor).
|
||||||
|
- Context over Content: Use in-code // TODO: comments for highly specific, localized reminders.
|
||||||
|
- Offload the Brain: Use the manifest to capture every thought, ensuring nothing is lost during an interruption.
|
||||||
|
- Offload the Manifest: Keep your coding session bounded. Instead of following sidetracks immediately create issues.
|
||||||
|
- Maintain the Untracked: Always keep an [Untracked] section for tasks that are actively in progress or discovered during the current coding session.
|
||||||
|
- Version the Plan: Organize future steps into planned versions (e.g., [0.2.0]) to create clear commit boundaries using issues.
|
||||||
|
|
||||||
|
### Types of Todos
|
||||||
|
- *Added* for new features.
|
||||||
|
- *Changed* for changes in existing functionality.
|
||||||
|
- *Deprecated* for soon-to-be removed features.
|
||||||
|
- *Removed* for now removed features.
|
||||||
|
- *Fixed* for any bug fixes.
|
||||||
|
- *Security* in case of vulnerabilities.
|
||||||
|
|
||||||
|
### How can I reduce the effort required to maintain a todofile?
|
||||||
|
|
||||||
|
Use In-Code TODO Comments: Use standard comments (e.g., // TODO:, # FIXME:) for specific, localized, and temporary tasks. This eliminates context switching and places the task exactly where the work needs to be done.
|
||||||
|
|
||||||
|
Leverage IDE/Tooling: Use editor extensions (like VS Code's "Todo Tree") that automatically scan and consolidate these in-code comments into a single navigable list, effectively turning scattered notes into a central manifest without manual copy-pasting.
|
||||||
|
|
||||||
|
Maintain Only the Immediate: Keep the dedicated TODO.md file focused primarily on the [Unreleased] section, covering only the highest-level tasks or the immediate "next steps." Once a major feature is complete, delete the related tasks rather than moving them elsewhere.
|
||||||
|
|
||||||
|
Delegate to the AI Assistant: Explicitly instruct your coding assistant to read, update, and resolve items in the TODO.md file. By making the file the single source of truth, you pass the maintenance burden of tracking state to the tool.
|
||||||
|
|
||||||
|
Keep Format Minimal: Stick to a simple Markdown checklist format. Avoid complex tooling (like a separate issue tracker for short-term tasks) that requires external steps or login credentials.
|
||||||
|
|
||||||
|
### Can todofiles be bad?
|
||||||
|
|
||||||
|
Yes. Here are a few ways they can be less than useful. The goal of a maintaining a TODO.md is to foster flow, but several common mistakes turn it into a source of friction and "technical debt." Here are common anti-patterns that hinder more than help with todofiles:
|
||||||
|
|
||||||
|
#### 1. The Invisible Backlog (The Graveyard)
|
||||||
|
- Antipattern: Committing a massive number of unaddressed // TODO: comments into the main codebase.
|
||||||
|
- Hinderance: These scattered, unprioritized items form an "invisible backlog" that no one actively manages. They quickly become stale, confusing, and are rarely addressed, leading to developers ignoring all TODO comments.
|
||||||
|
|
||||||
|
#### 2. Vague or Contextless Tasks
|
||||||
|
- Antipattern: Writing ambiguous entries that lack context.
|
||||||
|
- Example in Code: // TODO: fix this later
|
||||||
|
- Example in File: - [ ] Dashboard data
|
||||||
|
- Hinderance: When you return after an interruption (or a few days), you and the AI assistant have to spend time deciphering what the original problem was, defeating the purpose of offloading memory.
|
||||||
|
|
||||||
|
#### 3. The Duplicated Tracker
|
||||||
|
- Antipattern: Maintaining a long, detailed list of tasks in the TODO.md that exactly mirrors an external system (like Gitea, Jira, Trello, or GitHub Issues).
|
||||||
|
- Hinderance: This creates maintenance overhead. The two lists inevitably drift out of sync, leading to confusion about which is the source of truth, and wasting time copying and pasting between systems.
|
||||||
|
|
||||||
|
#### 4. Long-Term Planning in the Flow Tool
|
||||||
|
- Antipattern: Using the immediate TODO.md manifest to plan work that is months away or requires product management sign-off (e.g., v3.0 features).
|
||||||
|
- Hinderance: The document becomes cluttered, making it difficult to see the genuinely urgent and immediate next steps. The focus tool is turned into a long-term project planning tool, which it is ill-suited for.
|
||||||
|
|
||||||
|
#### 5. Poorly Defined Boundaries
|
||||||
|
- Antipattern: Not clearly differentiating between the two types of tasks:
|
||||||
|
- Flow State: The temporary // TODO: comment that should be resolved before the current feature is considered "done."
|
||||||
|
- Commit Boundary: The high-level task in TODO.md that marks the next logical piece of work.
|
||||||
|
- Hinderance: The coder struggles to know when a task should be moved, deleted, or transferred to the formal issue tracker, leading to tasks getting stuck in the TODO.md limbo.
|
||||||
|
|
||||||
|
*There's more*: Help me collect these antipatterns by *opening an issue* or a *pull request*.
|
||||||
|
|
||||||
|
TODO: setup keep-a-todofile as a repo with proper domain and issue tracking.
|
||||||
|
|
||||||
|
## Frequently Asked Questions
|
||||||
|
|
||||||
|
### Is there a standard todofile format?
|
||||||
|
There is no official standard, but the common and most effective format is a simple Markdown checklist (using [ ] for pending and [x] for complete), often organized by category (e.g., To Fix, To Add, To Refactor) and version.
|
||||||
|
|
||||||
|
### What should the todofile be named?
|
||||||
|
Common and recognizable names are TODO.md or NEXT.md (or .txt). Using a simple name with the .md extension ensures it's easily read, recognized by IDEs, and accessible to coding assistants for context.
|
||||||
|
|
||||||
|
### When should the todofile be pruned and rewritten?
|
||||||
|
The TODO.md should be pruned (removing or transferring resolved items) and potentially rewritten at the end of a coding session when commiting to the repo. At the latest it needs to be updated when merging the current branch or finishing major feature implementation, before a significant commit/merge (e.g., to main), or when starting a new major version increment (e.g., moving from v0.1.0 to v0.2.0).
|
||||||
|
|
||||||
|
### How can I contribute?
|
||||||
|
|
||||||
|
This document is not the truth; it’s my carefully considered opinion, along with information and examples I gathered.
|
||||||
|
|
||||||
|
This is because I want our community to reach a consensus. I believe the discussion is as important as the end result.
|
||||||
|
|
||||||
|
So please *pitch in*.
|
||||||
|
|
||||||
|
TODO: setup zulip space to collect feedback and improvements.
|
||||||
|
|
||||||
|
## Conversations
|
||||||
|
|
||||||
|
Discussions and ideas round and about [CoulombSocial](https://coulomb.social) spiked this manifest. Let's keep
|
||||||
|
integrating and refining to make this useful as can be. Feel free to check out how to cocreate and engage with
|
||||||
|
the community there.
|
||||||
|
|
||||||
|
## Kudos
|
||||||
|
|
||||||
|
Thanks to [Oliver Lacan](https://olivierlacan.com/) for providing the inspiriation to try and establish a baseline for staying
|
||||||
|
on track with a todofile. I hope some of us will find it useful.
|
||||||
|
|
||||||
|
This manifest adapts the excellent principles of [keepachangelog.com](https://keepachangelog.com) for maintaining a shared mental model in a fast-paced coding session. If you **"Keep a TODO Manifest"** (let's call it `TODO.md`), you establish a clear, structured shortterm plan that both the human coder and the coding assistant can use as the single source of truth for what to do next.
|
||||||
|
|
||||||
281
context/PythonVibes.md
Normal file
281
context/PythonVibes.md
Normal file
@@ -0,0 +1,281 @@
|
|||||||
|
PythonVibes is a repository template to build vibe coding projects from.
|
||||||
|
It roughly follows the following best practices for organizing python repositories.
|
||||||
|
|
||||||
|
# Python Project Repository Best Practice Guide
|
||||||
|
|
||||||
|
> **Purpose**
|
||||||
|
> This guide defines the best practices for structuring, documenting, and maintaining Python repositories.
|
||||||
|
> It is based on official Python standards (PEPs) and widely adopted community conventions.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 1. Version Control as a Foundation
|
||||||
|
|
||||||
|
**Use Git for all projects.**
|
||||||
|
|
||||||
|
### Key Practices
|
||||||
|
- Initialize every project with Git (`git init` or `gh repo create`).
|
||||||
|
- Commit logical units of work with meaningful messages.
|
||||||
|
- Exclude irrelevant files using a `.gitignore` (e.g., from [GitHub’s Python.gitignore](https://github.com/github/gitignore)).
|
||||||
|
- Use [Semantic Versioning](https://semver.org/) for tagging releases.
|
||||||
|
|
||||||
|
**Reference:**
|
||||||
|
- [PEP 440 – Version Identification and Dependency Specification](https://peps.python.org/pep-0440/)
|
||||||
|
|
||||||
|
**Rationale:**
|
||||||
|
Version control ensures traceability, collaboration, and reproducibility — the foundation for CI/CD and team workflows.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2. Environment Isolation
|
||||||
|
|
||||||
|
**Always develop inside a virtual environment.**
|
||||||
|
|
||||||
|
### Recommended Tools
|
||||||
|
- Standard library: `python -m venv .venv`
|
||||||
|
- Modern environment managers: [Poetry](https://python-poetry.org/), [PDM](https://pdm.fming.dev/), [Conda](https://docs.conda.io/)
|
||||||
|
|
||||||
|
**Rationale:**
|
||||||
|
Virtual environments prevent dependency conflicts and ensure consistent behavior across systems.
|
||||||
|
|
||||||
|
**Reference:**
|
||||||
|
- [Python Packaging User Guide – Creating and Using Virtual Environments](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3. Dependency Management and Locking
|
||||||
|
|
||||||
|
**Explicitly declare and lock dependencies.**
|
||||||
|
|
||||||
|
### Options
|
||||||
|
- `pyproject.toml` (modern, [PEP 621](https://peps.python.org/pep-0621/))
|
||||||
|
- `requirements.txt` (legacy but widely supported)
|
||||||
|
- `Pipfile` / `Pipfile.lock` (for Pipenv)
|
||||||
|
|
||||||
|
**Rationale:**
|
||||||
|
Explicit dependency declaration ensures anyone can reproduce the project environment exactly.
|
||||||
|
|
||||||
|
**Example:**
|
||||||
|
```bash
|
||||||
|
pip install --no-cache-dir -r requirements.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 4. Recommended Directory Layout
|
||||||
|
|
||||||
|
**Follow a clear, standardized project structure.**
|
||||||
|
|
||||||
|
```
|
||||||
|
project-name/
|
||||||
|
├── src/
|
||||||
|
│ └── project_name/
|
||||||
|
│ ├── __init__.py
|
||||||
|
│ ├── core.py
|
||||||
|
│ └── utils.py
|
||||||
|
├── tests/
|
||||||
|
│ ├── __init__.py
|
||||||
|
│ └── test_core.py
|
||||||
|
├── docs/
|
||||||
|
├── .github/
|
||||||
|
│ └── workflows/
|
||||||
|
├── .gitignore
|
||||||
|
├── LICENSE
|
||||||
|
├── pyproject.toml
|
||||||
|
├── README.md
|
||||||
|
└── requirements.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
**Reference:**
|
||||||
|
- [The Hitchhiker’s Guide to Python – Structuring Your Project](https://docs.python-guide.org/writing/structure/)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 5. Essential Repository Files
|
||||||
|
|
||||||
|
| File | Purpose |
|
||||||
|
|------|----------|
|
||||||
|
| `README.md` | Overview, installation, usage, and examples |
|
||||||
|
| `LICENSE` | Defines distribution and usage rights |
|
||||||
|
| `.gitignore` | Prevents committing build and environment artifacts |
|
||||||
|
| `pyproject.toml` | Declares project metadata and dependencies |
|
||||||
|
| `CHANGELOG.md` | Documents version history ([Keep a Changelog](https://keepachangelog.com/en/1.1.0/)) |
|
||||||
|
| `CONTRIBUTING.md` | Provides guidelines for contributors |
|
||||||
|
|
||||||
|
**Optional:**
|
||||||
|
- `CODE_OF_CONDUCT.md` — defines community expectations
|
||||||
|
- `Makefile` — simplifies common commands
|
||||||
|
- `.env.example` — documents environment variables
|
||||||
|
|
||||||
|
**Reference:**
|
||||||
|
- [PEP 518 – pyproject.toml Build System Configuration](https://peps.python.org/pep-0518/)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 6. Testing and Quality Assurance
|
||||||
|
|
||||||
|
**Automate tests and integrate them early.**
|
||||||
|
|
||||||
|
### Best Practices
|
||||||
|
- Use [pytest](https://docs.pytest.org/) for tests and fixtures.
|
||||||
|
- Maintain a `tests/` directory at the root of the repository.
|
||||||
|
- Measure coverage with `pytest --cov=package_name`.
|
||||||
|
|
||||||
|
**Reference:**
|
||||||
|
- [PEP 8 – Style Guide for Python Code](https://peps.python.org/pep-0008/#programming-recommendations)
|
||||||
|
- [Testing Guidelines – Pytest Documentation](https://docs.pytest.org/en/stable/goodpractices.html)
|
||||||
|
|
||||||
|
**Example CI Integration (GitHub Actions):**
|
||||||
|
```yaml
|
||||||
|
name: Python CI
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: '3.11'
|
||||||
|
- run: pip install -r requirements.txt
|
||||||
|
- run: pytest --maxfail=1 --disable-warnings -q
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 7. Code Style, Linting, and Type Checking
|
||||||
|
|
||||||
|
**Maintain a consistent, readable, and typed codebase.**
|
||||||
|
|
||||||
|
### Tools
|
||||||
|
| Task | Recommended Tool |
|
||||||
|
|------|------------------|
|
||||||
|
| Code formatting | [Black](https://black.readthedocs.io/en/stable/) |
|
||||||
|
| Linting | [Ruff](https://docs.astral.sh/ruff/) or [Flake8](https://flake8.pycqa.org/en/latest/) |
|
||||||
|
| Import sorting | [isort](https://pycqa.github.io/isort/) |
|
||||||
|
| Type checking | [mypy](https://mypy.readthedocs.io/en/stable/) |
|
||||||
|
|
||||||
|
**Reference:**
|
||||||
|
- [PEP 8 – Style Guide for Python Code](https://peps.python.org/pep-0008/)
|
||||||
|
- [PEP 484 – Type Hints](https://peps.python.org/pep-0484/)
|
||||||
|
|
||||||
|
**Example pre-commit configuration:**
|
||||||
|
```yaml
|
||||||
|
repos:
|
||||||
|
- repo: https://github.com/psf/black
|
||||||
|
rev: 24.3.0
|
||||||
|
hooks: [{ id: black }]
|
||||||
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
|
rev: v0.1.0
|
||||||
|
hooks: [{ id: ruff }]
|
||||||
|
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||||
|
rev: v1.10.0
|
||||||
|
hooks: [{ id: mypy }]
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 8. Documentation and Docstrings
|
||||||
|
|
||||||
|
**Write documentation that grows with your codebase.**
|
||||||
|
|
||||||
|
### Recommendations
|
||||||
|
- Use descriptive docstrings following [PEP 257](https://peps.python.org/pep-0257/).
|
||||||
|
- Use [reStructuredText](https://docutils.sourceforge.io/rst.html) or Markdown for documentation.
|
||||||
|
- Consider [Sphinx](https://www.sphinx-doc.org/) or [MkDocs](https://www.mkdocs.org/) for documentation sites.
|
||||||
|
- Use type hints for better auto-documentation and IDE support.
|
||||||
|
|
||||||
|
**Rationale:**
|
||||||
|
Readable, up-to-date documentation enhances maintainability and team onboarding.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 9. Continuous Integration and Deployment (CI/CD)
|
||||||
|
|
||||||
|
**Automate quality checks and deployments.**
|
||||||
|
|
||||||
|
### Best Practices
|
||||||
|
- Use CI workflows to run tests, linting, and builds automatically.
|
||||||
|
- Enforce required checks before merging pull requests.
|
||||||
|
- Use environment variables for secrets; avoid storing credentials in code.
|
||||||
|
- Optionally integrate publishing with PyPI (`twine upload dist/*`).
|
||||||
|
|
||||||
|
**Reference:**
|
||||||
|
- [GitHub Actions Documentation](https://docs.github.com/en/actions)
|
||||||
|
- [Python Packaging Authority – Publishing Projects](https://packaging.python.org/en/latest/tutorials/packaging-projects/)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 10. Project Metadata and Packaging
|
||||||
|
|
||||||
|
**Provide standardized metadata using `pyproject.toml`.**
|
||||||
|
|
||||||
|
Example:
|
||||||
|
```toml
|
||||||
|
[project]
|
||||||
|
name = "example-project"
|
||||||
|
version = "0.1.0"
|
||||||
|
description = "A well-structured Python project template"
|
||||||
|
readme = "README.md"
|
||||||
|
requires-python = ">=3.10"
|
||||||
|
license = { text = "MIT" }
|
||||||
|
authors = [{ name = "Example Author", email = "author@example.com" }]
|
||||||
|
dependencies = ["requests", "pytest"]
|
||||||
|
|
||||||
|
[tool.black]
|
||||||
|
line-length = 88
|
||||||
|
```
|
||||||
|
|
||||||
|
**References:**
|
||||||
|
- [PEP 621 – Project Metadata in pyproject.toml](https://peps.python.org/pep-0621/)
|
||||||
|
- [PEP 517 – Build System Interface](https://peps.python.org/pep-0517/)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 11. Optional Enhancements
|
||||||
|
|
||||||
|
| Enhancement | Purpose | Recommended Tools |
|
||||||
|
|--------------|----------|--------------------|
|
||||||
|
| Containerization | Reproducible environments | Docker, Podman |
|
||||||
|
| Task Automation | Streamline workflows | Makefile, [Taskfile](https://taskfile.dev) |
|
||||||
|
| Secrets Management | Secure configuration | `.env`, [python-dotenv](https://pypi.org/project/python-dotenv/) |
|
||||||
|
| Static Analysis | Detect potential issues | [Bandit](https://bandit.readthedocs.io/) |
|
||||||
|
| Code Metrics | Assess maintainability | [Radon](https://pypi.org/project/radon/) |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 12. Checklist for a High-Quality Python Repository
|
||||||
|
|
||||||
|
| Category | Practice | Tools / Standards |
|
||||||
|
|-----------|-----------|-------------------|
|
||||||
|
| Version Control | Git, semantic versioning | Git, SemVer |
|
||||||
|
| Environment Isolation | Virtual environments | venv, Poetry |
|
||||||
|
| Dependencies | Explicit, reproducible | pyproject.toml |
|
||||||
|
| Structure | Clear, modular | src layout |
|
||||||
|
| Testing | Automated | pytest, coverage |
|
||||||
|
| Style | Consistent, typed | Black, Ruff, mypy |
|
||||||
|
| Documentation | Comprehensive | Sphinx, Markdown |
|
||||||
|
| CI/CD | Automated validation | GitHub Actions |
|
||||||
|
| Metadata | Standardized | PEP 621 |
|
||||||
|
| Licensing | Defined rights | OSI-approved licenses |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**References (Summary):**
|
||||||
|
- [PEP 8 – Style Guide for Python Code](https://peps.python.org/pep-0008/)
|
||||||
|
- [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||||
|
- [PEP 484 – Type Hints](https://peps.python.org/pep-0484/)
|
||||||
|
- [PEP 517 & 518 – Build System Interface](https://peps.python.org/pep-0517/)
|
||||||
|
- [PEP 621 – Project Metadata in pyproject.toml](https://peps.python.org/pep-0621/)
|
||||||
|
- [Python Packaging User Guide](https://packaging.python.org/)
|
||||||
|
- [Pytest Good Practices](https://docs.pytest.org/en/stable/goodpractices.html)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> **Summary:**
|
||||||
|
> A Python project repository should be *structured, reproducible, testable, documented, and automated*.
|
||||||
|
> Following these conventions ensures maintainability, scalability, and professional collaboration across teams and time.
|
||||||
|
|
||||||
|
xxx
|
||||||
Reference in New Issue
Block a user