Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrating SDK and Worker Functionality into py-clean-arch? #15

Closed
cdddg opened this issue Sep 7, 2023 · 1 comment
Closed

Integrating SDK and Worker Functionality into py-clean-arch? #15

cdddg opened this issue Sep 7, 2023 · 1 comment

Comments

@cdddg
Copy link
Owner

cdddg commented Sep 7, 2023

Following the title, what would be the integrated project structure based on the v3 branch?

@cdddg cdddg changed the title Adding an SDK? Adding an SDK Design? Sep 7, 2023
@cdddg cdddg changed the title Adding an SDK Design? Adding an SDK Design? Sep 7, 2023
@cdddg cdddg changed the title Adding an SDK Design? Exploring the Idea of an SDK Addition to py-clean-arch? Sep 27, 2023
@cdddg cdddg changed the title Exploring the Idea of an SDK Addition to py-clean-arch? Integrating SDK and Worker Functionality into py-clean-arch? Feb 27, 2024
@cdddg
Copy link
Owner Author

cdddg commented Feb 27, 2024

Following the title, what would be the integrated project structure?

Project Structure Adjustment

  • Objective: Enhance maintainability and scalability.
  • Approach: Modularize components into sdk and workers directories.

SDK Integration

  • Purpose: Synchronize SDK updates with API changes, ensuring consistency.
  • Structure:
    • sdk/ directory under src/ for client logic, data models, and exceptions.
  • Reason: Facilitates SDK's close collaboration with the main project and simplifies data model sharing.

Workers Integration

  • Purpose: To seamlessly incorporate background tasks, such as Celery tasks and message queue (MQ) consumers, utilizing the logic from the use case layer.
  • Structure:
    • workers/ directory under src/ is designated for configurations, task definitions, and scripts for MQ consumers.
  • Advantages:
    • Flexibility: This structure allows for easy addition, modification, and removal of background tasks as the project evolves.
    • Scalability: It supports scaling the processing of background tasks independently from the main application, facilitating efficient handling of varying workloads.
  • Reason: Centralizing the management of background tasks not only streamlines the project organization but also enhances the ability to handle complex workflows and asynchronous operations, improving overall project performance and maintainability.

Example

./
├── src/
│   ├── di/
│   ├── entrypoints/
│   ├── usecases/
│   ├── models/
│   ├── repositories/
│   ├── common/
│   ├── settings/
│   │
│   ├── workers/                  - Configuration and scripts for background tasks and consumers.
│   │   ├── celery_engine/        - Contains Celery beat and worker configurations. 
│   │   │                         - (Other suggested names: celery_hub, celery_workers, task_scheduler)
│   │   └── mq_consumer/          - Message queue consumer scripts.
│   │
│   ├── sdk/                      - Toolkit for interfacing with the API via HTTPX, returning function calls as project entities.
│   │   └── aio/client.py         - Asynchronous client implementation.
│   │
│   └── main.py                   - Main file to start the application.
└── tests/

@cdddg cdddg closed this as completed Feb 27, 2024
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

No branches or pull requests

1 participant