{"id":49887849,"url":"https://github.com/jtgsystems/python-best-practices-2025","last_synced_at":"2026-05-15T19:05:13.990Z","repository":{"id":295926531,"uuid":"991702420","full_name":"jtgsystems/PYTHON-BEST-PRACTICES-2025","owner":"jtgsystems","description":"🐍 Python best practices guide 2025 - Modern coding standards, patterns \u0026 optimization techniques","archived":false,"fork":false,"pushed_at":"2026-04-13T17:36:51.000Z","size":894,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-13T18:24:48.877Z","etag":null,"topics":["ai","automation","fastapi","llm","nlp","python","rag","tools","web"],"latest_commit_sha":null,"homepage":"","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jtgsystems.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2025-05-28T03:08:49.000Z","updated_at":"2026-04-13T17:36:55.000Z","dependencies_parsed_at":"2025-05-28T04:46:43.049Z","dependency_job_id":"9378a8f3-c27b-4eaf-8fbf-121b042bb530","html_url":"https://github.com/jtgsystems/PYTHON-BEST-PRACTICES-2025","commit_stats":null,"previous_names":["jtgsystems/python-best-practices-2025"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jtgsystems/PYTHON-BEST-PRACTICES-2025","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jtgsystems%2FPYTHON-BEST-PRACTICES-2025","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jtgsystems%2FPYTHON-BEST-PRACTICES-2025/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jtgsystems%2FPYTHON-BEST-PRACTICES-2025/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jtgsystems%2FPYTHON-BEST-PRACTICES-2025/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jtgsystems","download_url":"https://codeload.github.com/jtgsystems/PYTHON-BEST-PRACTICES-2025/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jtgsystems%2FPYTHON-BEST-PRACTICES-2025/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33075273,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T11:35:32.926Z","status":"ssl_error","status_checked_at":"2026-05-15T11:35:31.362Z","response_time":103,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","automation","fastapi","llm","nlp","python","rag","tools","web"],"created_at":"2026-05-15T19:05:09.747Z","updated_at":"2026-05-15T19:05:13.982Z","avatar_url":"https://github.com/jtgsystems.png","language":"PowerShell","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Banner](banner.png)\n\n# 🐍 Python Best Practices 2025\n\nComprehensive guide to writing reliable, maintainable, and high-performance Python code.\n\n---\n\n## 🔍 Supported Python Versions\n\n- ⚡️ **Python 3.14.0** (Oct 7, 2025) – Latest stable with official free-threaded builds, template strings, deferred annotations, and bundled `compression.zstd` module\n- 🛡️ **Python 3.13.9** (latest bugfix on Oct 14, 2025) – Conservative choice with extended support through Oct 2029\n- 📦 **Security-only**: 3.12 LTS receives fixes until Oct 2028; upgrade plans should target 3.13+\n\n---\n\n## 🚀 New \u0026 Experimental Features\n\n- 🆓 **Free-Threaded CPython** (PEP 779) – official tier-2 builds enable real multi-core scaling  \n- 🔤 **Template String Literals** (PEP 750) – safer templating for SQL, shell, and i18n use cases  \n- 📝 **Deferred Annotations** (PEP 649) – annotation evaluation happens on demand for faster imports  \n- 🧵 **Multiple Interpreters API** (PEP 734) – `concurrent.interpreters` brings low-overhead parallelism  \n- 📦 **`compression.zstd` Module** (PEP 784) – native Zstandard support across stdlib tools  \n- 🔥 **JIT \u0026 REPL Enhancements** – experimental JIT binaries ship for macOS/Windows; REPL ships with colorized output and smarter hints  \n\n---\n\n## 📁 Repository Structure\n\n```\n01-CORE-PRINCIPLES/      # PEP guidelines, naming conventions, SOLID \u0026 design patterns  \n02-LINTING-FORMATTING/   # Ruff, Black \u0026 MyPy configs + style guide  \n03-TESTING-FRAMEWORKS/   # pytest, unittest, coverage examples  \n04-PROJECT-STRUCTURE/    # src layout, module vs. package best practices  \n05-PERFORMANCE-SECURITY/ # Profiling tips, optimizations \u0026 security checks  \n06-CI-CD-TEMPLATES/      # GitHub Actions, pre-commit hooks \u0026 YAML samples  \n07-EXAMPLES/             # Data pipelines, FastAPI demos, real-world code  \noutput/                  # Generated docs, reports, artifacts  \n```\n\n---\n\n## 🛠️ Essential Tools \u0026 Setup\n\n### Toolchain\n\n- 🔍 **Linter \u0026 Formatter**: [Ruff 0.14.3](https://github.com/astral-sh/ruff) – bundles linting, formatting, and rule sets  \n- 🎨 **Formatter**: Ruff format (or [Black 25.9.0](https://github.com/psf/black) for parity with legacy pipelines)  \n- 🔢 **Type Checking**: [MyPy 1.18.2](http://mypy-lang.org/) or [Pyright](https://github.com/microsoft/pyright) depending on ecosystem  \n- 🧪 **Testing**: [pytest](https://docs.pytest.org/) + [pytest-cov](https://github.com/pytest-dev/pytest-cov) for coverage  \n- 📦 **Package Manager**: [uv 0.9.7](https://github.com/astral-sh/uv) for fast, secure dependency workflows; [Poetry](https://python-poetry.org/) remains a solid alternative  \n\n### Installation\n\n```powershell\n# Install core development tools with pip\npip install \"ruff\u003e=0.14.3\" \"black\u003e=25.9.0\" \"mypy\u003e=1.18.2\" pytest pytest-cov\n\n# Or using uv (recommended for speed and lockfiles)\nuv tool upgrade \"uv\u003e=0.9.7\"\nuv add --dev ruff\u003e=0.14.3 black\u003e=25.9.0 mypy\u003e=1.18.2 pytest pytest-cov\n\n# Optional security \u0026 automation\npip install pre-commit bandit safety\n```\n\n### Pre-Commit Hooks\n\nCreate a `.pre-commit-config.yaml`:\n\n```yaml\nrepos:\n  - repo: https://github.com/astral-sh/ruff-pre-commit\n    rev: v0.14.3\n    hooks:\n      - id: ruff-check\n        args: [--fix]\n      - id: ruff-format\n\n  - repo: https://github.com/psf/black\n    rev: 25.9.0\n    hooks:\n      - id: black\n\n  - repo: https://github.com/pre-commit/mirrors-mypy\n    rev: v1.18.2\n    hooks:\n      - id: mypy\n```\n\nEnable by running:\n\n```bash\npre-commit install\n```\n\n---\n\n## 📖 Learning Path\n\n1. **01-CORE-PRINCIPLES** – PEP standards, naming, SOLID \u0026 design patterns  \n2. **02-LINTING-FORMATTING** – Configure and enforce lint \u0026 format rules  \n3. **03-TESTING-FRAMEWORKS** – Write robust tests \u0026 measure coverage  \n4. **04-PROJECT-STRUCTURE** – Organize code for maintainability  \n5. **05-PERFORMANCE-SECURITY** – Profile, optimize, and secure applications  \n6. **06-CI-CD-TEMPLATES** – Automate linting, testing \u0026 deployment pipelines  \n7. **07-EXAMPLES** – Explore real-world scripts and template projects  \n\n---\n\n## 🧩 Examples \u0026 Templates\n\n- **data-science-pipeline.py** – ETL workflow with logging, error handling \u0026 tests  \n- **fastapi-app.py** – Minimal FastAPI service with Pydantic models \u0026 security checks  \n\n---\n\n## 🎯 Quick Commands Reference\n\n```bash\n# Linting \u0026 Formatting\nruff check .                    # Fast linting\nruff format .                   # Fast formatting\nblack .                         # Alternative formatting\nmypy .                          # Type checking\n\n# Testing\npytest                          # Run all tests\npytest --cov=src               # With coverage\npytest -x -vs                  # Stop on first failure, verbose\n\n# Security\nbandit -r src/                  # Security scan\nsafety check                   # Dependency vulnerabilities\n\n# Project setup\nruff init                       # Initialize ruff config\npre-commit install             # Setup git hooks\n```\n\n---\n\n## ⭐ Contributing\n\nContributions are welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) and follow our code style guidelines.  \n\n---\n\n## 📄 License\n\nThis project is licensed under MIT. See [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjtgsystems%2Fpython-best-practices-2025","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjtgsystems%2Fpython-best-practices-2025","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjtgsystems%2Fpython-best-practices-2025/lists"}