蟒蛇初始化
- 作者仓库星标 0
- 作者仓库 skills-registry
- 领域
- 通用
- 作者声明的智能体
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 运行环境证据
- 未执行;当前没有隔离运行测试证据
- 作者 / 版本 / 许可证
- @tomevault-io · 未声明许可证
- 上下文用量评级
- 低消耗
- 接入复杂程度
- 即装即用
- 是否需要外部接口密钥
- 不需要
- 兼容的系统
- 未声明(默认跨平台)
- 运行环境要求
- Python
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- 网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
需要注意: 未声明工具权限范围;实际权限由运行环境决定。
# Python Project Initializer
Scaffold a new Python project using modern conventions. The output is a ready-to-use
repository with a `pyproject.toml`-based build, src layout, dev tooling, and
pre-configured instructions for coding agents.
## What Gets Created
```
<project-name>/
src/
<package_name>/
__init__.py
py.typed
tests/
__init__.py
test_placeholder.py
.github/
workflows/
ci.yaml
pyproject.toml
README.md
LICENSE
.gitignore
.python-version
CLAUDE.md
AGENTS.md
```
## Step-by-Step
### 1. Gather Information
You need at minimum:
- **Project name** (kebab-case, used for the repo directory and package distribution name)
- **Package name** (snake_case, used for the importable Python package — default: project name with hyphens replaced by underscores)
- **One-line description**
- **Python version** (default: `3.11`; prefer 3.11+ for modern typing syntax)
Optional:
- License (default: MIT)
- Initial dependencies
- Whether it's a CLI tool (adds a `[project.scripts]` entry)
- Author name and email
### 2. Create the Project
Read the templates in `templates/` and references in `references/` for content.
Adapt templates based on user answers from step 1.
Key files and their purposes:
#### pyproject.toml
Refer to `references/pyproject-guide.md` for the full annotated example. Key points:
- Use `[build-system]` with `hatchling` (simple, standards-compliant, no setup.py needed)
- Pin Python version with `requires-python`
- Define `[project.optional-dependencies]` for dev/test/docs extras
- Configure all tools (ruff, pytest, mypy) in pyproject.toml — no separate config files
#### CLAUDE.md
This file gives Claude Code project-specific context. Start with the template in
`templates/CLAUDE.md.template`, which includes:
- Build and test commands
- Project structure orientation
- Code style preferences
- Common workflows
The user should update this as the project evolves.
#### AGENTS.md
This file gives broader agent instructions (not Claude-specific). Start with the
template in `templates/AGENTS.md.template`, which includes:
- Architecture overview placeholder
- Contribution conventions
- Testing expectations
- What not to do
#### Github workflows
By default, we want two GitHub workflows at package initialization: `ci.yaml` and
`python-publish.yaml`. Use the templates in `templates/` as a starting point, and
modify as needed.
### 3. Initialize Git and Install
```bash
cd <project-name>
git init
git add -A
git commit -m "Initial project scaffold"
# Create a virtual environment and install in editable mode
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
```
### 4. Create Notebook Entry
If the lab notebook is set up at `~/codebox/notebook/`, create a project entry:
```bash
mkdir -p ~/codebox/notebook/projects/<project-name>/sessions
```
Write an initial STATUS.md and add the project to PROJECTS.md.
### 5. Verify
Run the following to confirm everything works:
```bash
python -c "import <package_name>; print(<package_name>.__version__)"
pytest
ruff check src/
```
## Conventions
- **Always use src layout**. It prevents accidental imports from the working directory.
- **Always include `py.typed`**. Signals PEP 561 compliance for downstream type checkers.
- **No setup.py, setup.cfg, or requirements.txt**. Everything lives in `pyproject.toml`.
- **Ruff for linting and formatting**. Replaces black, isort, flake8, and pyflakes.
- **Pytest for testing**. Configured in pyproject.toml, not pytest.ini or conftest.py (conftest.py is fine for fixtures, just not config).
---
> Source: [briney/codebox](https://github.com/briney/codebox) — distributed by [TomeVault](https://tomevault.io).
<!-- tomevault:4.0:skill_md:2026-05-22 -->
章节与文件索引
按说明文件中的顺序排列。
1. 收集信息
2. 创建项目
4. 创建笔记本条目
5. 验证
惯例
文件/命令 -> pyproject.toml · 3.11 · [project.scripts] · templates/ · references/ · references/pyproject-guide.md · [build-system] · hatchling
内容校验值 -> 46c74a182c9b
当前原文的自动摘译,尚未人工审校。
1. 收集信息
您至少需要: 项目名称(kebab-case,用于存储库目录和包分发名称) 包名称(snake_case,用于可导入的 Python 包 — 默认:连字符替换为下划线的项目名称) 一行描述 Python 版本(默认:
3.11;对于现代打字语法,更喜欢 3.11+)2. 创建项目
阅读
templates/中的模板和references/中的参考资料了解内容。根据步骤 1 中的用户答案调整模板。 关键文件及其用途:pyproject.toml 请参阅references/pyproject-guide.md以获取完整的带注释的示例。要点:4. 创建笔记本条目
如果实验室笔记本设置在
~/codebox/notebook/,则创建一个项目条目:编写初始 STATUS.md 并将项目添加到 PROJECTS.md。5. 验证
运行以下命令以确认一切正常:
惯例
始终使用 src 布局。它可以防止从工作目录意外导入。始终包含
py.typed。向下游类型检查器发出 PEP 561 合规性信号。没有 setup.py、setup.cfg 或requirements.txt。一切都存在于pyproject.toml。用于绒毛和格式化的 Ruff。取代 black、isort、flake8 和 pyflakes。 Pytest 用于测试。在 pyproject.toml 中配置,而不是 pytest.ini 或 conftest.py (conftest.py 对于固定装置来说很好,只是不是配置)。