@ruaruababa/vibe-kit 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CATALOG.md +317 -0
- package/README.md +121 -0
- package/aliases.json +65 -0
- package/bin/vibe.js +2 -0
- package/bundles.json +265 -0
- package/catalog.json +1560 -0
- package/dist/antigravity-skills/bin/cli.js +438 -0
- package/dist/antigravity-skills/lib/skill-utils.js +158 -0
- package/dist/antigravity-skills/scripts/build-catalog.js +305 -0
- package/dist/antigravity-skills/scripts/normalize-frontmatter.js +144 -0
- package/dist/antigravity-skills/scripts/validate-skills.js +230 -0
- package/dist/bin/vibe.js +2 -0
- package/dist/dist/src/cli/index.js +26 -0
- package/dist/lib/skill-utils.js +158 -0
- package/dist/scripts/build-catalog.js +50 -0
- package/dist/scripts/normalize-frontmatter.js +144 -0
- package/dist/scripts/validate-skills.js +56 -0
- package/dist/src/cli/index.js +146 -0
- package/dist/src/types/index.js +13 -0
- package/dist/src/utils/fs.js +1 -0
- package/package.json +43 -0
- package/skills/accessibility-compliance-accessibility-audit/SKILL.md +42 -0
- package/skills/accessibility-compliance-accessibility-audit/resources/implementation-playbook.md +502 -0
- package/skills/agent-orchestration-improve-agent/SKILL.md +349 -0
- package/skills/agent-orchestration-multi-agent-optimize/SKILL.md +239 -0
- package/skills/agent-orchestrator/SKILL.md +24 -0
- package/skills/ai-engineer/SKILL.md +171 -0
- package/skills/airflow-dag-patterns/SKILL.md +41 -0
- package/skills/airflow-dag-patterns/resources/implementation-playbook.md +509 -0
- package/skills/angular-migration/SKILL.md +428 -0
- package/skills/anti-reversing-techniques/SKILL.md +42 -0
- package/skills/anti-reversing-techniques/resources/implementation-playbook.md +539 -0
- package/skills/api-design-principles/SKILL.md +37 -0
- package/skills/api-design-principles/assets/api-design-checklist.md +155 -0
- package/skills/api-design-principles/assets/rest-api-template.py +182 -0
- package/skills/api-design-principles/references/graphql-schema-design.md +583 -0
- package/skills/api-design-principles/references/rest-best-practices.md +408 -0
- package/skills/api-design-principles/resources/implementation-playbook.md +513 -0
- package/skills/api-documenter/SKILL.md +184 -0
- package/skills/api-testing-observability-api-mock/SKILL.md +46 -0
- package/skills/api-testing-observability-api-mock/resources/implementation-playbook.md +1327 -0
- package/skills/application-performance-performance-optimization/SKILL.md +154 -0
- package/skills/architect-review/SKILL.md +174 -0
- package/skills/architecture-decision-records/SKILL.md +441 -0
- package/skills/architecture-patterns/SKILL.md +37 -0
- package/skills/architecture-patterns/resources/implementation-playbook.md +479 -0
- package/skills/arm-cortex-expert/SKILL.md +306 -0
- package/skills/async-python-patterns/SKILL.md +39 -0
- package/skills/async-python-patterns/resources/implementation-playbook.md +678 -0
- package/skills/attack-tree-construction/SKILL.md +38 -0
- package/skills/attack-tree-construction/resources/implementation-playbook.md +671 -0
- package/skills/auth-implementation-patterns/SKILL.md +39 -0
- package/skills/auth-implementation-patterns/resources/implementation-playbook.md +618 -0
- package/skills/backend-architect/SKILL.md +333 -0
- package/skills/backend-development-feature-development/SKILL.md +180 -0
- package/skills/backend-security-coder/SKILL.md +156 -0
- package/skills/backtesting-frameworks/SKILL.md +39 -0
- package/skills/backtesting-frameworks/resources/implementation-playbook.md +647 -0
- package/skills/bash-defensive-patterns/SKILL.md +43 -0
- package/skills/bash-defensive-patterns/resources/implementation-playbook.md +517 -0
- package/skills/bash-pro/SKILL.md +310 -0
- package/skills/bats-testing-patterns/SKILL.md +34 -0
- package/skills/bats-testing-patterns/resources/implementation-playbook.md +614 -0
- package/skills/bazel-build-optimization/SKILL.md +397 -0
- package/skills/billing-automation/SKILL.md +42 -0
- package/skills/billing-automation/resources/implementation-playbook.md +544 -0
- package/skills/binary-analysis-patterns/SKILL.md +450 -0
- package/skills/blockchain-developer/SKILL.md +208 -0
- package/skills/business-analyst/SKILL.md +182 -0
- package/skills/c-pro/SKILL.md +56 -0
- package/skills/c4-architecture-c4-architecture/SKILL.md +389 -0
- package/skills/c4-code/SKILL.md +244 -0
- package/skills/c4-component/SKILL.md +153 -0
- package/skills/c4-container/SKILL.md +171 -0
- package/skills/c4-context/SKILL.md +150 -0
- package/skills/changelog-automation/SKILL.md +38 -0
- package/skills/changelog-automation/resources/implementation-playbook.md +538 -0
- package/skills/cicd-automation-workflow-automate/SKILL.md +51 -0
- package/skills/cicd-automation-workflow-automate/resources/implementation-playbook.md +1333 -0
- package/skills/clean-markdown/SKILL.md +23 -0
- package/skills/cloud-architect/SKILL.md +135 -0
- package/skills/code-documentation-code-explain/SKILL.md +46 -0
- package/skills/code-documentation-code-explain/resources/implementation-playbook.md +802 -0
- package/skills/code-documentation-doc-generate/SKILL.md +48 -0
- package/skills/code-documentation-doc-generate/resources/implementation-playbook.md +640 -0
- package/skills/code-refactoring-context-restore/SKILL.md +179 -0
- package/skills/code-refactoring-refactor-clean/SKILL.md +51 -0
- package/skills/code-refactoring-refactor-clean/resources/implementation-playbook.md +879 -0
- package/skills/code-refactoring-tech-debt/SKILL.md +386 -0
- package/skills/code-review-ai-ai-review/SKILL.md +450 -0
- package/skills/code-review-excellence/SKILL.md +40 -0
- package/skills/code-review-excellence/resources/implementation-playbook.md +515 -0
- package/skills/code-reviewer/SKILL.md +178 -0
- package/skills/codebase-cleanup-deps-audit/SKILL.md +51 -0
- package/skills/codebase-cleanup-deps-audit/resources/implementation-playbook.md +766 -0
- package/skills/codebase-cleanup-refactor-clean/SKILL.md +51 -0
- package/skills/codebase-cleanup-refactor-clean/resources/implementation-playbook.md +879 -0
- package/skills/codebase-cleanup-tech-debt/SKILL.md +386 -0
- package/skills/competitive-landscape/SKILL.md +34 -0
- package/skills/competitive-landscape/resources/implementation-playbook.md +494 -0
- package/skills/comprehensive-review-full-review/SKILL.md +146 -0
- package/skills/comprehensive-review-pr-enhance/SKILL.md +46 -0
- package/skills/comprehensive-review-pr-enhance/resources/implementation-playbook.md +691 -0
- package/skills/conductor-implement/SKILL.md +388 -0
- package/skills/conductor-manage/SKILL.md +39 -0
- package/skills/conductor-manage/resources/implementation-playbook.md +1120 -0
- package/skills/conductor-new-track/SKILL.md +433 -0
- package/skills/conductor-revert/SKILL.md +372 -0
- package/skills/conductor-setup/SKILL.md +426 -0
- package/skills/conductor-status/SKILL.md +338 -0
- package/skills/conductor-validator/SKILL.md +62 -0
- package/skills/content-marketer/SKILL.md +170 -0
- package/skills/context-driven-development/SKILL.md +400 -0
- package/skills/context-management-context-restore/SKILL.md +179 -0
- package/skills/context-management-context-save/SKILL.md +177 -0
- package/skills/context-manager/SKILL.md +185 -0
- package/skills/cost-optimization/SKILL.md +286 -0
- package/skills/cpp-pro/SKILL.md +59 -0
- package/skills/cqrs-implementation/SKILL.md +35 -0
- package/skills/cqrs-implementation/resources/implementation-playbook.md +540 -0
- package/skills/csharp-pro/SKILL.md +59 -0
- package/skills/customer-support/SKILL.md +170 -0
- package/skills/data-engineer/SKILL.md +224 -0
- package/skills/data-engineering-data-driven-feature/SKILL.md +182 -0
- package/skills/data-engineering-data-pipeline/SKILL.md +201 -0
- package/skills/data-quality-frameworks/SKILL.md +40 -0
- package/skills/data-quality-frameworks/resources/implementation-playbook.md +573 -0
- package/skills/data-scientist/SKILL.md +199 -0
- package/skills/data-storytelling/SKILL.md +465 -0
- package/skills/database-admin/SKILL.md +165 -0
- package/skills/database-architect/SKILL.md +268 -0
- package/skills/database-cloud-optimization-cost-optimize/SKILL.md +44 -0
- package/skills/database-cloud-optimization-cost-optimize/resources/implementation-playbook.md +1441 -0
- package/skills/database-migration/SKILL.md +436 -0
- package/skills/database-migrations-migration-observability/SKILL.md +420 -0
- package/skills/database-migrations-sql-migrations/SKILL.md +53 -0
- package/skills/database-migrations-sql-migrations/resources/implementation-playbook.md +499 -0
- package/skills/database-optimizer/SKILL.md +167 -0
- package/skills/dbt-transformation-patterns/SKILL.md +34 -0
- package/skills/dbt-transformation-patterns/resources/implementation-playbook.md +547 -0
- package/skills/debugger/SKILL.md +49 -0
- package/skills/debugging-strategies/SKILL.md +34 -0
- package/skills/debugging-strategies/resources/implementation-playbook.md +511 -0
- package/skills/debugging-toolkit-smart-debug/SKILL.md +197 -0
- package/skills/defi-protocol-templates/SKILL.md +466 -0
- package/skills/dependency-management-deps-audit/SKILL.md +44 -0
- package/skills/dependency-management-deps-audit/resources/implementation-playbook.md +766 -0
- package/skills/dependency-upgrade/SKILL.md +421 -0
- package/skills/deployment-engineer/SKILL.md +170 -0
- package/skills/deployment-pipeline-design/SKILL.md +371 -0
- package/skills/deployment-validation-config-validate/SKILL.md +496 -0
- package/skills/devops-troubleshooter/SKILL.md +161 -0
- package/skills/distributed-debugging-debug-trace/SKILL.md +44 -0
- package/skills/distributed-debugging-debug-trace/resources/implementation-playbook.md +1307 -0
- package/skills/distributed-tracing/SKILL.md +450 -0
- package/skills/django-pro/SKILL.md +180 -0
- package/skills/docs-architect/SKILL.md +98 -0
- package/skills/documentation-generation-doc-generate/SKILL.md +48 -0
- package/skills/documentation-generation-doc-generate/resources/implementation-playbook.md +640 -0
- package/skills/dotnet-architect/SKILL.md +197 -0
- package/skills/dotnet-backend-patterns/SKILL.md +37 -0
- package/skills/dotnet-backend-patterns/assets/repository-template.cs +523 -0
- package/skills/dotnet-backend-patterns/assets/service-template.cs +336 -0
- package/skills/dotnet-backend-patterns/references/dapper-patterns.md +544 -0
- package/skills/dotnet-backend-patterns/references/ef-core-best-practices.md +355 -0
- package/skills/dotnet-backend-patterns/resources/implementation-playbook.md +799 -0
- package/skills/dummy-skill/SKILL.md +5 -0
- package/skills/dx-optimizer/SKILL.md +83 -0
- package/skills/e2e-testing-patterns/SKILL.md +41 -0
- package/skills/e2e-testing-patterns/resources/implementation-playbook.md +531 -0
- package/skills/elixir-pro/SKILL.md +59 -0
- package/skills/embedding-strategies/SKILL.md +491 -0
- package/skills/employment-contract-templates/SKILL.md +39 -0
- package/skills/employment-contract-templates/resources/implementation-playbook.md +493 -0
- package/skills/error-debugging-error-analysis/SKILL.md +47 -0
- package/skills/error-debugging-error-analysis/resources/implementation-playbook.md +1143 -0
- package/skills/error-debugging-error-trace/SKILL.md +43 -0
- package/skills/error-debugging-error-trace/resources/implementation-playbook.md +1361 -0
- package/skills/error-debugging-multi-agent-review/SKILL.md +216 -0
- package/skills/error-detective/SKILL.md +53 -0
- package/skills/error-diagnostics-error-analysis/SKILL.md +47 -0
- package/skills/error-diagnostics-error-analysis/resources/implementation-playbook.md +1143 -0
- package/skills/error-diagnostics-error-trace/SKILL.md +48 -0
- package/skills/error-diagnostics-error-trace/resources/implementation-playbook.md +1371 -0
- package/skills/error-diagnostics-smart-debug/SKILL.md +197 -0
- package/skills/error-handling-patterns/SKILL.md +35 -0
- package/skills/error-handling-patterns/resources/implementation-playbook.md +635 -0
- package/skills/event-sourcing-architect/SKILL.md +58 -0
- package/skills/event-store-design/SKILL.md +449 -0
- package/skills/fastapi-pro/SKILL.md +192 -0
- package/skills/fastapi-templates/SKILL.md +32 -0
- package/skills/fastapi-templates/resources/implementation-playbook.md +566 -0
- package/skills/final-test/SKILL.md +5 -0
- package/skills/firmware-analyst/SKILL.md +320 -0
- package/skills/flutter-expert/SKILL.md +200 -0
- package/skills/framework-migration-code-migrate/SKILL.md +48 -0
- package/skills/framework-migration-code-migrate/resources/implementation-playbook.md +1052 -0
- package/skills/framework-migration-deps-upgrade/SKILL.md +48 -0
- package/skills/framework-migration-deps-upgrade/resources/implementation-playbook.md +755 -0
- package/skills/framework-migration-legacy-modernize/SKILL.md +132 -0
- package/skills/frontend-developer/SKILL.md +171 -0
- package/skills/frontend-mobile-development-component-scaffold/SKILL.md +403 -0
- package/skills/frontend-mobile-security-xss-scan/SKILL.md +322 -0
- package/skills/frontend-security-coder/SKILL.md +170 -0
- package/skills/full-stack-orchestration-full-stack-feature/SKILL.md +135 -0
- package/skills/gdpr-data-handling/SKILL.md +33 -0
- package/skills/gdpr-data-handling/resources/implementation-playbook.md +615 -0
- package/skills/git-advanced-workflows/SKILL.md +412 -0
- package/skills/git-pr-workflows-git-workflow/SKILL.md +140 -0
- package/skills/git-pr-workflows-onboard/SKILL.md +416 -0
- package/skills/git-pr-workflows-pr-enhance/SKILL.md +48 -0
- package/skills/git-pr-workflows-pr-enhance/resources/implementation-playbook.md +701 -0
- package/skills/github-actions-templates/SKILL.md +345 -0
- package/skills/gitlab-ci-patterns/SKILL.md +283 -0
- package/skills/gitops-workflow/SKILL.md +303 -0
- package/skills/gitops-workflow/references/argocd-setup.md +134 -0
- package/skills/gitops-workflow/references/sync-policies.md +131 -0
- package/skills/go-concurrency-patterns/SKILL.md +33 -0
- package/skills/go-concurrency-patterns/resources/implementation-playbook.md +654 -0
- package/skills/godot-gdscript-patterns/SKILL.md +33 -0
- package/skills/godot-gdscript-patterns/resources/implementation-playbook.md +804 -0
- package/skills/golang-pro/SKILL.md +179 -0
- package/skills/grafana-dashboards/SKILL.md +381 -0
- package/skills/graphql-architect/SKILL.md +182 -0
- package/skills/haskell-pro/SKILL.md +56 -0
- package/skills/helm-chart-scaffolding/SKILL.md +34 -0
- package/skills/helm-chart-scaffolding/assets/Chart.yaml.template +42 -0
- package/skills/helm-chart-scaffolding/assets/values.yaml.template +185 -0
- package/skills/helm-chart-scaffolding/references/chart-structure.md +500 -0
- package/skills/helm-chart-scaffolding/resources/implementation-playbook.md +543 -0
- package/skills/helm-chart-scaffolding/scripts/validate-chart.sh +244 -0
- package/skills/hr-pro/SKILL.md +126 -0
- package/skills/hybrid-cloud-architect/SKILL.md +168 -0
- package/skills/hybrid-cloud-networking/SKILL.md +238 -0
- package/skills/hybrid-search-implementation/SKILL.md +32 -0
- package/skills/hybrid-search-implementation/resources/implementation-playbook.md +567 -0
- package/skills/incident-responder/SKILL.md +213 -0
- package/skills/incident-response-incident-response/SKILL.md +168 -0
- package/skills/incident-response-smart-fix/SKILL.md +29 -0
- package/skills/incident-response-smart-fix/resources/implementation-playbook.md +838 -0
- package/skills/incident-runbook-templates/SKILL.md +395 -0
- package/skills/ios-developer/SKILL.md +219 -0
- package/skills/istio-traffic-management/SKILL.md +337 -0
- package/skills/java-pro/SKILL.md +177 -0
- package/skills/javascript-pro/SKILL.md +57 -0
- package/skills/javascript-testing-patterns/SKILL.md +35 -0
- package/skills/javascript-testing-patterns/resources/implementation-playbook.md +1024 -0
- package/skills/javascript-typescript-typescript-scaffold/SKILL.md +361 -0
- package/skills/julia-pro/SKILL.md +209 -0
- package/skills/k8s-manifest-generator/SKILL.md +35 -0
- package/skills/k8s-manifest-generator/assets/configmap-template.yaml +296 -0
- package/skills/k8s-manifest-generator/assets/deployment-template.yaml +203 -0
- package/skills/k8s-manifest-generator/assets/service-template.yaml +171 -0
- package/skills/k8s-manifest-generator/references/deployment-spec.md +753 -0
- package/skills/k8s-manifest-generator/references/service-spec.md +724 -0
- package/skills/k8s-manifest-generator/resources/implementation-playbook.md +510 -0
- package/skills/k8s-security-policies/SKILL.md +346 -0
- package/skills/k8s-security-policies/assets/network-policy-template.yaml +177 -0
- package/skills/k8s-security-policies/references/rbac-patterns.md +187 -0
- package/skills/kpi-dashboard-design/SKILL.md +440 -0
- package/skills/kubernetes-architect/SKILL.md +170 -0
- package/skills/langchain-architecture/SKILL.md +350 -0
- package/skills/legacy-modernizer/SKILL.md +53 -0
- package/skills/legal-advisor/SKILL.md +70 -0
- package/skills/linkerd-patterns/SKILL.md +321 -0
- package/skills/llm-application-dev-ai-assistant/SKILL.md +35 -0
- package/skills/llm-application-dev-ai-assistant/resources/implementation-playbook.md +1236 -0
- package/skills/llm-application-dev-langchain-agent/SKILL.md +246 -0
- package/skills/llm-application-dev-prompt-optimize/SKILL.md +37 -0
- package/skills/llm-application-dev-prompt-optimize/resources/implementation-playbook.md +591 -0
- package/skills/llm-evaluation/SKILL.md +483 -0
- package/skills/machine-learning-ops-ml-pipeline/SKILL.md +314 -0
- package/skills/malware-analyst/SKILL.md +247 -0
- package/skills/market-sizing-analysis/SKILL.md +425 -0
- package/skills/market-sizing-analysis/examples/saas-market-sizing.md +349 -0
- package/skills/market-sizing-analysis/references/data-sources.md +360 -0
- package/skills/memory-forensics/SKILL.md +491 -0
- package/skills/memory-safety-patterns/SKILL.md +33 -0
- package/skills/memory-safety-patterns/resources/implementation-playbook.md +603 -0
- package/skills/mermaid-expert/SKILL.md +59 -0
- package/skills/microservices-patterns/SKILL.md +35 -0
- package/skills/microservices-patterns/resources/implementation-playbook.md +607 -0
- package/skills/minecraft-bukkit-pro/SKILL.md +126 -0
- package/skills/ml-engineer/SKILL.md +168 -0
- package/skills/ml-pipeline-workflow/SKILL.md +257 -0
- package/skills/mlops-engineer/SKILL.md +219 -0
- package/skills/mobile-developer/SKILL.md +205 -0
- package/skills/mobile-security-coder/SKILL.md +184 -0
- package/skills/modern-javascript-patterns/SKILL.md +35 -0
- package/skills/modern-javascript-patterns/resources/implementation-playbook.md +910 -0
- package/skills/monorepo-architect/SKILL.md +61 -0
- package/skills/monorepo-management/SKILL.md +35 -0
- package/skills/monorepo-management/resources/implementation-playbook.md +621 -0
- package/skills/mtls-configuration/SKILL.md +359 -0
- package/skills/multi-cloud-architecture/SKILL.md +189 -0
- package/skills/multi-platform-apps-multi-platform/SKILL.md +203 -0
- package/skills/network-engineer/SKILL.md +169 -0
- package/skills/nextjs-app-router-patterns/SKILL.md +33 -0
- package/skills/nextjs-app-router-patterns/resources/implementation-playbook.md +543 -0
- package/skills/nft-standards/SKILL.md +395 -0
- package/skills/node-expert/SKILL.md +23 -0
- package/skills/nodejs-backend-patterns/SKILL.md +35 -0
- package/skills/nodejs-backend-patterns/resources/implementation-playbook.md +1019 -0
- package/skills/nx-workspace-patterns/SKILL.md +464 -0
- package/skills/observability-engineer/SKILL.md +237 -0
- package/skills/observability-monitoring-monitor-setup/SKILL.md +48 -0
- package/skills/observability-monitoring-monitor-setup/resources/implementation-playbook.md +505 -0
- package/skills/observability-monitoring-slo-implement/SKILL.md +43 -0
- package/skills/observability-monitoring-slo-implement/resources/implementation-playbook.md +1077 -0
- package/skills/on-call-handoff-patterns/SKILL.md +453 -0
- package/skills/openapi-spec-generation/SKILL.md +33 -0
- package/skills/openapi-spec-generation/resources/implementation-playbook.md +1027 -0
- package/skills/payment-integration/SKILL.md +77 -0
- package/skills/paypal-integration/SKILL.md +479 -0
- package/skills/pci-compliance/SKILL.md +478 -0
- package/skills/performance-engineer/SKILL.md +180 -0
- package/skills/performance-testing-review-ai-review/SKILL.md +450 -0
- package/skills/performance-testing-review-multi-agent-review/SKILL.md +216 -0
- package/skills/php-pro/SKILL.md +63 -0
- package/skills/posix-shell-pro/SKILL.md +304 -0
- package/skills/postgresql/SKILL.md +230 -0
- package/skills/postmortem-writing/SKILL.md +386 -0
- package/skills/projection-patterns/SKILL.md +33 -0
- package/skills/projection-patterns/resources/implementation-playbook.md +501 -0
- package/skills/prometheus-configuration/SKILL.md +404 -0
- package/skills/prompt-engineer/SKILL.md +272 -0
- package/skills/prompt-engineering-patterns/SKILL.md +213 -0
- package/skills/prompt-engineering-patterns/assets/few-shot-examples.json +106 -0
- package/skills/prompt-engineering-patterns/assets/prompt-template-library.md +246 -0
- package/skills/prompt-engineering-patterns/references/chain-of-thought.md +399 -0
- package/skills/prompt-engineering-patterns/references/few-shot-learning.md +369 -0
- package/skills/prompt-engineering-patterns/references/prompt-optimization.md +414 -0
- package/skills/prompt-engineering-patterns/references/prompt-templates.md +470 -0
- package/skills/prompt-engineering-patterns/references/system-prompts.md +189 -0
- package/skills/prompt-engineering-patterns/scripts/optimize-prompt.py +279 -0
- package/skills/protocol-reverse-engineering/SKILL.md +29 -0
- package/skills/protocol-reverse-engineering/resources/implementation-playbook.md +509 -0
- package/skills/python-development-python-scaffold/SKILL.md +331 -0
- package/skills/python-packaging/SKILL.md +36 -0
- package/skills/python-packaging/resources/implementation-playbook.md +869 -0
- package/skills/python-performance-optimization/SKILL.md +36 -0
- package/skills/python-performance-optimization/resources/implementation-playbook.md +868 -0
- package/skills/python-pro/SKILL.md +158 -0
- package/skills/python-testing-patterns/SKILL.md +37 -0
- package/skills/python-testing-patterns/resources/implementation-playbook.md +906 -0
- package/skills/quant-analyst/SKILL.md +53 -0
- package/skills/rag-implementation/SKILL.md +421 -0
- package/skills/react-modernization/SKILL.md +34 -0
- package/skills/react-modernization/resources/implementation-playbook.md +512 -0
- package/skills/react-native-architecture/SKILL.md +33 -0
- package/skills/react-native-architecture/resources/implementation-playbook.md +670 -0
- package/skills/react-state-management/SKILL.md +441 -0
- package/skills/reference-builder/SKILL.md +188 -0
- package/skills/reverse-engineer/SKILL.md +173 -0
- package/skills/risk-manager/SKILL.md +61 -0
- package/skills/risk-metrics-calculation/SKILL.md +33 -0
- package/skills/risk-metrics-calculation/resources/implementation-playbook.md +554 -0
- package/skills/ruby-pro/SKILL.md +56 -0
- package/skills/rust-async-patterns/SKILL.md +33 -0
- package/skills/rust-async-patterns/resources/implementation-playbook.md +516 -0
- package/skills/rust-pro/SKILL.md +178 -0
- package/skills/saga-orchestration/SKILL.md +496 -0
- package/skills/sales-automator/SKILL.md +55 -0
- package/skills/sast-configuration/SKILL.md +212 -0
- package/skills/scala-pro/SKILL.md +82 -0
- package/skills/screen-reader-testing/SKILL.md +33 -0
- package/skills/screen-reader-testing/resources/implementation-playbook.md +544 -0
- package/skills/search-specialist/SKILL.md +80 -0
- package/skills/secrets-management/SKILL.md +364 -0
- package/skills/security-auditor/SKILL.md +169 -0
- package/skills/security-compliance-compliance-check/SKILL.md +55 -0
- package/skills/security-compliance-compliance-check/resources/implementation-playbook.md +963 -0
- package/skills/security-requirement-extraction/SKILL.md +33 -0
- package/skills/security-requirement-extraction/resources/implementation-playbook.md +676 -0
- package/skills/security-scanning-security-dependencies/SKILL.md +43 -0
- package/skills/security-scanning-security-dependencies/resources/implementation-playbook.md +544 -0
- package/skills/security-scanning-security-hardening/SKILL.md +147 -0
- package/skills/security-scanning-security-sast/SKILL.md +495 -0
- package/skills/seo-authority-builder/SKILL.md +136 -0
- package/skills/seo-cannibalization-detector/SKILL.md +123 -0
- package/skills/seo-content-auditor/SKILL.md +83 -0
- package/skills/seo-content-planner/SKILL.md +108 -0
- package/skills/seo-content-refresher/SKILL.md +118 -0
- package/skills/seo-content-writer/SKILL.md +96 -0
- package/skills/seo-keyword-strategist/SKILL.md +95 -0
- package/skills/seo-meta-optimizer/SKILL.md +92 -0
- package/skills/seo-snippet-hunter/SKILL.md +114 -0
- package/skills/seo-structure-architect/SKILL.md +108 -0
- package/skills/service-mesh-expert/SKILL.md +58 -0
- package/skills/service-mesh-observability/SKILL.md +395 -0
- package/skills/shellcheck-configuration/SKILL.md +466 -0
- package/skills/similarity-search-patterns/SKILL.md +33 -0
- package/skills/similarity-search-patterns/resources/implementation-playbook.md +557 -0
- package/skills/slo-implementation/SKILL.md +341 -0
- package/skills/solidity-security/SKILL.md +34 -0
- package/skills/solidity-security/resources/implementation-playbook.md +524 -0
- package/skills/spark-optimization/SKILL.md +427 -0
- package/skills/sql-optimization-patterns/SKILL.md +35 -0
- package/skills/sql-optimization-patterns/resources/implementation-playbook.md +504 -0
- package/skills/sql-pro/SKILL.md +173 -0
- package/skills/startup-analyst/SKILL.md +328 -0
- package/skills/startup-business-analyst-business-case/SKILL.md +487 -0
- package/skills/startup-business-analyst-financial-projections/SKILL.md +353 -0
- package/skills/startup-business-analyst-market-opportunity/SKILL.md +240 -0
- package/skills/startup-financial-modeling/SKILL.md +467 -0
- package/skills/startup-metrics-framework/SKILL.md +34 -0
- package/skills/startup-metrics-framework/resources/implementation-playbook.md +500 -0
- package/skills/stride-analysis-patterns/SKILL.md +33 -0
- package/skills/stride-analysis-patterns/resources/implementation-playbook.md +655 -0
- package/skills/stripe-integration/SKILL.md +454 -0
- package/skills/systems-programming-rust-project/SKILL.md +440 -0
- package/skills/tailwind-design-system/SKILL.md +33 -0
- package/skills/tailwind-design-system/resources/implementation-playbook.md +665 -0
- package/skills/tdd-orchestrator/SKILL.md +205 -0
- package/skills/tdd-workflows-tdd-cycle/SKILL.md +221 -0
- package/skills/tdd-workflows-tdd-green/SKILL.md +73 -0
- package/skills/tdd-workflows-tdd-green/resources/implementation-playbook.md +870 -0
- package/skills/tdd-workflows-tdd-red/SKILL.md +164 -0
- package/skills/tdd-workflows-tdd-refactor/SKILL.md +187 -0
- package/skills/team-collaboration-issue/SKILL.md +37 -0
- package/skills/team-collaboration-issue/resources/implementation-playbook.md +640 -0
- package/skills/team-collaboration-standup-notes/SKILL.md +44 -0
- package/skills/team-collaboration-standup-notes/resources/implementation-playbook.md +768 -0
- package/skills/team-composition-analysis/SKILL.md +413 -0
- package/skills/temporal-python-pro/SKILL.md +370 -0
- package/skills/temporal-python-testing/SKILL.md +170 -0
- package/skills/temporal-python-testing/resources/integration-testing.md +455 -0
- package/skills/temporal-python-testing/resources/local-setup.md +553 -0
- package/skills/temporal-python-testing/resources/replay-testing.md +462 -0
- package/skills/temporal-python-testing/resources/unit-testing.md +328 -0
- package/skills/terraform-module-library/SKILL.md +261 -0
- package/skills/terraform-module-library/references/aws-modules.md +63 -0
- package/skills/terraform-specialist/SKILL.md +166 -0
- package/skills/test-automator/SKILL.md +224 -0
- package/skills/threat-mitigation-mapping/SKILL.md +33 -0
- package/skills/threat-mitigation-mapping/resources/implementation-playbook.md +744 -0
- package/skills/threat-modeling-expert/SKILL.md +60 -0
- package/skills/track-management/SKILL.md +38 -0
- package/skills/track-management/resources/implementation-playbook.md +591 -0
- package/skills/turborepo-caching/SKILL.md +419 -0
- package/skills/tutorial-engineer/SKILL.md +139 -0
- package/skills/typescript-advanced-types/SKILL.md +35 -0
- package/skills/typescript-advanced-types/resources/implementation-playbook.md +716 -0
- package/skills/typescript-pro/SKILL.md +55 -0
- package/skills/ui-minimal/SKILL.md +23 -0
- package/skills/ui-ux-designer/SKILL.md +209 -0
- package/skills/ui-visual-validator/SKILL.md +214 -0
- package/skills/unit-testing-test-generate/SKILL.md +319 -0
- package/skills/unity-developer/SKILL.md +230 -0
- package/skills/unity-ecs-patterns/SKILL.md +33 -0
- package/skills/unity-ecs-patterns/resources/implementation-playbook.md +625 -0
- package/skills/uv-package-manager/SKILL.md +37 -0
- package/skills/uv-package-manager/resources/implementation-playbook.md +830 -0
- package/skills/vector-database-engineer/SKILL.md +60 -0
- package/skills/vector-index-tuning/SKILL.md +42 -0
- package/skills/vector-index-tuning/resources/implementation-playbook.md +507 -0
- package/skills/wcag-audit-patterns/SKILL.md +41 -0
- package/skills/wcag-audit-patterns/resources/implementation-playbook.md +541 -0
- package/skills/web3-testing/SKILL.md +427 -0
- package/skills/workflow-orchestration-patterns/SKILL.md +333 -0
- package/skills/workflow-patterns/SKILL.md +38 -0
- package/skills/workflow-patterns/resources/implementation-playbook.md +621 -0
|
@@ -0,0 +1,869 @@
|
|
|
1
|
+
# Python Packaging Implementation Playbook
|
|
2
|
+
|
|
3
|
+
This file contains detailed patterns, checklists, and code samples referenced by the skill.
|
|
4
|
+
|
|
5
|
+
# Python Packaging
|
|
6
|
+
|
|
7
|
+
Comprehensive guide to creating, structuring, and distributing Python packages using modern packaging tools, pyproject.toml, and publishing to PyPI.
|
|
8
|
+
|
|
9
|
+
## When to Use This Skill
|
|
10
|
+
|
|
11
|
+
- Creating Python libraries for distribution
|
|
12
|
+
- Building command-line tools with entry points
|
|
13
|
+
- Publishing packages to PyPI or private repositories
|
|
14
|
+
- Setting up Python project structure
|
|
15
|
+
- Creating installable packages with dependencies
|
|
16
|
+
- Building wheels and source distributions
|
|
17
|
+
- Versioning and releasing Python packages
|
|
18
|
+
- Creating namespace packages
|
|
19
|
+
- Implementing package metadata and classifiers
|
|
20
|
+
|
|
21
|
+
## Core Concepts
|
|
22
|
+
|
|
23
|
+
### 1. Package Structure
|
|
24
|
+
- **Source layout**: `src/package_name/` (recommended)
|
|
25
|
+
- **Flat layout**: `package_name/` (simpler but less flexible)
|
|
26
|
+
- **Package metadata**: pyproject.toml, setup.py, or setup.cfg
|
|
27
|
+
- **Distribution formats**: wheel (.whl) and source distribution (.tar.gz)
|
|
28
|
+
|
|
29
|
+
### 2. Modern Packaging Standards
|
|
30
|
+
- **PEP 517/518**: Build system requirements
|
|
31
|
+
- **PEP 621**: Metadata in pyproject.toml
|
|
32
|
+
- **PEP 660**: Editable installs
|
|
33
|
+
- **pyproject.toml**: Single source of configuration
|
|
34
|
+
|
|
35
|
+
### 3. Build Backends
|
|
36
|
+
- **setuptools**: Traditional, widely used
|
|
37
|
+
- **hatchling**: Modern, opinionated
|
|
38
|
+
- **flit**: Lightweight, for pure Python
|
|
39
|
+
- **poetry**: Dependency management + packaging
|
|
40
|
+
|
|
41
|
+
### 4. Distribution
|
|
42
|
+
- **PyPI**: Python Package Index (public)
|
|
43
|
+
- **TestPyPI**: Testing before production
|
|
44
|
+
- **Private repositories**: JFrog, AWS CodeArtifact, etc.
|
|
45
|
+
|
|
46
|
+
## Quick Start
|
|
47
|
+
|
|
48
|
+
### Minimal Package Structure
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
my-package/
|
|
52
|
+
├── pyproject.toml
|
|
53
|
+
├── README.md
|
|
54
|
+
├── LICENSE
|
|
55
|
+
├── src/
|
|
56
|
+
│ └── my_package/
|
|
57
|
+
│ ├── __init__.py
|
|
58
|
+
│ └── module.py
|
|
59
|
+
└── tests/
|
|
60
|
+
└── test_module.py
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Minimal pyproject.toml
|
|
64
|
+
|
|
65
|
+
```toml
|
|
66
|
+
[build-system]
|
|
67
|
+
requires = ["setuptools>=61.0"]
|
|
68
|
+
build-backend = "setuptools.build_meta"
|
|
69
|
+
|
|
70
|
+
[project]
|
|
71
|
+
name = "my-package"
|
|
72
|
+
version = "0.1.0"
|
|
73
|
+
description = "A short description"
|
|
74
|
+
authors = [{name = "Your Name", email = "you@example.com"}]
|
|
75
|
+
readme = "README.md"
|
|
76
|
+
requires-python = ">=3.8"
|
|
77
|
+
dependencies = [
|
|
78
|
+
"requests>=2.28.0",
|
|
79
|
+
]
|
|
80
|
+
|
|
81
|
+
[project.optional-dependencies]
|
|
82
|
+
dev = [
|
|
83
|
+
"pytest>=7.0",
|
|
84
|
+
"black>=22.0",
|
|
85
|
+
]
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Package Structure Patterns
|
|
89
|
+
|
|
90
|
+
### Pattern 1: Source Layout (Recommended)
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
my-package/
|
|
94
|
+
├── pyproject.toml
|
|
95
|
+
├── README.md
|
|
96
|
+
├── LICENSE
|
|
97
|
+
├── .gitignore
|
|
98
|
+
├── src/
|
|
99
|
+
│ └── my_package/
|
|
100
|
+
│ ├── __init__.py
|
|
101
|
+
│ ├── core.py
|
|
102
|
+
│ ├── utils.py
|
|
103
|
+
│ └── py.typed # For type hints
|
|
104
|
+
├── tests/
|
|
105
|
+
│ ├── __init__.py
|
|
106
|
+
│ ├── test_core.py
|
|
107
|
+
│ └── test_utils.py
|
|
108
|
+
└── docs/
|
|
109
|
+
└── index.md
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
**Advantages:**
|
|
113
|
+
- Prevents accidentally importing from source
|
|
114
|
+
- Cleaner test imports
|
|
115
|
+
- Better isolation
|
|
116
|
+
|
|
117
|
+
**pyproject.toml for source layout:**
|
|
118
|
+
```toml
|
|
119
|
+
[tool.setuptools.packages.find]
|
|
120
|
+
where = ["src"]
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Pattern 2: Flat Layout
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
my-package/
|
|
127
|
+
├── pyproject.toml
|
|
128
|
+
├── README.md
|
|
129
|
+
├── my_package/
|
|
130
|
+
│ ├── __init__.py
|
|
131
|
+
│ └── module.py
|
|
132
|
+
└── tests/
|
|
133
|
+
└── test_module.py
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
**Simpler but:**
|
|
137
|
+
- Can import package without installing
|
|
138
|
+
- Less professional for libraries
|
|
139
|
+
|
|
140
|
+
### Pattern 3: Multi-Package Project
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
project/
|
|
144
|
+
├── pyproject.toml
|
|
145
|
+
├── packages/
|
|
146
|
+
│ ├── package-a/
|
|
147
|
+
│ │ └── src/
|
|
148
|
+
│ │ └── package_a/
|
|
149
|
+
│ └── package-b/
|
|
150
|
+
│ └── src/
|
|
151
|
+
│ └── package_b/
|
|
152
|
+
└── tests/
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Complete pyproject.toml Examples
|
|
156
|
+
|
|
157
|
+
### Pattern 4: Full-Featured pyproject.toml
|
|
158
|
+
|
|
159
|
+
```toml
|
|
160
|
+
[build-system]
|
|
161
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
162
|
+
build-backend = "setuptools.build_meta"
|
|
163
|
+
|
|
164
|
+
[project]
|
|
165
|
+
name = "my-awesome-package"
|
|
166
|
+
version = "1.0.0"
|
|
167
|
+
description = "An awesome Python package"
|
|
168
|
+
readme = "README.md"
|
|
169
|
+
requires-python = ">=3.8"
|
|
170
|
+
license = {text = "MIT"}
|
|
171
|
+
authors = [
|
|
172
|
+
{name = "Your Name", email = "you@example.com"},
|
|
173
|
+
]
|
|
174
|
+
maintainers = [
|
|
175
|
+
{name = "Maintainer Name", email = "maintainer@example.com"},
|
|
176
|
+
]
|
|
177
|
+
keywords = ["example", "package", "awesome"]
|
|
178
|
+
classifiers = [
|
|
179
|
+
"Development Status :: 4 - Beta",
|
|
180
|
+
"Intended Audience :: Developers",
|
|
181
|
+
"License :: OSI Approved :: MIT License",
|
|
182
|
+
"Programming Language :: Python :: 3",
|
|
183
|
+
"Programming Language :: Python :: 3.8",
|
|
184
|
+
"Programming Language :: Python :: 3.9",
|
|
185
|
+
"Programming Language :: Python :: 3.10",
|
|
186
|
+
"Programming Language :: Python :: 3.11",
|
|
187
|
+
"Programming Language :: Python :: 3.12",
|
|
188
|
+
]
|
|
189
|
+
|
|
190
|
+
dependencies = [
|
|
191
|
+
"requests>=2.28.0,<3.0.0",
|
|
192
|
+
"click>=8.0.0",
|
|
193
|
+
"pydantic>=2.0.0",
|
|
194
|
+
]
|
|
195
|
+
|
|
196
|
+
[project.optional-dependencies]
|
|
197
|
+
dev = [
|
|
198
|
+
"pytest>=7.0.0",
|
|
199
|
+
"pytest-cov>=4.0.0",
|
|
200
|
+
"black>=23.0.0",
|
|
201
|
+
"ruff>=0.1.0",
|
|
202
|
+
"mypy>=1.0.0",
|
|
203
|
+
]
|
|
204
|
+
docs = [
|
|
205
|
+
"sphinx>=5.0.0",
|
|
206
|
+
"sphinx-rtd-theme>=1.0.0",
|
|
207
|
+
]
|
|
208
|
+
all = [
|
|
209
|
+
"my-awesome-package[dev,docs]",
|
|
210
|
+
]
|
|
211
|
+
|
|
212
|
+
[project.urls]
|
|
213
|
+
Homepage = "https://github.com/username/my-awesome-package"
|
|
214
|
+
Documentation = "https://my-awesome-package.readthedocs.io"
|
|
215
|
+
Repository = "https://github.com/username/my-awesome-package"
|
|
216
|
+
"Bug Tracker" = "https://github.com/username/my-awesome-package/issues"
|
|
217
|
+
Changelog = "https://github.com/username/my-awesome-package/blob/main/CHANGELOG.md"
|
|
218
|
+
|
|
219
|
+
[project.scripts]
|
|
220
|
+
my-cli = "my_package.cli:main"
|
|
221
|
+
awesome-tool = "my_package.tools:run"
|
|
222
|
+
|
|
223
|
+
[project.entry-points."my_package.plugins"]
|
|
224
|
+
plugin1 = "my_package.plugins:plugin1"
|
|
225
|
+
|
|
226
|
+
[tool.setuptools]
|
|
227
|
+
package-dir = {"" = "src"}
|
|
228
|
+
zip-safe = false
|
|
229
|
+
|
|
230
|
+
[tool.setuptools.packages.find]
|
|
231
|
+
where = ["src"]
|
|
232
|
+
include = ["my_package*"]
|
|
233
|
+
exclude = ["tests*"]
|
|
234
|
+
|
|
235
|
+
[tool.setuptools.package-data]
|
|
236
|
+
my_package = ["py.typed", "*.pyi", "data/*.json"]
|
|
237
|
+
|
|
238
|
+
# Black configuration
|
|
239
|
+
[tool.black]
|
|
240
|
+
line-length = 100
|
|
241
|
+
target-version = ["py38", "py39", "py310", "py311"]
|
|
242
|
+
include = '\.pyi?$'
|
|
243
|
+
|
|
244
|
+
# Ruff configuration
|
|
245
|
+
[tool.ruff]
|
|
246
|
+
line-length = 100
|
|
247
|
+
target-version = "py38"
|
|
248
|
+
|
|
249
|
+
[tool.ruff.lint]
|
|
250
|
+
select = ["E", "F", "I", "N", "W", "UP"]
|
|
251
|
+
|
|
252
|
+
# MyPy configuration
|
|
253
|
+
[tool.mypy]
|
|
254
|
+
python_version = "3.8"
|
|
255
|
+
warn_return_any = true
|
|
256
|
+
warn_unused_configs = true
|
|
257
|
+
disallow_untyped_defs = true
|
|
258
|
+
|
|
259
|
+
# Pytest configuration
|
|
260
|
+
[tool.pytest.ini_options]
|
|
261
|
+
testpaths = ["tests"]
|
|
262
|
+
python_files = ["test_*.py"]
|
|
263
|
+
addopts = "-v --cov=my_package --cov-report=term-missing"
|
|
264
|
+
|
|
265
|
+
# Coverage configuration
|
|
266
|
+
[tool.coverage.run]
|
|
267
|
+
source = ["src"]
|
|
268
|
+
omit = ["*/tests/*"]
|
|
269
|
+
|
|
270
|
+
[tool.coverage.report]
|
|
271
|
+
exclude_lines = [
|
|
272
|
+
"pragma: no cover",
|
|
273
|
+
"def __repr__",
|
|
274
|
+
"raise AssertionError",
|
|
275
|
+
"raise NotImplementedError",
|
|
276
|
+
]
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Pattern 5: Dynamic Versioning
|
|
280
|
+
|
|
281
|
+
```toml
|
|
282
|
+
[build-system]
|
|
283
|
+
requires = ["setuptools>=61.0", "setuptools-scm>=8.0"]
|
|
284
|
+
build-backend = "setuptools.build_meta"
|
|
285
|
+
|
|
286
|
+
[project]
|
|
287
|
+
name = "my-package"
|
|
288
|
+
dynamic = ["version"]
|
|
289
|
+
description = "Package with dynamic version"
|
|
290
|
+
|
|
291
|
+
[tool.setuptools.dynamic]
|
|
292
|
+
version = {attr = "my_package.__version__"}
|
|
293
|
+
|
|
294
|
+
# Or use setuptools-scm for git-based versioning
|
|
295
|
+
[tool.setuptools_scm]
|
|
296
|
+
write_to = "src/my_package/_version.py"
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
**In __init__.py:**
|
|
300
|
+
```python
|
|
301
|
+
# src/my_package/__init__.py
|
|
302
|
+
__version__ = "1.0.0"
|
|
303
|
+
|
|
304
|
+
# Or with setuptools-scm
|
|
305
|
+
from importlib.metadata import version
|
|
306
|
+
__version__ = version("my-package")
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
## Command-Line Interface (CLI) Patterns
|
|
310
|
+
|
|
311
|
+
### Pattern 6: CLI with Click
|
|
312
|
+
|
|
313
|
+
```python
|
|
314
|
+
# src/my_package/cli.py
|
|
315
|
+
import click
|
|
316
|
+
|
|
317
|
+
@click.group()
|
|
318
|
+
@click.version_option()
|
|
319
|
+
def cli():
|
|
320
|
+
"""My awesome CLI tool."""
|
|
321
|
+
pass
|
|
322
|
+
|
|
323
|
+
@cli.command()
|
|
324
|
+
@click.argument("name")
|
|
325
|
+
@click.option("--greeting", default="Hello", help="Greeting to use")
|
|
326
|
+
def greet(name: str, greeting: str):
|
|
327
|
+
"""Greet someone."""
|
|
328
|
+
click.echo(f"{greeting}, {name}!")
|
|
329
|
+
|
|
330
|
+
@cli.command()
|
|
331
|
+
@click.option("--count", default=1, help="Number of times to repeat")
|
|
332
|
+
def repeat(count: int):
|
|
333
|
+
"""Repeat a message."""
|
|
334
|
+
for i in range(count):
|
|
335
|
+
click.echo(f"Message {i + 1}")
|
|
336
|
+
|
|
337
|
+
def main():
|
|
338
|
+
"""Entry point for CLI."""
|
|
339
|
+
cli()
|
|
340
|
+
|
|
341
|
+
if __name__ == "__main__":
|
|
342
|
+
main()
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
**Register in pyproject.toml:**
|
|
346
|
+
```toml
|
|
347
|
+
[project.scripts]
|
|
348
|
+
my-tool = "my_package.cli:main"
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
**Usage:**
|
|
352
|
+
```bash
|
|
353
|
+
pip install -e .
|
|
354
|
+
my-tool greet World
|
|
355
|
+
my-tool greet Alice --greeting="Hi"
|
|
356
|
+
my-tool repeat --count=3
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
### Pattern 7: CLI with argparse
|
|
360
|
+
|
|
361
|
+
```python
|
|
362
|
+
# src/my_package/cli.py
|
|
363
|
+
import argparse
|
|
364
|
+
import sys
|
|
365
|
+
|
|
366
|
+
def main():
|
|
367
|
+
"""Main CLI entry point."""
|
|
368
|
+
parser = argparse.ArgumentParser(
|
|
369
|
+
description="My awesome tool",
|
|
370
|
+
prog="my-tool"
|
|
371
|
+
)
|
|
372
|
+
|
|
373
|
+
parser.add_argument(
|
|
374
|
+
"--version",
|
|
375
|
+
action="version",
|
|
376
|
+
version="%(prog)s 1.0.0"
|
|
377
|
+
)
|
|
378
|
+
|
|
379
|
+
subparsers = parser.add_subparsers(dest="command", help="Commands")
|
|
380
|
+
|
|
381
|
+
# Add subcommand
|
|
382
|
+
process_parser = subparsers.add_parser("process", help="Process data")
|
|
383
|
+
process_parser.add_argument("input_file", help="Input file path")
|
|
384
|
+
process_parser.add_argument(
|
|
385
|
+
"--output", "-o",
|
|
386
|
+
default="output.txt",
|
|
387
|
+
help="Output file path"
|
|
388
|
+
)
|
|
389
|
+
|
|
390
|
+
args = parser.parse_args()
|
|
391
|
+
|
|
392
|
+
if args.command == "process":
|
|
393
|
+
process_data(args.input_file, args.output)
|
|
394
|
+
else:
|
|
395
|
+
parser.print_help()
|
|
396
|
+
sys.exit(1)
|
|
397
|
+
|
|
398
|
+
def process_data(input_file: str, output_file: str):
|
|
399
|
+
"""Process data from input to output."""
|
|
400
|
+
print(f"Processing {input_file} -> {output_file}")
|
|
401
|
+
|
|
402
|
+
if __name__ == "__main__":
|
|
403
|
+
main()
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
## Building and Publishing
|
|
407
|
+
|
|
408
|
+
### Pattern 8: Build Package Locally
|
|
409
|
+
|
|
410
|
+
```bash
|
|
411
|
+
# Install build tools
|
|
412
|
+
pip install build twine
|
|
413
|
+
|
|
414
|
+
# Build distribution
|
|
415
|
+
python -m build
|
|
416
|
+
|
|
417
|
+
# This creates:
|
|
418
|
+
# dist/
|
|
419
|
+
# my-package-1.0.0.tar.gz (source distribution)
|
|
420
|
+
# my_package-1.0.0-py3-none-any.whl (wheel)
|
|
421
|
+
|
|
422
|
+
# Check the distribution
|
|
423
|
+
twine check dist/*
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
### Pattern 9: Publishing to PyPI
|
|
427
|
+
|
|
428
|
+
```bash
|
|
429
|
+
# Install publishing tools
|
|
430
|
+
pip install twine
|
|
431
|
+
|
|
432
|
+
# Test on TestPyPI first
|
|
433
|
+
twine upload --repository testpypi dist/*
|
|
434
|
+
|
|
435
|
+
# Install from TestPyPI to test
|
|
436
|
+
pip install --index-url https://test.pypi.org/simple/ my-package
|
|
437
|
+
|
|
438
|
+
# If all good, publish to PyPI
|
|
439
|
+
twine upload dist/*
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
**Using API tokens (recommended):**
|
|
443
|
+
```bash
|
|
444
|
+
# Create ~/.pypirc
|
|
445
|
+
[distutils]
|
|
446
|
+
index-servers =
|
|
447
|
+
pypi
|
|
448
|
+
testpypi
|
|
449
|
+
|
|
450
|
+
[pypi]
|
|
451
|
+
username = __token__
|
|
452
|
+
password = pypi-...your-token...
|
|
453
|
+
|
|
454
|
+
[testpypi]
|
|
455
|
+
username = __token__
|
|
456
|
+
password = pypi-...your-test-token...
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
### Pattern 10: Automated Publishing with GitHub Actions
|
|
460
|
+
|
|
461
|
+
```yaml
|
|
462
|
+
# .github/workflows/publish.yml
|
|
463
|
+
name: Publish to PyPI
|
|
464
|
+
|
|
465
|
+
on:
|
|
466
|
+
release:
|
|
467
|
+
types: [created]
|
|
468
|
+
|
|
469
|
+
jobs:
|
|
470
|
+
publish:
|
|
471
|
+
runs-on: ubuntu-latest
|
|
472
|
+
|
|
473
|
+
steps:
|
|
474
|
+
- uses: actions/checkout@v3
|
|
475
|
+
|
|
476
|
+
- name: Set up Python
|
|
477
|
+
uses: actions/setup-python@v4
|
|
478
|
+
with:
|
|
479
|
+
python-version: "3.11"
|
|
480
|
+
|
|
481
|
+
- name: Install dependencies
|
|
482
|
+
run: |
|
|
483
|
+
pip install build twine
|
|
484
|
+
|
|
485
|
+
- name: Build package
|
|
486
|
+
run: python -m build
|
|
487
|
+
|
|
488
|
+
- name: Check package
|
|
489
|
+
run: twine check dist/*
|
|
490
|
+
|
|
491
|
+
- name: Publish to PyPI
|
|
492
|
+
env:
|
|
493
|
+
TWINE_USERNAME: __token__
|
|
494
|
+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
|
|
495
|
+
run: twine upload dist/*
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
## Advanced Patterns
|
|
499
|
+
|
|
500
|
+
### Pattern 11: Including Data Files
|
|
501
|
+
|
|
502
|
+
```toml
|
|
503
|
+
[tool.setuptools.package-data]
|
|
504
|
+
my_package = [
|
|
505
|
+
"data/*.json",
|
|
506
|
+
"templates/*.html",
|
|
507
|
+
"static/css/*.css",
|
|
508
|
+
"py.typed",
|
|
509
|
+
]
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
**Accessing data files:**
|
|
513
|
+
```python
|
|
514
|
+
# src/my_package/loader.py
|
|
515
|
+
from importlib.resources import files
|
|
516
|
+
import json
|
|
517
|
+
|
|
518
|
+
def load_config():
|
|
519
|
+
"""Load configuration from package data."""
|
|
520
|
+
config_file = files("my_package").joinpath("data/config.json")
|
|
521
|
+
with config_file.open() as f:
|
|
522
|
+
return json.load(f)
|
|
523
|
+
|
|
524
|
+
# Python 3.9+
|
|
525
|
+
from importlib.resources import files
|
|
526
|
+
|
|
527
|
+
data = files("my_package").joinpath("data/file.txt").read_text()
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
### Pattern 12: Namespace Packages
|
|
531
|
+
|
|
532
|
+
**For large projects split across multiple repositories:**
|
|
533
|
+
|
|
534
|
+
```
|
|
535
|
+
# Package 1: company-core
|
|
536
|
+
company/
|
|
537
|
+
└── core/
|
|
538
|
+
├── __init__.py
|
|
539
|
+
└── models.py
|
|
540
|
+
|
|
541
|
+
# Package 2: company-api
|
|
542
|
+
company/
|
|
543
|
+
└── api/
|
|
544
|
+
├── __init__.py
|
|
545
|
+
└── routes.py
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
**Do NOT include __init__.py in the namespace directory (company/):**
|
|
549
|
+
|
|
550
|
+
```toml
|
|
551
|
+
# company-core/pyproject.toml
|
|
552
|
+
[project]
|
|
553
|
+
name = "company-core"
|
|
554
|
+
|
|
555
|
+
[tool.setuptools.packages.find]
|
|
556
|
+
where = ["."]
|
|
557
|
+
include = ["company.core*"]
|
|
558
|
+
|
|
559
|
+
# company-api/pyproject.toml
|
|
560
|
+
[project]
|
|
561
|
+
name = "company-api"
|
|
562
|
+
|
|
563
|
+
[tool.setuptools.packages.find]
|
|
564
|
+
where = ["."]
|
|
565
|
+
include = ["company.api*"]
|
|
566
|
+
```
|
|
567
|
+
|
|
568
|
+
**Usage:**
|
|
569
|
+
```python
|
|
570
|
+
# Both packages can be imported under same namespace
|
|
571
|
+
from company.core import models
|
|
572
|
+
from company.api import routes
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
### Pattern 13: C Extensions
|
|
576
|
+
|
|
577
|
+
```toml
|
|
578
|
+
[build-system]
|
|
579
|
+
requires = ["setuptools>=61.0", "wheel", "Cython>=0.29"]
|
|
580
|
+
build-backend = "setuptools.build_meta"
|
|
581
|
+
|
|
582
|
+
[tool.setuptools]
|
|
583
|
+
ext-modules = [
|
|
584
|
+
{name = "my_package.fast_module", sources = ["src/fast_module.c"]},
|
|
585
|
+
]
|
|
586
|
+
```
|
|
587
|
+
|
|
588
|
+
**Or with setup.py:**
|
|
589
|
+
```python
|
|
590
|
+
# setup.py
|
|
591
|
+
from setuptools import setup, Extension
|
|
592
|
+
|
|
593
|
+
setup(
|
|
594
|
+
ext_modules=[
|
|
595
|
+
Extension(
|
|
596
|
+
"my_package.fast_module",
|
|
597
|
+
sources=["src/fast_module.c"],
|
|
598
|
+
include_dirs=["src/include"],
|
|
599
|
+
)
|
|
600
|
+
]
|
|
601
|
+
)
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
## Version Management
|
|
605
|
+
|
|
606
|
+
### Pattern 14: Semantic Versioning
|
|
607
|
+
|
|
608
|
+
```python
|
|
609
|
+
# src/my_package/__init__.py
|
|
610
|
+
__version__ = "1.2.3"
|
|
611
|
+
|
|
612
|
+
# Semantic versioning: MAJOR.MINOR.PATCH
|
|
613
|
+
# MAJOR: Breaking changes
|
|
614
|
+
# MINOR: New features (backward compatible)
|
|
615
|
+
# PATCH: Bug fixes
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
**Version constraints in dependencies:**
|
|
619
|
+
```toml
|
|
620
|
+
dependencies = [
|
|
621
|
+
"requests>=2.28.0,<3.0.0", # Compatible range
|
|
622
|
+
"click~=8.1.0", # Compatible release (~= 8.1.0 means >=8.1.0,<8.2.0)
|
|
623
|
+
"pydantic>=2.0", # Minimum version
|
|
624
|
+
"numpy==1.24.3", # Exact version (avoid if possible)
|
|
625
|
+
]
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
### Pattern 15: Git-Based Versioning
|
|
629
|
+
|
|
630
|
+
```toml
|
|
631
|
+
[build-system]
|
|
632
|
+
requires = ["setuptools>=61.0", "setuptools-scm>=8.0"]
|
|
633
|
+
build-backend = "setuptools.build_meta"
|
|
634
|
+
|
|
635
|
+
[project]
|
|
636
|
+
name = "my-package"
|
|
637
|
+
dynamic = ["version"]
|
|
638
|
+
|
|
639
|
+
[tool.setuptools_scm]
|
|
640
|
+
write_to = "src/my_package/_version.py"
|
|
641
|
+
version_scheme = "post-release"
|
|
642
|
+
local_scheme = "dirty-tag"
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
**Creates versions like:**
|
|
646
|
+
- `1.0.0` (from git tag)
|
|
647
|
+
- `1.0.1.dev3+g1234567` (3 commits after tag)
|
|
648
|
+
|
|
649
|
+
## Testing Installation
|
|
650
|
+
|
|
651
|
+
### Pattern 16: Editable Install
|
|
652
|
+
|
|
653
|
+
```bash
|
|
654
|
+
# Install in development mode
|
|
655
|
+
pip install -e .
|
|
656
|
+
|
|
657
|
+
# With optional dependencies
|
|
658
|
+
pip install -e ".[dev]"
|
|
659
|
+
pip install -e ".[dev,docs]"
|
|
660
|
+
|
|
661
|
+
# Now changes to source code are immediately reflected
|
|
662
|
+
```
|
|
663
|
+
|
|
664
|
+
### Pattern 17: Testing in Isolated Environment
|
|
665
|
+
|
|
666
|
+
```bash
|
|
667
|
+
# Create virtual environment
|
|
668
|
+
python -m venv test-env
|
|
669
|
+
source test-env/bin/activate # Linux/Mac
|
|
670
|
+
# test-env\Scripts\activate # Windows
|
|
671
|
+
|
|
672
|
+
# Install package
|
|
673
|
+
pip install dist/my_package-1.0.0-py3-none-any.whl
|
|
674
|
+
|
|
675
|
+
# Test it works
|
|
676
|
+
python -c "import my_package; print(my_package.__version__)"
|
|
677
|
+
|
|
678
|
+
# Test CLI
|
|
679
|
+
my-tool --help
|
|
680
|
+
|
|
681
|
+
# Cleanup
|
|
682
|
+
deactivate
|
|
683
|
+
rm -rf test-env
|
|
684
|
+
```
|
|
685
|
+
|
|
686
|
+
## Documentation
|
|
687
|
+
|
|
688
|
+
### Pattern 18: README.md Template
|
|
689
|
+
|
|
690
|
+
```markdown
|
|
691
|
+
# My Package
|
|
692
|
+
|
|
693
|
+
[](https://pypi.org/project/my-package/)
|
|
694
|
+
[](https://pypi.org/project/my-package/)
|
|
695
|
+
[](https://github.com/username/my-package/actions)
|
|
696
|
+
|
|
697
|
+
Brief description of your package.
|
|
698
|
+
|
|
699
|
+
## Installation
|
|
700
|
+
|
|
701
|
+
```bash
|
|
702
|
+
pip install my-package
|
|
703
|
+
```
|
|
704
|
+
|
|
705
|
+
## Quick Start
|
|
706
|
+
|
|
707
|
+
```python
|
|
708
|
+
from my_package import something
|
|
709
|
+
|
|
710
|
+
result = something.do_stuff()
|
|
711
|
+
```
|
|
712
|
+
|
|
713
|
+
## Features
|
|
714
|
+
|
|
715
|
+
- Feature 1
|
|
716
|
+
- Feature 2
|
|
717
|
+
- Feature 3
|
|
718
|
+
|
|
719
|
+
## Documentation
|
|
720
|
+
|
|
721
|
+
Full documentation: https://my-package.readthedocs.io
|
|
722
|
+
|
|
723
|
+
## Development
|
|
724
|
+
|
|
725
|
+
```bash
|
|
726
|
+
git clone https://github.com/username/my-package.git
|
|
727
|
+
cd my-package
|
|
728
|
+
pip install -e ".[dev]"
|
|
729
|
+
pytest
|
|
730
|
+
```
|
|
731
|
+
|
|
732
|
+
## License
|
|
733
|
+
|
|
734
|
+
MIT
|
|
735
|
+
```
|
|
736
|
+
|
|
737
|
+
## Common Patterns
|
|
738
|
+
|
|
739
|
+
### Pattern 19: Multi-Architecture Wheels
|
|
740
|
+
|
|
741
|
+
```yaml
|
|
742
|
+
# .github/workflows/wheels.yml
|
|
743
|
+
name: Build wheels
|
|
744
|
+
|
|
745
|
+
on: [push, pull_request]
|
|
746
|
+
|
|
747
|
+
jobs:
|
|
748
|
+
build_wheels:
|
|
749
|
+
name: Build wheels on ${{ matrix.os }}
|
|
750
|
+
runs-on: ${{ matrix.os }}
|
|
751
|
+
strategy:
|
|
752
|
+
matrix:
|
|
753
|
+
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
754
|
+
|
|
755
|
+
steps:
|
|
756
|
+
- uses: actions/checkout@v3
|
|
757
|
+
|
|
758
|
+
- name: Build wheels
|
|
759
|
+
uses: pypa/cibuildwheel@v2.16.2
|
|
760
|
+
|
|
761
|
+
- uses: actions/upload-artifact@v3
|
|
762
|
+
with:
|
|
763
|
+
path: ./wheelhouse/*.whl
|
|
764
|
+
```
|
|
765
|
+
|
|
766
|
+
### Pattern 20: Private Package Index
|
|
767
|
+
|
|
768
|
+
```bash
|
|
769
|
+
# Install from private index
|
|
770
|
+
pip install my-package --index-url https://private.pypi.org/simple/
|
|
771
|
+
|
|
772
|
+
# Or add to pip.conf
|
|
773
|
+
[global]
|
|
774
|
+
index-url = https://private.pypi.org/simple/
|
|
775
|
+
extra-index-url = https://pypi.org/simple/
|
|
776
|
+
|
|
777
|
+
# Upload to private index
|
|
778
|
+
twine upload --repository-url https://private.pypi.org/ dist/*
|
|
779
|
+
```
|
|
780
|
+
|
|
781
|
+
## File Templates
|
|
782
|
+
|
|
783
|
+
### .gitignore for Python Packages
|
|
784
|
+
|
|
785
|
+
```gitignore
|
|
786
|
+
# Build artifacts
|
|
787
|
+
build/
|
|
788
|
+
dist/
|
|
789
|
+
*.egg-info/
|
|
790
|
+
*.egg
|
|
791
|
+
.eggs/
|
|
792
|
+
|
|
793
|
+
# Python
|
|
794
|
+
__pycache__/
|
|
795
|
+
*.py[cod]
|
|
796
|
+
*$py.class
|
|
797
|
+
*.so
|
|
798
|
+
|
|
799
|
+
# Virtual environments
|
|
800
|
+
venv/
|
|
801
|
+
env/
|
|
802
|
+
ENV/
|
|
803
|
+
|
|
804
|
+
# IDE
|
|
805
|
+
.vscode/
|
|
806
|
+
.idea/
|
|
807
|
+
*.swp
|
|
808
|
+
|
|
809
|
+
# Testing
|
|
810
|
+
.pytest_cache/
|
|
811
|
+
.coverage
|
|
812
|
+
htmlcov/
|
|
813
|
+
|
|
814
|
+
# Distribution
|
|
815
|
+
*.whl
|
|
816
|
+
*.tar.gz
|
|
817
|
+
```
|
|
818
|
+
|
|
819
|
+
### MANIFEST.in
|
|
820
|
+
|
|
821
|
+
```
|
|
822
|
+
# MANIFEST.in
|
|
823
|
+
include README.md
|
|
824
|
+
include LICENSE
|
|
825
|
+
include pyproject.toml
|
|
826
|
+
|
|
827
|
+
recursive-include src/my_package/data *.json
|
|
828
|
+
recursive-include src/my_package/templates *.html
|
|
829
|
+
recursive-exclude * __pycache__
|
|
830
|
+
recursive-exclude * *.py[co]
|
|
831
|
+
```
|
|
832
|
+
|
|
833
|
+
## Checklist for Publishing
|
|
834
|
+
|
|
835
|
+
- [ ] Code is tested (pytest passing)
|
|
836
|
+
- [ ] Documentation is complete (README, docstrings)
|
|
837
|
+
- [ ] Version number updated
|
|
838
|
+
- [ ] CHANGELOG.md updated
|
|
839
|
+
- [ ] License file included
|
|
840
|
+
- [ ] pyproject.toml is complete
|
|
841
|
+
- [ ] Package builds without errors
|
|
842
|
+
- [ ] Installation tested in clean environment
|
|
843
|
+
- [ ] CLI tools work (if applicable)
|
|
844
|
+
- [ ] PyPI metadata is correct (classifiers, keywords)
|
|
845
|
+
- [ ] GitHub repository linked
|
|
846
|
+
- [ ] Tested on TestPyPI first
|
|
847
|
+
- [ ] Git tag created for release
|
|
848
|
+
|
|
849
|
+
## Resources
|
|
850
|
+
|
|
851
|
+
- **Python Packaging Guide**: https://packaging.python.org/
|
|
852
|
+
- **PyPI**: https://pypi.org/
|
|
853
|
+
- **TestPyPI**: https://test.pypi.org/
|
|
854
|
+
- **setuptools documentation**: https://setuptools.pypa.io/
|
|
855
|
+
- **build**: https://pypa-build.readthedocs.io/
|
|
856
|
+
- **twine**: https://twine.readthedocs.io/
|
|
857
|
+
|
|
858
|
+
## Best Practices Summary
|
|
859
|
+
|
|
860
|
+
1. **Use src/ layout** for cleaner package structure
|
|
861
|
+
2. **Use pyproject.toml** for modern packaging
|
|
862
|
+
3. **Pin build dependencies** in build-system.requires
|
|
863
|
+
4. **Version appropriately** with semantic versioning
|
|
864
|
+
5. **Include all metadata** (classifiers, URLs, etc.)
|
|
865
|
+
6. **Test installation** in clean environments
|
|
866
|
+
7. **Use TestPyPI** before publishing to PyPI
|
|
867
|
+
8. **Document thoroughly** with README and docstrings
|
|
868
|
+
9. **Include LICENSE** file
|
|
869
|
+
10. **Automate publishing** with CI/CD
|