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
`--since` Useful for displaying changes since a `stable` or `release` tag.
119
186
120
187
Example:
188
+
#### Poetry
121
189
```shell
122
190
poetry poly diff --since release
123
191
```
124
192
193
+
#### Hatch
194
+
```shell
195
+
hatch run poly diff --since release
196
+
```
197
+
125
198
## Libs
126
199
Show info about the third-party libraries used in the workspace:
127
200
201
+
### Poetry
128
202
```shell
129
203
poetry poly libs
130
204
```
@@ -135,6 +209,12 @@ If missing, there is a Poetry command available:
135
209
poetry lock --directory path/to-project
136
210
```
137
211
212
+
### Hatch
213
+
```shell
214
+
hatch run poly libs
215
+
```
216
+
217
+
138
218
### Options
139
219
`--directory`
140
220
Show info about libraries used in a specific project.
@@ -155,13 +235,18 @@ Using `--alias opencv-python=cv2` will make the command treat the alias as a thi
155
235
## Check
156
236
Validates the Polylith workspace, checking for any missing dependencies (bricks and third-party libraries):
157
237
238
+
### Poetry
158
239
```shell
159
240
poetry poly check
160
241
```
161
242
162
-
This feature is built on top of the `poetry poly libs` command,
163
-
and expects a `poetry.lock` of a project to be present.
243
+
This feature is built on top of the `poly libs` command,
244
+
and for expects a `poetry.lock` of a`Poetry` project to be present.
164
245
246
+
### Hatch
247
+
```shell
248
+
hatch run poly check
249
+
```
165
250
166
251
### Options
167
252
`--directory`
@@ -183,10 +268,16 @@ Using `--alias opencv-python=cv2` will make the command treat the alias as a thi
183
268
## Sync
184
269
Keep projects in sync with the actual usage of bricks in source code.
185
270
271
+
### Poetry
186
272
```shell
187
273
poetry poly sync
188
274
```
189
275
276
+
### Hatch
277
+
```shell
278
+
hatch run poly sync
279
+
```
280
+
190
281
This feature is useful for keeping projects in sync. The command will analyze code and add any missing bricks to the projects, including the development project.
191
282
192
283
- projects: will add missing bricks to the project specific _pyproject.toml_, when imported by any of the already added bricks.
Copy file name to clipboardExpand all lines: docs/dependencies.md
+8-2Lines changed: 8 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -4,14 +4,14 @@ Each project has its own `pyproject.toml`,
4
4
where the project-specific dependencies are defined.
5
5
6
6
## Bricks (your Python code)
7
-
Bricks are added to the `packages` section of `[tool.poetry]`,
7
+
Bricks are added to the `packages` section of `[tool.poetry]` or the `[tool.hatch.build.force-include]`,
8
8
described in [Projects & pyproject.toml](projects.md).
9
9
10
10
To keep a project up-to-date with needed bricks, there is a `poly sync` command available.
11
11
Usage is described in [commands](commands.md). The command is there for convenience, you can also add the bricks manually.
12
12
13
13
## Libraries (third-party dependencies)
14
-
The recommended workflow for Polylith is to use `poetry add` to install the needed libraries to the __Development__`pyproject.toml`.
14
+
The recommended workflow for Polylith is to use `poetry add`, or manually adding, to install the needed libraries to the __Development__`pyproject.toml`.
15
15
The Development `pyproject.toml` is located at the Workspace root.
16
16
The Development environment should have __all__ dependencies added: all bricks and all the third-party libraries.
17
17
The dev-dependencies (such as Mypy, Black, Flake8, Ruff etc.) are also added to the Development `pyproject.toml`.
@@ -27,6 +27,12 @@ Use the `poly libs` and/or `poly check` [command](commands.md) to verify all tha
27
27
Both commands support the `--directory` option (coming from Poetry).
28
28
This means that you can run the commands from the workspace root, but for a specific project:
29
29
30
+
### Poetry
30
31
```shell
31
32
poetry poly check --directory projects/my-project
32
33
```
34
+
35
+
### Hatch
36
+
```shell
37
+
hatch run poly check --directory projects/my-project
Copy file name to clipboardExpand all lines: docs/deployment.md
+19-1Lines changed: 19 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,14 @@
1
1
# Packaging & deploying
2
2
3
+
## Poetry
3
4
Packaging and deploying Polylith projects is done by using the Poetry Multiproject plugin command (see [installation](installation.md)).
4
5
5
6
The `poetry build-project` command will make it possible to use relative package includes as how components and bases are added to Python Polylith projects.
6
7
Relative includes are currently not possible by default in __Poetry__, that is where the __Multiproject__ plugin comes in.
7
8
9
+
## Hatch
10
+
Hatch supports relative includes via the `force-include` configuration. Nothing extra needed!
11
+
8
12
## Packaging
9
13
To collect the components and bases that are needed for a specific project, the tool introduces a _build_ step.
10
14
The tool will build a _wheel_ and an _sdist_ from the source code of a project.
@@ -13,12 +17,21 @@ This is the preferred way for Polylith projects.
13
17
14
18
### Packaging a service or app
15
19
20
+
#### Poetry
16
21
```shell
17
22
poetry build-project --directory path/to/project
18
23
```
19
24
25
+
#### Hatch
26
+
```shell
27
+
cd path/to_project
28
+
29
+
hatch build
30
+
```
31
+
32
+
20
33
This command will create a project specific _dist_ folder containing a _wheel_ and an _sdist_.
21
-
You can use the default __poetry build__ options with this command too.
34
+
You can use the available __build__ options with this command too.
22
35
23
36
## Deploying
24
37
You can use the built artifacts to install your service in your preffered way, just by running
The main takeaway is to view code as small, reusable bricks, that ideally does one thing only.
72
75
A brick is not the same thing as a library. So, what's the difference? Well, a library is a full blown feature. A brick can be a single function, or a parser. It can also be a thin wrapper around a third party tool.
With the `Poetry` version 1.2 or later installed, you can add plugins.
5
-
6
-
Add the [Multiproject](https://github.com/DavidVujic/poetry-multiproject-plugin) plugin,
3
+
## Poetry
4
+
### Add Poetry plugins
5
+
With the `Poetry` version 1.2 or later installed, you can add plugins. First, add the [Multiproject](https://github.com/DavidVujic/poetry-multiproject-plugin) plugin,
7
6
that will enable the very important __Workspace__ support to Poetry.
0 commit comments