Skip to content

Commit 0fdbb25

Browse files
chore(docs): Update codeconv to showcase __all__ treatment
1 parent 543d9e2 commit 0fdbb25

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

docs/dev/reference/coding-conventions.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,11 @@ class Owners(Base):
120120

121121
The following structures principles may also be followed:
122122

123-
- `__init__.py` should not contain code, but `__all__`
124-
- At a package level (router for example) we have one file per system (configuration.py for example)
125-
- If we need more files (think of jobs, which have the sandbox, the joblogging, etc), we put them in a sub module (e.g routers.job). The code goes in a specific file (job.py, joblogging.py) but we use the the __init__.py to expose the specific file
123+
- `__init__.py` should not contain code, but `__all__` as a list
124+
- At a package level (routers for example) we have as few files as possible
125+
- The package level `__init__.py` should contain an empty `__all__` and the modules at that level should expose their respective public API
126+
- If the files have much in common (think of jobs, which have the sandbox, the joblogging, etc), we put them in a subpackage (e.g routers.job). The code goes in a specific file (job.py, joblogging.py)
127+
- At subpackage level, `__init__.py` should expose the public API through the `__all__` list by importing from the modules at that level. These submodules should not contain an `__all__`
126128

127129
See [this issue](https://github.com/DIRACGrid/diracx/issues/268).
128130

0 commit comments

Comments
 (0)