mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-06-29 03:31:53 +08:00
Rename package installer helper to package
This commit is contained in:
@@ -31,6 +31,10 @@ The application is structured as four distinct layers. Each layer has a defined
|
||||
|
||||
## Layer Responsibilities and Boundaries
|
||||
|
||||
### Shared File Placement Rule
|
||||
|
||||
Before creating a new file under `app/api/endpoints/`, `app/chain/`, `app/helper/`, or `app/utils/`, first check whether the capability belongs in an existing domain file. Prefer extending that file when the domain already exists. Create a new file only for a genuinely new domain or standalone reusable concern, and name it with a single noun according to `07-naming-conventions.md`.
|
||||
|
||||
### Entrypoint Layer
|
||||
|
||||
**Directories:** `app/api/endpoints/`, `moviepilot` (CLI), `app/agent/`, scheduler callbacks, webhook handlers, message interactions.
|
||||
@@ -41,7 +45,7 @@ The application is structured as four distinct layers. Each layer has a defined
|
||||
- Any logic that coordinates multiple modules, triggers events, touches caches, or combines workflows must be moved into `chain`.
|
||||
|
||||
**Rules:**
|
||||
- Prefer adding new endpoints to an existing domain file. Create a new endpoint file only when introducing a new top-level resource domain.
|
||||
- Prefer adding new endpoints to an existing domain file. Create a new endpoint file only when introducing a new top-level resource domain, and use a single-noun filename.
|
||||
- After adding a new endpoint, register it in `app/api/apiv1.py`.
|
||||
- Endpoints must not contain business logic that belongs in `chain`.
|
||||
|
||||
@@ -166,4 +170,4 @@ The application is structured as four distinct layers. Each layer has a defined
|
||||
| Few dozen lines of private logic in one chain or module | Private function in the same file; do not create a new helper |
|
||||
| New module category or subtype | Also update `app/schemas/types.py` |
|
||||
|
||||
*Last Updated: 2026-05-25*
|
||||
*Last Updated: 2026-06-23*
|
||||
|
||||
@@ -105,6 +105,8 @@ except:
|
||||
|
||||
- One primary class per file is the norm for chains, modules, and helpers.
|
||||
- Private helper functions in the same file are preferable to extracting a new helper for single-use logic.
|
||||
- Under `app/api/endpoints/`, `app/chain/`, `app/helper/`, and `app/utils/`, add code to an existing domain file whenever the domain already exists.
|
||||
- New files under those directories must use a single noun filename such as `package.py`; avoid role-suffix names such as `package_installer.py` unless an established framework convention requires it.
|
||||
- Keep files focused on one domain concern.
|
||||
|
||||
---
|
||||
@@ -118,4 +120,4 @@ except:
|
||||
- Do not add noisy markers like `# change starts here`, `# important`, or `# this is a fix`.
|
||||
- Do not write comments that restate what the code already clearly says.
|
||||
|
||||
*Last Updated: 2026-05-25*
|
||||
*Last Updated: 2026-06-23*
|
||||
|
||||
@@ -8,7 +8,8 @@ All new code must follow these conventions. Consistent naming is how the codebas
|
||||
|
||||
| Context | Convention | Examples |
|
||||
|---|---|---|
|
||||
| Python source files | `snake_case.py` | `download_chain.py`, `qbittorrent.py` |
|
||||
| Python source files | `snake_case.py` | `download.py`, `qbittorrent.py`, `package.py` |
|
||||
| New domain files under `app/api/endpoints/`, `app/chain/`, `app/helper/`, `app/utils/` | Single noun `snake_case.py`; prefer an existing domain file before adding a new one | `package.py`, `plugin.py`, `torrent.py` |
|
||||
| Module package directories | `snake_case/` | `qbittorrent/`, `synologychat/` |
|
||||
| Test files | `test_<domain>.py` | `test_download_chain.py`, `test_subscribe_endpoint.py` |
|
||||
| Alembic migrations | Auto-generated by Alembic; do not rename | `20240101_add_column.py` |
|
||||
@@ -99,4 +100,4 @@ All new code must follow these conventions. Consistent naming is how the codebas
|
||||
| `SystemConfigOper().get("RssUrls")` | `SystemConfigOper().get(SystemConfigKey.RssUrls)` |
|
||||
| `class subscribe_oper:` | `class SubscribeOper:` |
|
||||
|
||||
*Last Updated: 2026-05-25*
|
||||
*Last Updated: 2026-06-23*
|
||||
|
||||
Reference in New Issue
Block a user