You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Place enums in `<package_root>/enums.py` (e.g. `octobot/enums.py`, `packages/node/octobot_node/enums.py`). Never define enums inline in module files.
43
+
44
+
### Constants
45
+
Place module-wide constants in `<package_root>/constants.py`. Private module constants (used only within one file) may stay in that file, prefixed with `_`.
46
+
47
+
### Typed errors
48
+
Define a typed error hierarchy rather than raising bare `ValueError`/`KeyError`. Pattern:
Re-export from the package `__init__.py`. Use typed catches in API routes — never inspect `str(err).lower()`.
55
+
56
+
### TypedDicts for structured dicts
57
+
When a dict has a fixed schema (e.g. wallet info returned to callers), define a `typing.TypedDict`. Place it in the module that owns the data, before the class that produces it.
58
+
59
+
### File locking
60
+
Use the `filelock` library (cross-platform, POSIX + Windows) instead of `fcntl`/`msvcrt` branching.
61
+
62
+
### Import priority in tentacle files
63
+
Prefer the installed `tentacles.Services.Interfaces.*` path first; fall back to bare direct imports (build-time fallback). Pattern:
64
+
```python
65
+
try:
66
+
from tentacles.Services.Interfaces.node_api_interface.api.deps import X
67
+
exceptImportError:
68
+
from api.deps import X # type:ignore[no-redef]
69
+
```
70
+
All files within a tentacle package should use the same priority order.
71
+
72
+
### Log levels
73
+
-`debug`: verbose diagnostics, expected no-ops.
74
+
-`info`: normal operational events (startup, shutdown, config loaded).
75
+
-`warning`: unexpected but recoverable (auto-unlock skipped, optional feature unavailable).
76
+
-`error`: configuration/state errors that affect functionality (wallet missing, key wrong).
77
+
-`exception`: unexpected exceptions — always re-raise after logging unless the function is a top-level "best-effort" path that must not crash the caller.
78
+
79
+
### Shared filter helpers
80
+
Filtering logic used in multiple places belongs in a shared utility module (e.g. `workflows_util.py`), not duplicated inline. Name with a verb: `filter_by_wallet`, not `_filter`.
81
+
39
82
## Documentation
40
83
41
84
Documentation lives in `docs/content/` and is built with Docusaurus 3. Package docs go under `docs/content/developers/packages/<pkg-name>/`.
0 commit comments