Skip to content

Document Python best practices for arabesque-sray organisation - #3

Draft
egorman-sray with Copilot wants to merge 2 commits into
mainfrom
copilot/best-practices-python-arabesque-sray
Draft

Document Python best practices for arabesque-sray organisation#3
egorman-sray with Copilot wants to merge 2 commits into
mainfrom
copilot/best-practices-python-arabesque-sray

Conversation

Copilot AI commented Feb 13, 2026

Copy link
Copy Markdown

Consolidates Python development standards from arabesque-sray/ops and arabesque-sray/esgbook-py into a single reference document.

What's Included

  • Code style: 100-char line length, singular directory naming
  • Project structure: Flat layout with hexagonal architecture (entity/, use_case/, service/, repository/)
  • Data modeling: When to use standard dataclass vs Pydantic dataclass vs BaseModel vs BaseSettings
  • Logging: structlog with JSON output for GCP, context binding patterns
  • Tooling: uv package manager, ruff, mypy, pytest
  • Custom libraries: esgbook-py modules (logging setup, retry configs, storage utilities)

Key Patterns

# Logging with context
from structlog.contextvars import bound_contextvars

logger = structlog.get_logger(__name__)

with bound_contextvars(request_id=req_id):
    logger.info("processing")  # automatically includes request_id

# Configuration
from pydantic_settings import BaseSettings
from pydantic import BaseModel

class DatabaseConfig(BaseModel):
    host: str
    port: int = 5432

class Settings(BaseSettings):
    database: DatabaseConfig
    
    model_config = SettingsConfigDict(
        env_file='.env',
        env_nested_delimiter='__'
    )

Document includes decision trees, code examples, and quick reference guides for common scenarios.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: egorman-sray <123000183+egorman-sray@users.noreply.github.com>
Copilot AI changed the title [WIP] Document best practices for Python development Document Python best practices for arabesque-sray organisation Feb 13, 2026
Copilot AI requested a review from egorman-sray February 13, 2026 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants