How cmancone/clearskies works
Project Type and Purpose
• This is an opinionated Python framework for developing cloud microservices. It is backend‑focused and designed to support RESTful API endpoints, queue listeners, scheduled tasks, and similar microservice patterns.
• The README clarifies that the framework embraces declarative programming principles and is intended for building microservices.
Analyzing the File Structure
• The main project code lives under the “src/clearskies” directory. Inside that, the modular structure is immediately apparent with subdirectories such as:
– authentication: Contains modules and tests for JWT, Auth0, public/secret bearer authentication, etc.
– autodoc: Provides functionality for auto-generating API documentation and handling request/response formats (with an emphasis on OpenAPI 3 JSON formats).
– backends: Implements different storage or interfacing mechanisms (API-specific, file-based, memory-based, etc.).
– column_types and columns: Likely manage database/ORM field definitions and validations.
– contexts: Handles different runtime contexts (CLI, WSGI, testing, etc.) and the necessary conversion routines.
– decorators: Contains a large number of endpoint decorators (for GET, POST, DELETE, authorization, security headers, etc.), emphasizing the declarative style of the framework.
– di (Dependency Injection): Suggests the use of DI patterns to wire components together including standard dependencies and auto-import features.
– input_outputs: Splits how data is received (e.g., CLI or WSGI) and returned, including error handling.
– input_requirements: Enforces validations on incoming data through a variety of tests.
– mocks, models, secrets, and tests: Support components for testing, model handling, and secure configuration.
• Additional files (e.g., environment files, configuration scripts in build.sh, Pipfile, pyproject.toml) indicate a well-organized Python project ready for deployment and extensibility.
Primary Components
a. Core Framework Engine:
– The “application.py” (and possibly “binding_config.py”) forms the main entry point or bootstrapping mechanism.
b. Authentication Module:
c. API Documentation (Autodoc) Module:
– Show how autodoc connects with request and response handling to generate OpenAPI schemas.
d. Backends:
– Represent the various backend modules (API, cursor, file, memory, etc.) that deal with data persistence/retrieval.
e. Routing and Handlers:
– Illustrate the handlers (crud_by_method, simple_routing, restful_api, etc.) that manage RESTful endpoints.
– Include the decorators that add functionality (security headers, request processing, response formatting, etc.) to these handlers.
f. Dependency Injection:
g. Input/Output and Context Layers:
– Show the separation between input mechanisms (CLI, WSGI) and the output layers, describing how requests are received and responses sent.
h. Column Types and Models:
– Outline how the column_types and models modules map domain/data definitions to the backend components.
i. Supporting Utilities:
– Include ancillary components like mocks, tests, and secrets that ensure quality and security.
Relationships and Interactions
• Trace requests into the proper entry point via a context module (e.g., the WSGI or CLI input_output).
• How decorators wrap handlers to enforce authentication, routing, and validations.
Architectural Patterns and Technologies
• Separation of concerns: requests are processed separately through a layered architecture of authentication, routing, DI, and backend handling.
• Declarative programming approach where decorators and schema definitions play a central role.
• That a dependency injection pattern is used to bind modules together, improving testing and flexibility.
• Core technologies like Python (with WSGI for HTTP handling), and possibly integrations with Auth0 for authentication and JSON for API documentation formats.