Révision | 1019b68a71df6f2f5b7ff431b1260e4ca36eec8a (tree) |
---|---|
l'heure | 2024-02-19 05:27:23 |
Auteur | Albert Mietus < albert AT mietus DOT nl > |
Commiter | Albert Mietus < albert AT mietus DOT nl > |
The summary of the (py,compiler) package structure is more-or-less done (DOC-only)
@@ -62,6 +62,37 @@ | ||
62 | 62 | e.g. plugins. Or as reference for a reader. |
63 | 63 | |
64 | 64 | |
65 | +.. hint:: Suppose we make the “nice-fsm-plugin” that act as transformer ... | |
66 | + | |
67 | + .. note:: The resulting namespace will be: |BR| ``castle.transformers.fsm.nice_fsm`` | |
68 | + | |
69 | + The name of the top directly does not matter (for python). We advice a name that shows it’s not a python-id, and is | |
70 | + related to the package name. For example: | |
71 | + |BR| | |
72 | + ``<nice-fsm-plugin>`` | |
73 | + | |
74 | + This directory contains the *only* package-info-file, which name a content depends on the (package) build systems. | |
75 | + E.g. | |
76 | + | |
77 | + * ``setup.py`` (or ...) | |
78 | + | |
79 | + + **name** *:str* e.g. “nice-fsm-castle-plugin”` | |
80 | + + **packages** *:List[str]* =[ ``castle.transformers.fsm.nice_fsm``, ...] | |
81 | + | |
82 | + We need a file-hierarchy, with *empty* directories, that mirror the (shared) namespace | |
83 | + | |
84 | + * ``<nice-fsm-plugin>/castle/`` -- empty, no `__init__,py` | |
85 | + * ``<nice-fsm-plugin>/castle/transformers/`` -- empty, no `__init__,py` | |
86 | + * ``<nice-fsm-plugin>/castle/transformers/fsm`` -- empty, no `__init__,py` | |
87 | + * ``<nice-fsm-plugin>/castle/transformers/fsm/nice_fsm`` Holds all code: | |
88 | + | |
89 | + - **__init__.py** can be empty, but typically uses ``from .<> import <>`` to have the “api functionality” available | |
90 | + - **<files>.py** code | |
91 | + - **<sub>/** sub-package, (full-dirname to be included in `packages=[...]` above | |
92 | + | |
93 | + | |
94 | + | |
95 | + | |
65 | 96 | Opportunity |
66 | 97 | =========== |
67 | 98 | Let study the options, our needs and how others handle packages & plugins, before designing for castle. |
@@ -157,7 +188,9 @@ | ||
157 | 188 | In practice, “ownership” (like: who owns the code-archive, but also “when” to release) are the borders that define the |
158 | 189 | distribution-packages. |
159 | 190 | |
191 | +------ | |
160 | 192 | |
193 | +XXXX | |
161 | 194 | |
162 | 195 | ------ |
163 | 196 |