Skip to content
This repository was archived by the owner on Jun 30, 2024. It is now read-only.

Commit 8eedc53

Browse files
committed
Docs: Add more explanation and a diagram of what the poetry-fix script does.
1 parent c703d15 commit 8eedc53

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

runestone_poetry_project/poetry_fix.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# ***********************************
44
# This script contains workarounds for Poetry design decisions and bugs:
55
#
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):
77
#
88
# .. code-block:: text
99
#
@@ -29,7 +29,7 @@
2929
#
3030
# ...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.
3131
#
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:
3333
#
3434
# .. code-block:: text
3535
#
@@ -38,7 +38,7 @@
3838
# console-ctrl = "^0.1.0"
3939
# ...many more, which are omitted for clarity...
4040
#
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:
4242
#
4343
# .. code-block:: text
4444
#
@@ -47,14 +47,18 @@
4747
# console-ctrl = "^0.1.0"
4848
# ...many more, which are omitted for clarity...
4949
#
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":
5151
#
5252
# .. code-block:: text
5353
#
5454
# [tool.poetry.dev-dependencies]
5555
# bookserver = { path = "../BookServer", develop = true }
5656
# bookserver-dev = { path = "../bookserver-dev", develop = true } # <== MANUALLY ADDED!
5757
#
58+
# The final result looks like this:
59+
#
60+
# .. image:: poetry_fix_diagram.png
61+
#
5862
# #. 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.
5963
#
6064
# ...and that's how using Poetry makes dependency management easier...
22.6 KB
Loading
31.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)