Lancetnik / Propan

Propan is a powerful and easy-to-use Python framework for building event-driven applications that interact with any MQ Broker
https://lancetnik.github.io/Propan/
MIT License
489 stars 28 forks source link

Refactor project templates #119

Open Lancetnik opened 1 year ago

Lancetnik commented 1 year ago

We have a some Issue, relative to imports: #98, #118

Obviously, the project template has a structure not protected from an user imports mistakes. Thus, we need to refactor it to make a directory structure much clear and predictable.

The structure I prefer is:

example/
├── .env
├── .gitignore
├── docker-compose.yaml
├── Dockerfile
├── README.md
├── requirements.txt
├── src/
├───── serve.py
└───── app/
      ├── apps/
      │   ├── __init__.py
      │   └── handlers.py
      ├── config/
      │   ├── __init__.py
      │   └── settings.py
      └── __init__.py

But we can discuss it and make a better one.

maxalbert commented 1 year ago

I like the suggestion to tweak the template! Thanks for considering it. :)

Would it make sense to do away with the app/ subfolder and simply have apps/ and config/ as direct children of src/? For example:

example/
├── .env
├── .gitignore
├── Dockerfile
├── README.md
├── docker-compose.yaml
├── requirements.txt
└── src
    ├── apps
    │   ├── __init__.py
    │   └── handlers.py
    ├── config
    │   ├── __init__.py
    │   └── settings.py
    └── serve.py

Or is there something about the intended use case of Propan which would make the presence of the extra app/ folder useful and/or necessary?

Lancetnik commented 1 year ago

@maxalbert this is how the current template looks like and some users are trying to create additional .py files in the serve.py level and import them relative way. So, I think, we need to separate the serve.py (application entry point) from the main sources directory to point that this script should be the one on it's level.