Скачайте ZIP основной ветки и распакуйте в новый каталог либо создайте репозиторий через Use this template. Не используйте Fork.
cd my-project &&
git init -b master &&
git add -- .git clone -o github git@github.com:example-owner/my-project.git &&
cd my-project &&
git switch -c chore/initialize-projectВыполните из корня новой копии. --repo и --description обязательны; --owner, --display, --branch необязательны. Без --apply изменения только показываются.
Для команд до установки используйте Python 3.12 или новее (python3 вместо python, если требуется). Initializer не требует установки зависимостей.
python tools/initialize.py --help
python tools/initialize.py --owner=example-owner --repo=my-project --description="My Python project."
python tools/initialize.py --owner=example-owner --repo=my-project --description="My Python project." --applyИнтерактивный режим: запустите без аргументов; запись только после подтверждения yes.
python tools/initialize.pyWarning
После инициализации проверьте diff. При частичной записи не повторяйте запуск. Удалите одноразовые файлы только в производном проекте.
git diff --check
git diffДля новой копии без коммита используйте команды Local-first ниже; для существующего коммита — GitHub-first.
git rm --cached -- tools/initialize.py tests/test_initializer.py &&
rm -- tools/initialize.py tests/test_initializer.py &&
git rm --cached --ignore-unmatch -- docs/assets/python-project-skeleton-readme-cover.png &&
if [ -f docs/assets/python-project-skeleton-readme-cover.png ]; then
rm -- docs/assets/python-project-skeleton-readme-cover.png
figit rm -- tools/initialize.py tests/test_initializer.py &&
git rm --ignore-unmatch -- docs/assets/python-project-skeleton-readme-cover.pngЗатем установите проект и выполните проверки. Перед push проверьте remote; при смене владельца проверьте атрибуцию и funding. После удаления одноразовых файлов создайте виртуальное окружение и установите зависимости по инструкции «Разработка».
git add -u
git diff --cached --check
git diff --cachedLocal-first: создайте пустой репозиторий на GitHub, без начальных файлов. Для GitHub-first remote уже настроен; после push создайте PR в master.
git commit -S -m "feat: инициализировать Python-проект"
git remote add github git@github.com:example-owner/my-project.git
git remote -vgit push -u github mastergit commit -S -m "feat: инициализировать Python-проект"
git remote -vgit push -u github chore/initialize-projectGitHub Template Repository копирует файлы, но не настройки, Secrets и Variables. Настройте General, Actions и Advanced Security до первого push; добавьте Rulesets после первого успешного CI, когда известны имена checks. Доступность настроек зависит от видимости, тарифа и прав.
Параметры настройки приведены с английскими названиями из GitHub UI. В Actions выберите фактического владельца; для tag ruleset используйте Add target → Include by pattern → v*.
| Настройка | Значение |
|---|---|
| Issues | ON |
| Discussions | ON |
| Sponsorships | ON (при настроенном funding) |
| Preserve this repository | ON |
| Enable release immutability | ON |
| Wikis | OFF |
| Projects | OFF |
| Allow merge commits | ON |
| Automatically delete head branches | ON |
| Allow squash merging | OFF |
| Allow rebase merging | OFF |
| Allow auto-merge | OFF |
| Template repository | ON (только шаблон), OFF (производный проект) |
| Topics | По проекту |
| Social preview | По проекту |
| Настройка | Значение |
|---|---|
| Allow OWNER, and select non-OWNER, actions and reusable workflows | ON |
| Allow actions created by GitHub | OFF |
| Allow actions by Marketplace verified creators | OFF |
| Require actions to be pinned to a full-length commit SHA | ON |
| Check, workflow run, status, artifact and log retention | 90 days |
| Require approval for all external contributors | ON |
| Read repository contents and packages permissions | ON |
| Allow GitHub Actions to create and approve pull requests | OFF |
Allow or block specified actions and reusable workflows:
actions/checkout@*,
actions/setup-python@*
| Настройка | Protect master | Protect release tags (если используются) |
|---|---|---|
| Enforcement status | Active | Active |
| Bypass list | Пустой | Пустой |
| Target | Основная ветка | v* |
| Restrict creations | OFF | OFF |
| Restrict updates | OFF | ON |
| Restrict deletions | ON | ON |
| Block force pushes | ON | ON |
| Require signed commits | ON | — |
| Require a pull request before merging | ON | — |
| Required approvals (один владелец) | 0 | — |
| Allowed merge methods | Merge | — |
| Require status checks to pass | Фактические успешные checks | — |
| Require branches to be up to date before merging | ON | — |
| Require extra approval for unattributed changes | OFF | — |
| Require linear history | OFF | — |
| Require merge queue | OFF | — |
| Require review from Code Owners | OFF | — |
ubuntu-latest / Python 3.12 / Quality checks
ubuntu-latest / Python 3.15 / Quality checks
windows-latest / Python 3.12 / Quality checks
windows-latest / Python 3.15 / Quality checks
| Настройка | Значение |
|---|---|
| Private vulnerability reporting | ON |
| Dependency graph | ON |
| Dependabot alerts | ON |
| Secret Protection | ON |
| Push protection | ON |
| Automatic dependency submission | Disabled |
| Dependabot security updates | OFF |
| Grouped security updates | OFF |
| Malware alerts | OFF |
| AI Scan for repositories | OFF |
| AI Scan for pull requests | OFF |
| Scan for AI applications | OFF |
| Copilot Autofix | OFF |
| Agentic autofix | OFF |
| CodeQL analysis | Не настроено |
| Dependabot version updates | Не настроено |
| Check runs failure threshold | High or higher / Only errors |
В Actions → CI → Run workflow можно запустить проверку вручную. Проверьте CI для PR и master. Ожидаются четыре quality checks: две версии Python на двух ОС. Не назначайте обязательными отсутствующие checks. Для временного smoke-проекта не создавайте теги или релизы. Для реального релиза требуется отдельное решение владельца.