|
3 | 3 | # *********************************** |
4 | 4 | # This script contains workarounds for Poetry design decisions and bugs: |
5 | 5 | # |
6 | | -# #. Poetry doesn't support either/or dependencies, but this project needs them. Specifically, we want to install either the released, PyPI-published version of the RunestoneComponents and the BookServer, or the development version of these projects which are cloned to the local filesystem. The ``pyproject.toml`` file therefore contains (with all other dependencies removed for clarity): |
| 6 | +# #. Poetry doesn't support either/or dependencies, but this project needs them. Specifically, we want to install either the released, PyPI-published version of the RunestoneComponents and the BookServer, or the development version of these projects which are cloned to the local filesystem. The RunestoneServer ``pyproject.toml`` file therefore contains (with all other dependencies removed for clarity): |
7 | 7 | # |
8 | 8 | # .. code-block:: text |
9 | 9 | # |
|
29 | 29 | # |
30 | 30 | # ...in production mode; it does the opposite (changes ``[tool.poetry.dependencies]`` to ``[tool.no-poetry.dependencies]``) in development mode. This hides the modified section from Poetry, so the file now looks like an either/or project. |
31 | 31 | # |
32 | | -# #. Poetry doesn't install development dependencies in projects included through a path dependency. As a workaround, this script creates additional "projects" which only contain the development dependencies, but places these in the production dependencies section of the "project". For example, the BookServer ``pyproject.toml`` contains: |
| 32 | +# #. Poetry doesn't install development dependencies in projects included through a `path dependency <https://python-poetry.org/docs/dependency-specification/#path-dependencies>`_. As a workaround, this script copies development dependencies from a project into an otherwise empty, auto-created "project", but puts them in the production dependencies section of this newly-created "project", so they will be installed. For example, the BookServer ``pyproject.toml`` contains: |
33 | 33 | # |
34 | 34 | # .. code-block:: text |
35 | 35 | # |
|
38 | 38 | # console-ctrl = "^0.1.0" |
39 | 39 | # ...many more, which are omitted for clarity... |
40 | 40 | # |
41 | | -# Poetry won't install these. Therefore, `make_dev_pyproject <make_dev_pyproject>` creates a "project" named ``bookserver-dev`` which contains: |
| 41 | +# Poetry won't install these. Therefore, `make_dev_pyproject <make_dev_pyproject>` creates a "project" named bookserver-dev whose ``pyproject.toml`` contains a copy of the BookServer development dependencies, but placed in the production dependencies section of this ``bookserver-dev`` "project", so they will be installed. For example, the bookserver-dev ``pyproject.toml`` contains: |
42 | 42 | # |
43 | 43 | # .. code-block:: text |
44 | 44 | # |
|
47 | 47 | # console-ctrl = "^0.1.0" |
48 | 48 | # ...many more, which are omitted for clarity... |
49 | 49 | # |
50 | | -# This also means that the ``pyproject.toml`` file must be manually edited to include a reference to this "project": |
| 50 | +# This also means that the RunestoneServer ``pyproject.toml`` file must be manually edited to include a reference to this "project": |
51 | 51 | # |
52 | 52 | # .. code-block:: text |
53 | 53 | # |
54 | 54 | # [tool.poetry.dev-dependencies] |
55 | 55 | # bookserver = { path = "../BookServer", develop = true } |
56 | 56 | # bookserver-dev = { path = "../bookserver-dev", develop = true } # <== MANUALLY ADDED! |
57 | 57 | # |
| 58 | +# The final result looks like this: |
| 59 | +# |
| 60 | +# .. image:: poetry_fix_diagram.png |
| 61 | +# |
58 | 62 | # #. Poetry generates invalid package metadata for local path dependencies, so that running ``pip show click`` results in a bunch of exceptions. This program doesn't provide a fix for this bug. |
59 | 63 | # |
60 | 64 | # ...and that's how using Poetry makes dependency management easier... |
|
0 commit comments