Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 16 additions & 29 deletions .claude/LIBRARY_CREATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,38 +22,24 @@ Comprehensive library for X with Y features.

**Why:** AI co-authorship appears in GitHub contributors and cannot be easily removed.

## 2. Files to Exclude from New Library Repositories
## 2. What Lives Where

The following files are **only for the template** and must NOT be committed to new library repositories:

### Must Delete Before First Commit:
- `scripts/setup_repo.py` - Repository setup script (run once, then delete)
- `.claude/LIBRARY_CREATION.md` - This file (agent instructions for template)

### Keep in Template Only:
- Template configuration files
- Copier/Cookiecutter files
- Template-specific documentation
`scripts/setup_repo.py` and this file belong to the template repository. A render
contains neither, so there is nothing of the kind to delete from a new library. The
render does contain `NEW_LIBRARY_CHECKLIST.md`, the operator's checklist; it is deleted
once its steps are done.

## 3. Repository Creation Workflow

When creating a new library repository:

1. **Generate from template** (copier, cookiecutter, or manual)
2. **Run setup script** (if needed):
```bash
python scripts/setup_repo.py org/repo-name
```
3. **Delete setup script**:
1. **Generate from template**:
```bash
git rm scripts/setup_repo.py
uvx --with jinja2-time copier copy --trust gh:bedrock-python/python-library-template my-library
```
4. **Delete template-specific files**:
```bash
git rm .claude/LIBRARY_CREATION.md
```
5. **Make initial commit WITHOUT Co-Authored-By**:
2. **Make initial commit WITHOUT Co-Authored-By**:
```bash
git init -b master
git add .
git commit -m "feat: initial release

Expand All @@ -62,9 +48,13 @@ When creating a new library repository:
- Feature B
- Full documentation and tests"
```
6. **Push to GitHub**:
3. **Create the GitHub repository and push**:
```bash
gh repo create org/repo-name --public --source . --push
```
4. **After the first CI pass, run the setup script from the template repository**:
```bash
git push -u origin master
python /path/to/python-library-template/scripts/setup_repo.py org/repo-name
```

## 4. Initial Release Version
Expand Down Expand Up @@ -99,8 +89,6 @@ Keep the `<!-- ... -->` guidance comment out of the committed page.
Before pushing the initial commit, verify:

- [ ] No `Co-Authored-By:` in commit messages
- [ ] `scripts/setup_repo.py` deleted
- [ ] `.claude/LIBRARY_CREATION.md` deleted
- [ ] No backup files (e.g., `.coverage (копия...)`, `file (copy).py`)
- [ ] No cache files (`.mypy_cache`, `.ruff_cache`, `__pycache__`) - should be in `.gitignore`
- [ ] `.release-please-manifest.json` contains `"0.0.0"`
Expand All @@ -122,7 +110,6 @@ Before merging the Release Please PR:
## 8. Common Mistakes to Avoid

❌ Including AI agents in commits
❌ Committing `scripts/setup_repo.py` to the library repo
❌ Starting with version `0.1.0` instead of `0.0.0`
❌ Committing backup/cache files
❌ Creating multiple commits before initial push (messy history)
Expand All @@ -136,6 +123,6 @@ Before merging the Release Please PR:
- No AI co-authors
- No template-specific files
- Start from version 0.0.0
- Run setup script, then delete it
- Run the setup script from the template repository

Following these rules ensures a clean, professional repository from day one.
5 changes: 3 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ existing ones. Treat it like library code.
- `scripts/setup_repo.py` configures a freshly created GitHub repository to the org
standard (ruleset on `master`, security settings, merge settings, topics). It is run
once per new library and is also what keeps the existing repositories aligned.
- `NEW_LIBRARY_CHECKLIST.md.jinja` and `.claude/LIBRARY_CREATION.md` are the operator
and agent instructions. Keep them in step with what the template actually does.
- `template/NEW_LIBRARY_CHECKLIST.md.jinja` (rendered into every new library, deleted
there once set up) and `.claude/LIBRARY_CREATION.md` are the operator and agent
instructions. Keep them in step with what the template actually does.

## Checking a change

Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ make check

Then:
1. Create a GitHub repo: `gh repo create bedrock-python/my-library --public`
2. **Configure repo** (after the first CI pass, then delete the script):
2. **Configure repo** (after the first CI pass), from a checkout of this template
repository — the script lives here, not in the library:
```bash
python scripts/setup_repo.py bedrock-python/my-library
git rm scripts/setup_repo.py .claude/LIBRARY_CREATION.md
```
Idempotent. Sets the org standard: a `pypi` environment only `master` may deploy to,
the `github-pages` environment and Pages,
Expand Down Expand Up @@ -82,7 +82,8 @@ and as `_commit` the template commit it was rendered from, or the closest one.

See [`.claude/LIBRARY_CREATION.md`](.claude/LIBRARY_CREATION.md) for important rules:
- **Never** add AI agents as co-authors in commits
- Delete `scripts/setup_repo.py` before initial commit
- Run `scripts/setup_repo.py` from this repository; a render contains neither it nor
`.claude/LIBRARY_CREATION.md`
- Start with version `0.0.0` (Release Please creates `0.1.0`)

## What's included
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,16 @@ it bumps all three: `CHANGELOG.md`, `.release-please-manifest.json` **and**

Merge the PR → tag `{{ project_slug }}-v0.1.0` is created → PyPI publish triggers.

Or to publish manually:
To publish a release tag that already exists by hand (when its publish failed, say),
run the Publish workflow from `master`:

```bash
git tag {{ project_slug }}-v0.1.0
git push origin {{ project_slug }}-v0.1.0
# Then create a GitHub Release from that tag
gh workflow run publish.yml --ref master -f tag={{ project_slug }}-v0.1.0
```

Pushing a tag or creating a GitHub Release yourself publishes nothing. The Publish
workflow runs after Release Please and on this dispatch, and on nothing else.

## Done ✓

- [ ] `make check` passes
Expand All @@ -97,3 +100,4 @@ git push origin {{ project_slug }}-v0.1.0
- [ ] PyPI Trusted Publisher configured
- [ ] `CODECOV_TOKEN` secret added
- [ ] First release published to PyPI
- [ ] This file deleted
Loading