diff --git a/README.md b/README.md
index f6a0d4a..7535437 100644
--- a/README.md
+++ b/README.md
@@ -41,15 +41,15 @@ You can do this by creating a configuration section in `pixi.toml` or `pyproject
[tool.pixi-diff-to-markdown]
split-tables = "platform"
hide-tables = false
-enable-change-type-column = true
-enable-explicit-column = false
-enable-package-type-column = false
+change-type-column = true
+explicit-column = false
+package-type-column = false
```
You can also override the configuration options by passing them as arguments to `pixi-diff-to-markdown`.
```bash
-pixi update --json | pixi-diff-to-markdown update --split-tables=platform --enable-explicit-column
+pixi update --json | pixi-diff-to-markdown update --split-tables=platform --explicit-column
```
### `split-tables`
@@ -66,18 +66,18 @@ For a large amount of `environments` and `platforms`, it might be easier to read
Whether to hide the tables in a collapsible object ([example true](./tests/resources/output/split-tables-platform_hide-tables-True_change-type-True_explicit-type-False_package-type-False.md), [example false](./tests/resources/output/split-tables-platform_hide-tables-False_change-type-True_explicit-type-False_package-type-False.md))
-### `enable-change-type-column`
+### `change-type-column`
Whether to enable the `Change` column in the output ([example true](./tests/resources/output/split-tables-platform_hide-tables-False_change-type-True_explicit-type-False_package-type-False.md), [example false](./tests/resources/output/split-tables-platform_hide-tables-False_change-type-False_explicit-type-False_package-type-False.md)).
-### `enable-explicit-column`
+### `explicit-column`
Whether to enable the `Explicit` column in the output ([example true](./tests/resources/output/split-tables-platform_hide-tables-False_change-type-True_explicit-type-True_package-type-False.md), [example false](./tests/resources/output/split-tables-platform_hide-tables-False_change-type-True_explicit-type-False_package-type-False.md)).
If a dependency is explicitly defined in `pixi.toml`, it will be marked as `Explicit`. Otherwise, it will be marked as `Implicit`.
If this is set to `false`, the `Explicit` column will be omitted and the explicitly defined dependencies will be marked as *cursive*.
-### `enable-package-type-column`
+### `package-type-column`
Whether to enable the `Package Type` column in the output ([example true](./tests/resources/output/split-tables-platform_hide-tables-False_change-type-True_explicit-type-False_package-type-True.md), [example false](./tests/resources/output/split-tables-platform_hide-tables-False_change-type-True_explicit-type-False_package-type-False.md)).
This column will show whether the dependency is a `conda` or `pypi` package.
diff --git a/pixi.lock b/pixi.lock
index 042d993..00e2b61 100644
--- a/pixi.lock
+++ b/pixi.lock
@@ -10,6 +10,7 @@ environments:
- conda: https://conda.anaconda.org/conda-forge/noarch/annotated-types-0.7.0-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/linux-64/bzip2-1.0.8-hd590300_5.conda
- conda: https://conda.anaconda.org/conda-forge/linux-64/ca-certificates-2024.2.2-hbcca054_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/click-8.1.7-unix_pyh707e725_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/colorama-0.4.6-pyhd8ed1ab_0.tar.bz2
- conda: https://conda.anaconda.org/conda-forge/noarch/editables-0.5-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/exceptiongroup-1.2.0-pyhd8ed1ab_2.conda
@@ -26,6 +27,8 @@ environments:
- conda: https://conda.anaconda.org/conda-forge/linux-64/libuuid-2.38.1-h0b41bf4_0.conda
- conda: https://conda.anaconda.org/conda-forge/linux-64/libxcrypt-4.4.36-hd590300_1.conda
- conda: https://conda.anaconda.org/conda-forge/linux-64/libzlib-1.2.13-hd590300_5.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/markdown-it-py-3.0.0-pyhd8ed1ab_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/mdurl-0.1.2-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/linux-64/mypy-1.10.0-py312h9a8786e_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/mypy_extensions-1.0.0-pyha770c72_0.conda
- conda: https://conda.anaconda.org/conda-forge/linux-64/ncurses-6.5-h59595ed_0.conda
@@ -39,14 +42,22 @@ environments:
- conda: https://conda.anaconda.org/conda-forge/linux-64/py-rattler-0.5.0-py312hbcc2302_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/pydantic-2.7.1-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/linux-64/pydantic-core-2.18.2-py312h4413252_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/pydantic-settings-2.2.1-pyhd8ed1ab_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/pygments-2.18.0-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/pytest-8.2.1-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/linux-64/python-3.12.3-hab00c5b_0_cpython.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/python-dotenv-1.0.1-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/linux-64/python_abi-3.12-4_cp312.conda
- conda: https://conda.anaconda.org/conda-forge/linux-64/readline-8.2-h8228510_1.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/rich-13.7.1-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/setuptools-70.0.0-pyhd8ed1ab_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/shellingham-1.5.4-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/linux-64/tk-8.6.13-noxft_h4845f30_101.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/tomli-2.0.1-pyhd8ed1ab_0.tar.bz2
- conda: https://conda.anaconda.org/conda-forge/noarch/trove-classifiers-2024.5.22-pyhd8ed1ab_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/typer-0.12.3-pyhd8ed1ab_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/typer-slim-0.12.3-pyhd8ed1ab_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/typer-slim-standard-0.12.3-hd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/typing-extensions-4.11.0-hd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/typing_extensions-4.11.0-pyha770c72_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2024a-h0c530f3_0.conda
@@ -57,6 +68,7 @@ environments:
- conda: https://conda.anaconda.org/conda-forge/noarch/annotated-types-0.7.0-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/bzip2-1.0.8-h93a5062_5.conda
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/ca-certificates-2024.2.2-hf0a4a13_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/click-8.1.7-unix_pyh707e725_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/colorama-0.4.6-pyhd8ed1ab_0.tar.bz2
- conda: https://conda.anaconda.org/conda-forge/noarch/editables-0.5-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/exceptiongroup-1.2.0-pyhd8ed1ab_2.conda
@@ -67,6 +79,8 @@ environments:
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/libffi-3.4.2-h3422bc3_5.tar.bz2
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/libsqlite-3.45.3-h091b4b1_0.conda
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/libzlib-1.2.13-h53f4e23_5.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/markdown-it-py-3.0.0-pyhd8ed1ab_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/mdurl-0.1.2-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/mypy-1.10.0-py312h4a164c9_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/mypy_extensions-1.0.0-pyha770c72_0.conda
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/ncurses-6.5-hb89a1cb_0.conda
@@ -80,14 +94,22 @@ environments:
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/py-rattler-0.5.0-py312h1a1520d_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/pydantic-2.7.1-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/pydantic-core-2.18.2-py312hbdaf6d9_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/pydantic-settings-2.2.1-pyhd8ed1ab_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/pygments-2.18.0-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/pytest-8.2.1-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/python-3.12.3-h4a7b5fc_0_cpython.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/python-dotenv-1.0.1-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/python_abi-3.12-4_cp312.conda
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/readline-8.2-h92ec313_1.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/rich-13.7.1-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/setuptools-70.0.0-pyhd8ed1ab_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/shellingham-1.5.4-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/tk-8.6.13-h5083fa2_1.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/tomli-2.0.1-pyhd8ed1ab_0.tar.bz2
- conda: https://conda.anaconda.org/conda-forge/noarch/trove-classifiers-2024.5.22-pyhd8ed1ab_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/typer-0.12.3-pyhd8ed1ab_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/typer-slim-0.12.3-pyhd8ed1ab_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/typer-slim-standard-0.12.3-hd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/typing-extensions-4.11.0-hd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/typing_extensions-4.11.0-pyha770c72_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2024a-h0c530f3_0.conda
@@ -98,6 +120,7 @@ environments:
- conda: https://conda.anaconda.org/conda-forge/noarch/annotated-types-0.7.0-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/win-64/bzip2-1.0.8-hcfcfb64_5.conda
- conda: https://conda.anaconda.org/conda-forge/win-64/ca-certificates-2024.2.2-h56e8100_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/click-8.1.7-win_pyh7428d3b_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/colorama-0.4.6-pyhd8ed1ab_0.tar.bz2
- conda: https://conda.anaconda.org/conda-forge/noarch/editables-0.5-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/exceptiongroup-1.2.0-pyhd8ed1ab_2.conda
@@ -108,6 +131,8 @@ environments:
- conda: https://conda.anaconda.org/conda-forge/win-64/libffi-3.4.2-h8ffe710_5.tar.bz2
- conda: https://conda.anaconda.org/conda-forge/win-64/libsqlite-3.45.3-hcfcfb64_0.conda
- conda: https://conda.anaconda.org/conda-forge/win-64/libzlib-1.2.13-hcfcfb64_5.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/markdown-it-py-3.0.0-pyhd8ed1ab_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/mdurl-0.1.2-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/win-64/mypy-1.10.0-py312h4389bb4_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/mypy_extensions-1.0.0-pyha770c72_0.conda
- conda: https://conda.anaconda.org/conda-forge/win-64/openssl-3.3.0-h2466b09_3.conda
@@ -120,13 +145,21 @@ environments:
- conda: https://conda.anaconda.org/conda-forge/win-64/py-rattler-0.5.0-py312h2615798_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/pydantic-2.7.1-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/win-64/pydantic-core-2.18.2-py312h2615798_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/pydantic-settings-2.2.1-pyhd8ed1ab_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/pygments-2.18.0-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/pytest-8.2.1-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/win-64/python-3.12.3-h2628c8c_0_cpython.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/python-dotenv-1.0.1-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/win-64/python_abi-3.12-4_cp312.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/rich-13.7.1-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/setuptools-70.0.0-pyhd8ed1ab_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/shellingham-1.5.4-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/win-64/tk-8.6.13-h5226925_1.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/tomli-2.0.1-pyhd8ed1ab_0.tar.bz2
- conda: https://conda.anaconda.org/conda-forge/noarch/trove-classifiers-2024.5.22-pyhd8ed1ab_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/typer-0.12.3-pyhd8ed1ab_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/typer-slim-0.12.3-pyhd8ed1ab_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/typer-slim-standard-0.12.3-hd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/typing-extensions-4.11.0-hd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/typing_extensions-4.11.0-pyha770c72_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2024a-h0c530f3_0.conda
@@ -277,6 +310,7 @@ environments:
- conda: https://conda.anaconda.org/conda-forge/noarch/annotated-types-0.7.0-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/linux-64/bzip2-1.0.8-hd590300_5.conda
- conda: https://conda.anaconda.org/conda-forge/linux-64/ca-certificates-2024.2.2-hbcca054_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/click-8.1.7-unix_pyh707e725_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/colorama-0.4.6-pyhd8ed1ab_0.tar.bz2
- conda: https://conda.anaconda.org/conda-forge/noarch/editables-0.5-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/exceptiongroup-1.2.0-pyhd8ed1ab_2.conda
@@ -293,6 +327,8 @@ environments:
- conda: https://conda.anaconda.org/conda-forge/linux-64/libuuid-2.38.1-h0b41bf4_0.conda
- conda: https://conda.anaconda.org/conda-forge/linux-64/libxcrypt-4.4.36-hd590300_1.conda
- conda: https://conda.anaconda.org/conda-forge/linux-64/libzlib-1.2.13-hd590300_5.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/markdown-it-py-3.0.0-pyhd8ed1ab_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/mdurl-0.1.2-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/linux-64/mypy-1.10.0-py312h9a8786e_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/mypy_extensions-1.0.0-pyha770c72_0.conda
- conda: https://conda.anaconda.org/conda-forge/linux-64/ncurses-6.5-h59595ed_0.conda
@@ -306,14 +342,22 @@ environments:
- conda: https://conda.anaconda.org/conda-forge/linux-64/py-rattler-0.5.0-py312hbcc2302_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/pydantic-2.7.1-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/linux-64/pydantic-core-2.18.2-py312h4413252_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/pydantic-settings-2.2.1-pyhd8ed1ab_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/pygments-2.18.0-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/pytest-8.2.1-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/linux-64/python-3.12.3-hab00c5b_0_cpython.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/python-dotenv-1.0.1-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/linux-64/python_abi-3.12-4_cp312.conda
- conda: https://conda.anaconda.org/conda-forge/linux-64/readline-8.2-h8228510_1.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/rich-13.7.1-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/setuptools-70.0.0-pyhd8ed1ab_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/shellingham-1.5.4-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/linux-64/tk-8.6.13-noxft_h4845f30_101.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/tomli-2.0.1-pyhd8ed1ab_0.tar.bz2
- conda: https://conda.anaconda.org/conda-forge/noarch/trove-classifiers-2024.5.22-pyhd8ed1ab_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/typer-0.12.3-pyhd8ed1ab_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/typer-slim-0.12.3-pyhd8ed1ab_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/typer-slim-standard-0.12.3-hd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/typing-extensions-4.11.0-hd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/typing_extensions-4.11.0-pyha770c72_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2024a-h0c530f3_0.conda
@@ -324,6 +368,7 @@ environments:
- conda: https://conda.anaconda.org/conda-forge/noarch/annotated-types-0.7.0-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/bzip2-1.0.8-h93a5062_5.conda
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/ca-certificates-2024.2.2-hf0a4a13_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/click-8.1.7-unix_pyh707e725_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/colorama-0.4.6-pyhd8ed1ab_0.tar.bz2
- conda: https://conda.anaconda.org/conda-forge/noarch/editables-0.5-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/exceptiongroup-1.2.0-pyhd8ed1ab_2.conda
@@ -334,6 +379,8 @@ environments:
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/libffi-3.4.2-h3422bc3_5.tar.bz2
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/libsqlite-3.45.3-h091b4b1_0.conda
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/libzlib-1.2.13-h53f4e23_5.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/markdown-it-py-3.0.0-pyhd8ed1ab_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/mdurl-0.1.2-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/mypy-1.10.0-py312h4a164c9_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/mypy_extensions-1.0.0-pyha770c72_0.conda
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/ncurses-6.5-hb89a1cb_0.conda
@@ -347,14 +394,22 @@ environments:
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/py-rattler-0.5.0-py312h1a1520d_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/pydantic-2.7.1-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/pydantic-core-2.18.2-py312hbdaf6d9_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/pydantic-settings-2.2.1-pyhd8ed1ab_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/pygments-2.18.0-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/pytest-8.2.1-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/python-3.12.3-h4a7b5fc_0_cpython.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/python-dotenv-1.0.1-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/python_abi-3.12-4_cp312.conda
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/readline-8.2-h92ec313_1.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/rich-13.7.1-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/setuptools-70.0.0-pyhd8ed1ab_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/shellingham-1.5.4-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/tk-8.6.13-h5083fa2_1.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/tomli-2.0.1-pyhd8ed1ab_0.tar.bz2
- conda: https://conda.anaconda.org/conda-forge/noarch/trove-classifiers-2024.5.22-pyhd8ed1ab_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/typer-0.12.3-pyhd8ed1ab_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/typer-slim-0.12.3-pyhd8ed1ab_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/typer-slim-standard-0.12.3-hd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/typing-extensions-4.11.0-hd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/typing_extensions-4.11.0-pyha770c72_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2024a-h0c530f3_0.conda
@@ -365,6 +420,7 @@ environments:
- conda: https://conda.anaconda.org/conda-forge/noarch/annotated-types-0.7.0-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/win-64/bzip2-1.0.8-hcfcfb64_5.conda
- conda: https://conda.anaconda.org/conda-forge/win-64/ca-certificates-2024.2.2-h56e8100_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/click-8.1.7-win_pyh7428d3b_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/colorama-0.4.6-pyhd8ed1ab_0.tar.bz2
- conda: https://conda.anaconda.org/conda-forge/noarch/editables-0.5-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/exceptiongroup-1.2.0-pyhd8ed1ab_2.conda
@@ -375,6 +431,8 @@ environments:
- conda: https://conda.anaconda.org/conda-forge/win-64/libffi-3.4.2-h8ffe710_5.tar.bz2
- conda: https://conda.anaconda.org/conda-forge/win-64/libsqlite-3.45.3-hcfcfb64_0.conda
- conda: https://conda.anaconda.org/conda-forge/win-64/libzlib-1.2.13-hcfcfb64_5.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/markdown-it-py-3.0.0-pyhd8ed1ab_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/mdurl-0.1.2-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/win-64/mypy-1.10.0-py312h4389bb4_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/mypy_extensions-1.0.0-pyha770c72_0.conda
- conda: https://conda.anaconda.org/conda-forge/win-64/openssl-3.3.0-h2466b09_3.conda
@@ -387,13 +445,21 @@ environments:
- conda: https://conda.anaconda.org/conda-forge/win-64/py-rattler-0.5.0-py312h2615798_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/pydantic-2.7.1-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/win-64/pydantic-core-2.18.2-py312h2615798_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/pydantic-settings-2.2.1-pyhd8ed1ab_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/pygments-2.18.0-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/pytest-8.2.1-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/win-64/python-3.12.3-h2628c8c_0_cpython.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/python-dotenv-1.0.1-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/win-64/python_abi-3.12-4_cp312.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/rich-13.7.1-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/setuptools-70.0.0-pyhd8ed1ab_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/shellingham-1.5.4-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/win-64/tk-8.6.13-h5226925_1.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/tomli-2.0.1-pyhd8ed1ab_0.tar.bz2
- conda: https://conda.anaconda.org/conda-forge/noarch/trove-classifiers-2024.5.22-pyhd8ed1ab_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/typer-0.12.3-pyhd8ed1ab_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/typer-slim-0.12.3-pyhd8ed1ab_0.conda
+ - conda: https://conda.anaconda.org/conda-forge/noarch/typer-slim-standard-0.12.3-hd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/typing-extensions-4.11.0-hd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/typing_extensions-4.11.0-pyha770c72_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2024a-h0c530f3_0.conda
@@ -598,6 +664,39 @@ packages:
license_family: MIT
size: 10788
timestamp: 1629909423398
+- kind: conda
+ name: click
+ version: 8.1.7
+ build: unix_pyh707e725_0
+ subdir: noarch
+ noarch: python
+ url: https://conda.anaconda.org/conda-forge/noarch/click-8.1.7-unix_pyh707e725_0.conda
+ sha256: f0016cbab6ac4138a429e28dbcb904a90305b34b3fe41a9b89d697c90401caec
+ md5: f3ad426304898027fc619827ff428eca
+ depends:
+ - __unix
+ - python >=3.8
+ license: BSD-3-Clause
+ license_family: BSD
+ size: 84437
+ timestamp: 1692311973840
+- kind: conda
+ name: click
+ version: 8.1.7
+ build: win_pyh7428d3b_0
+ subdir: noarch
+ noarch: python
+ url: https://conda.anaconda.org/conda-forge/noarch/click-8.1.7-win_pyh7428d3b_0.conda
+ sha256: 90236b113b9a20041736e80b80ee965167f9aac0468315c55e2bad902d673fb0
+ md5: 3549ecbceb6cd77b91a105511b7d0786
+ depends:
+ - __win
+ - colorama
+ - python >=3.8
+ license: BSD-3-Clause
+ license_family: BSD
+ size: 85051
+ timestamp: 1692312207348
- kind: conda
name: colorama
version: 0.4.6
@@ -1115,6 +1214,37 @@ packages:
license: MIT, BSD
size: 31928
timestamp: 1608166099896
+- kind: conda
+ name: markdown-it-py
+ version: 3.0.0
+ build: pyhd8ed1ab_0
+ subdir: noarch
+ noarch: python
+ url: https://conda.anaconda.org/conda-forge/noarch/markdown-it-py-3.0.0-pyhd8ed1ab_0.conda
+ sha256: c041b0eaf7a6af3344d5dd452815cdc148d6284fec25a4fa3f4263b3a021e962
+ md5: 93a8e71256479c62074356ef6ebf501b
+ depends:
+ - mdurl >=0.1,<1
+ - python >=3.8
+ license: MIT
+ license_family: MIT
+ size: 64356
+ timestamp: 1686175179621
+- kind: conda
+ name: mdurl
+ version: 0.1.2
+ build: pyhd8ed1ab_0
+ subdir: noarch
+ noarch: python
+ url: https://conda.anaconda.org/conda-forge/noarch/mdurl-0.1.2-pyhd8ed1ab_0.conda
+ sha256: 64073dfb6bb429d52fff30891877b48c7ec0f89625b1bf844905b66a81cce6e1
+ md5: 776a8dd9e824f77abac30e6ef43a8f7a
+ depends:
+ - python >=3.6
+ license: MIT
+ license_family: MIT
+ size: 14680
+ timestamp: 1704317789138
- kind: conda
name: msys2-conda-epoch
version: '20160418'
@@ -1620,6 +1750,38 @@ packages:
license_family: MIT
size: 1446204
timestamp: 1713862624871
+- kind: conda
+ name: pydantic-settings
+ version: 2.2.1
+ build: pyhd8ed1ab_0
+ subdir: noarch
+ noarch: python
+ url: https://conda.anaconda.org/conda-forge/noarch/pydantic-settings-2.2.1-pyhd8ed1ab_0.conda
+ sha256: 9b099101bcea6aab4f3506f85513ad36bb4136af3348431d63144a87407d6030
+ md5: d6674d998f31d742f79f0f89f0692141
+ depends:
+ - pydantic >=2.3.0
+ - python >=3.8
+ - python-dotenv >=0.21.0
+ license: MIT
+ license_family: MIT
+ size: 18048
+ timestamp: 1708377239151
+- kind: conda
+ name: pygments
+ version: 2.18.0
+ build: pyhd8ed1ab_0
+ subdir: noarch
+ noarch: python
+ url: https://conda.anaconda.org/conda-forge/noarch/pygments-2.18.0-pyhd8ed1ab_0.conda
+ sha256: 78267adf4e76d0d64ea2ffab008c501156c108bb08fecb703816fb63e279780b
+ md5: b7f5c092b8f9800150d998a71b76d5a1
+ depends:
+ - python >=3.8
+ license: BSD-2-Clause
+ license_family: BSD
+ size: 879295
+ timestamp: 1714846885370
- kind: conda
name: pytest
version: 8.2.1
@@ -1725,6 +1887,21 @@ packages:
license: Python-2.0
size: 31991381
timestamp: 1713208036041
+- kind: conda
+ name: python-dotenv
+ version: 1.0.1
+ build: pyhd8ed1ab_0
+ subdir: noarch
+ noarch: python
+ url: https://conda.anaconda.org/conda-forge/noarch/python-dotenv-1.0.1-pyhd8ed1ab_0.conda
+ sha256: 2d4c80364f03315d606a50eddd493dbacc078e21412c2462c0f781eec49b572c
+ md5: c2997ea9360ac4e015658804a7a84f94
+ depends:
+ - python >=3.8
+ license: BSD-3-Clause
+ license_family: BSD
+ size: 24278
+ timestamp: 1706018281544
- kind: conda
name: python_abi
version: '3.12'
@@ -1857,6 +2034,24 @@ packages:
license_family: GPL
size: 250351
timestamp: 1679532511311
+- kind: conda
+ name: rich
+ version: 13.7.1
+ build: pyhd8ed1ab_0
+ subdir: noarch
+ noarch: python
+ url: https://conda.anaconda.org/conda-forge/noarch/rich-13.7.1-pyhd8ed1ab_0.conda
+ sha256: 2b26d58aa59e46f933c3126367348651b0dab6e0bf88014e857415bb184a4667
+ md5: ba445bf767ae6f0d959ff2b40c20912b
+ depends:
+ - markdown-it-py >=2.2.0
+ - pygments >=2.13.0,<3.0.0
+ - python >=3.7.0
+ - typing_extensions >=4.0.0,<5.0.0
+ license: MIT
+ license_family: MIT
+ size: 184347
+ timestamp: 1709150578093
- kind: conda
name: ruamel.yaml
version: 0.18.6
@@ -2030,6 +2225,21 @@ packages:
license_family: MIT
size: 483015
timestamp: 1716368141661
+- kind: conda
+ name: shellingham
+ version: 1.5.4
+ build: pyhd8ed1ab_0
+ subdir: noarch
+ noarch: python
+ url: https://conda.anaconda.org/conda-forge/noarch/shellingham-1.5.4-pyhd8ed1ab_0.conda
+ sha256: 3c49a0a101c41b7cf6ac05a1872d7a1f91f1b6d02eecb4a36b605a19517862bb
+ md5: d08db09a552699ee9e7eec56b4eb3899
+ depends:
+ - python >=3.7
+ license: MIT
+ license_family: MIT
+ size: 14568
+ timestamp: 1698144516278
- kind: conda
name: taplo
version: 0.9.1
@@ -2154,6 +2364,60 @@ packages:
license_family: Apache
size: 18449
timestamp: 1716451864560
+- kind: conda
+ name: typer
+ version: 0.12.3
+ build: pyhd8ed1ab_0
+ subdir: noarch
+ noarch: python
+ url: https://conda.anaconda.org/conda-forge/noarch/typer-0.12.3-pyhd8ed1ab_0.conda
+ sha256: b8b182303858c512fa04f38a3123c892958f708d2ae90afd35246da7c4829485
+ md5: 10efd02b22c39c0a46312ef7cb16d237
+ depends:
+ - python >=3.7
+ - typer-slim-standard 0.12.3 hd8ed1ab_0
+ license: MIT
+ license_family: MIT
+ size: 52670
+ timestamp: 1712702716762
+- kind: conda
+ name: typer-slim
+ version: 0.12.3
+ build: pyhd8ed1ab_0
+ subdir: noarch
+ noarch: python
+ url: https://conda.anaconda.org/conda-forge/noarch/typer-slim-0.12.3-pyhd8ed1ab_0.conda
+ sha256: 01dcb54375c8eae54d13374ed3d5823635401c552340b87e67fdbbb507760596
+ md5: cf2c3a89f89644c53cadbfeb124914e9
+ depends:
+ - click >=8.0.0
+ - python >=3.7
+ - typing_extensions >=3.7.4.3
+ constrains:
+ - shellingham >=1.3.0,<2.0.0
+ - rich >=10.11.0,<14.0.0
+ - typer >=0.12.3,<0.12.4.0a0
+ license: MIT
+ license_family: MIT
+ size: 45674
+ timestamp: 1712702684668
+- kind: conda
+ name: typer-slim-standard
+ version: 0.12.3
+ build: hd8ed1ab_0
+ subdir: noarch
+ noarch: generic
+ url: https://conda.anaconda.org/conda-forge/noarch/typer-slim-standard-0.12.3-hd8ed1ab_0.conda
+ sha256: 06e2f8ca7e3f7168a39d3d2cc62ee1e220928e1e5a4370f4ade2566342c4a459
+ md5: 8e56b98837d17e6ace4dc455d905709a
+ depends:
+ - rich
+ - shellingham
+ - typer-slim 0.12.3 pyhd8ed1ab_0
+ license: MIT
+ license_family: MIT
+ size: 46047
+ timestamp: 1712702688759
- kind: conda
name: typing-extensions
version: 4.11.0
diff --git a/pixi.toml b/pixi.toml
index dd370a6..1fd9310 100644
--- a/pixi.toml
+++ b/pixi.toml
@@ -12,6 +12,8 @@ python = ">=3.12"
pydantic = ">=2.7.1,<2.8"
py-rattler = ">=0.5.0,<0.6"
ordered_enum = ">=0.0.8,<0.1"
+typer = ">=0.12.3,<0.13"
+pydantic-settings = ">=2.2.1,<2.3"
[host-dependencies]
pip = "*"
diff --git a/pixi_diff_to_markdown/__main__.py b/pixi_diff_to_markdown/__main__.py
index d46f95b..306b8a3 100644
--- a/pixi_diff_to_markdown/__main__.py
+++ b/pixi_diff_to_markdown/__main__.py
@@ -1,203 +1,4 @@
-import json
-from typing import Literal
-
-from pixi_diff_to_markdown.models import (
- ChangeType,
- Configuration,
- Environments,
- UpdateSpec,
- calculate_change_type,
-)
-
-# TODO: pypi support
-
-
-def update_spec_to_table_line(
- package_name: str, update_spec: UpdateSpec, configuration: Configuration
-) -> str:
- change_type = calculate_change_type(update_spec)
- if change_type == ChangeType.ADDED:
- before = ""
- after = update_spec.after.version # type: ignore[union-attr]
- elif change_type == ChangeType.REMOVED:
- before = update_spec.before.version # type: ignore[union-attr]
- after = ""
- elif change_type == ChangeType.BUILD:
- before = update_spec.before.build # type: ignore[union-attr]
- after = update_spec.after.build # type: ignore[union-attr]
- else:
- before = update_spec.before.version # type: ignore[union-attr]
- after = update_spec.after.version # type: ignore[union-attr]
- if (
- change_type == ChangeType.MAJOR_DOWN
- or change_type == ChangeType.MINOR_DOWN
- or change_type == ChangeType.PATCH_DOWN
- ):
- maybe_downgrade_ref = "[^2]"
- else:
- maybe_downgrade_ref = ""
- add_explicit_type = configuration["enable_explicit_type_column"]
- add_change_type = configuration["enable_change_type_column"]
- add_package_type = configuration["enable_package_type_column"]
- if not add_explicit_type and update_spec.explicit:
- package_name_formatted = f"*{package_name}*"
- else:
- package_name_formatted = package_name
-
- return (
- f"| {package_name_formatted + maybe_downgrade_ref} |"
- f" {before} |"
- f" {after} |"
- f"{f" {change_type.value} |" if add_change_type else ""}"
- f"{f" {str(update_spec.explicit).lower()} |" if add_explicit_type else ""}"
- f"{f' {update_spec.type_} |' if add_package_type else ''}"
- )
-
-
-def generate_output(data: Environments, configuration: Configuration) -> str:
- if configuration["split_tables"] == "no":
- return generate_table_no_split_tables(data, configuration)
- elif configuration["split_tables"] == "environment":
- return generate_table_environment_split_tables(data, configuration)
- elif configuration["split_tables"] == "platform":
- return generate_table_platform_split_tables(data, configuration)
-
-
-def generate_header(
- split_type: Literal["no", "environment", "platform"], configuration: Configuration
-):
- add_change_type = configuration["enable_change_type_column"]
- add_explicit_type = configuration["enable_explicit_type_column"]
- add_package_type = configuration["enable_package_type_column"]
- if split_type == "no":
- prefix = "| Environment "
- elif split_type == "environment":
- prefix = "| Platform "
- else:
- assert split_type == "platform"
- prefix = ""
- header_line1 = (
- f"{prefix}| Dependency{"[^1]" if not add_explicit_type else ""} | Before | After |"
- f"{" Change |" if add_change_type else ""}"
- f"{" Explicit |" if add_explicit_type else ""}"
- f"{" Package |" if add_package_type else ""}"
- )
- header_line2 = f"{"| -: " if split_type != "platform" else ""}| - | - | - |{" - |" if add_change_type else ""}{" - |" if add_explicit_type else ""}{" - |" if add_package_type else ""}"
- return header_line1 + "\n" + header_line2
-
-
-def generate_footnotes() -> str:
- return """[^1]: *Cursive* means explicit dependency.
-[^2]: Dependency got downgraded.
-"""
-
-
-def generate_table_no_split_tables(
- data: Environments, configuration: Configuration
-) -> str:
- header = generate_header("no", configuration)
- lines = []
- for environment, platforms in data.root.items():
- for platform, dependencies in platforms.root.items():
- lines_platform = [
- update_spec_to_table_line(package_name, update_spec, configuration)
- for (package_name, update_spec) in sorted(
- dependencies.root.items(), key=lambda x: (x[1], x[0])
- )
- ]
- lines_platform[0] = f"| {environment} / {platform} {lines_platform[0]}"
- for i in range(1, len(lines_platform)):
- lines_platform[i] = "|" + lines_platform[i]
- lines.extend(lines_platform)
- lines.append("")
- content = "\n".join(lines)
-
- footnote = generate_footnotes()
- table = header + "\n" + content + "\n" + footnote
- return table
-
-
-def generate_table_environment_split_tables(
- data: Environments, configuration: Configuration
-) -> str:
- header = generate_header("environment", configuration)
- lines = []
- for environment, platforms in data.root.items():
- if configuration["hide_tables"]:
- lines.append("")
- lines.append(f"{environment}
")
- else:
- lines.append(f"## {environment}")
- lines.append("")
- lines.append(header)
- for platform, dependencies in platforms.root.items():
- lines_platform = [
- update_spec_to_table_line(package_name, update_spec, configuration)
- for (package_name, update_spec) in sorted(
- dependencies.root.items(), key=lambda x: (x[1], x[0])
- )
- ]
- lines_platform[0] = f"| {platform} {lines_platform[0]}"
- for i in range(1, len(lines_platform)):
- lines_platform[i] = "|" + lines_platform[i]
- lines.extend(lines_platform)
- if configuration["hide_tables"]:
- lines.append("")
- lines.append(" ")
- lines.append("")
- content = "\n".join(lines)
- footnote = generate_footnotes()
- table = content + "\n" + footnote
- return table
-
-
-def generate_table_platform_split_tables(
- data: Environments, configuration: Configuration
-) -> str:
- header = generate_header("platform", configuration)
- lines = []
- for environment, platforms in data.root.items():
- lines.append(f"# {environment}")
- lines.append("")
- for platform, dependencies in platforms.root.items():
- if configuration["hide_tables"]:
- lines.append("")
- lines.append(f"{platform}
")
- else:
- lines.append(f"## {platform}")
- lines.append("")
- lines.append(header)
- lines_platform = [
- update_spec_to_table_line(package_name, update_spec, configuration)
- for (package_name, update_spec) in sorted(
- dependencies.root.items(), key=lambda x: (x[1], x[0])
- )
- ]
- lines.extend(lines_platform)
- if configuration["hide_tables"]:
- lines.append("")
- lines.append(" ")
- lines.append("")
- content = "\n".join(lines)
- footnote = generate_footnotes()
- table = content + "\n" + footnote
- return table
-
-
-def main():
- configuration: Configuration = {
- "enable_change_type_column": True,
- "enable_package_type_column": False,
- "enable_explicit_type_column": False,
- "split_tables": "no",
- "hide_tables": False,
- }
- with open("tests/resources/test.json") as f:
- data = json.load(f)
- data_parsed = Environments(data)
- output = generate_output(data_parsed, configuration)
- print(output)
-
+from pixi_diff_to_markdown.cli import app
if __name__ == "__main__":
- main()
+ app()
diff --git a/pixi_diff_to_markdown/cli.py b/pixi_diff_to_markdown/cli.py
new file mode 100644
index 0000000..d028ae1
--- /dev/null
+++ b/pixi_diff_to_markdown/cli.py
@@ -0,0 +1,58 @@
+# ruff: noqa: UP007
+from sys import stdin
+from typing import Annotated, Optional
+
+import typer
+
+from pixi_diff_to_markdown.diff import generate_output
+from pixi_diff_to_markdown.models import Environments
+from pixi_diff_to_markdown.settings import Settings, SplitTables
+
+app = typer.Typer()
+
+
+@app.command(
+ help="Convert `pixi update --json` diff to markdown. Reads from stdin and writes to stdout: `pixi --json | pixi diff-to-markdown > output.md`"
+)
+def main(
+ change_type_column: Annotated[
+ Optional[bool],
+ typer.Option(help="Enable the change type column.", show_default=False),
+ ] = None,
+ package_type_column: Annotated[
+ Optional[bool],
+ typer.Option(
+ help="Enable the package type (conda/pypi) column.", show_default=False
+ ),
+ ] = None,
+ explicit_column: Annotated[
+ Optional[bool],
+ typer.Option(
+ help="Enable the explicit (explicit/implicit) column.", show_default=False
+ ),
+ ] = None,
+ split_tables: Annotated[
+ Optional[SplitTables],
+ typer.Option(help="In what way to split tables.", show_default=False),
+ ] = None,
+ hide_tables: Annotated[
+ Optional[bool],
+ typer.Option(
+ help="Whether to hide tables in a collapsible element.", show_default=False
+ ),
+ ] = None,
+):
+ settings_dict = {
+ "change-type-column": change_type_column,
+ "package-type-column": package_type_column,
+ "explicit-column": explicit_column,
+ "split-tables": split_tables,
+ "hide-tables": hide_tables,
+ }
+ settings = Settings.model_validate(
+ {k: v for k, v in settings_dict.items() if v is not None}
+ )
+ data = "".join(stdin.readlines())
+ data_parsed = Environments.model_validate_json(data)
+ output = generate_output(data_parsed, settings)
+ print(output)
diff --git a/pixi_diff_to_markdown/diff.py b/pixi_diff_to_markdown/diff.py
new file mode 100644
index 0000000..544e2f3
--- /dev/null
+++ b/pixi_diff_to_markdown/diff.py
@@ -0,0 +1,178 @@
+from typing import Literal
+
+from pixi_diff_to_markdown.models import (
+ ChangeType,
+ Environments,
+ UpdateSpec,
+ calculate_change_type,
+)
+from pixi_diff_to_markdown.settings import Settings
+
+
+def update_spec_to_table_line(
+ package_name: str, update_spec: UpdateSpec, settings: Settings
+) -> str:
+ change_type = calculate_change_type(update_spec)
+ if change_type == ChangeType.ADDED:
+ before = ""
+ after = update_spec.after.version # type: ignore[union-attr]
+ elif change_type == ChangeType.REMOVED:
+ before = update_spec.before.version # type: ignore[union-attr]
+ after = ""
+ elif change_type == ChangeType.BUILD:
+ before = update_spec.before.build # type: ignore[union-attr]
+ after = update_spec.after.build # type: ignore[union-attr]
+ else:
+ before = update_spec.before.version # type: ignore[union-attr]
+ after = update_spec.after.version # type: ignore[union-attr]
+ if (
+ change_type == ChangeType.MAJOR_DOWN
+ or change_type == ChangeType.MINOR_DOWN
+ or change_type == ChangeType.PATCH_DOWN
+ ):
+ maybe_downgrade_ref = "[^2]"
+ else:
+ maybe_downgrade_ref = ""
+ add_explicit = settings.explicit_column
+ add_change_type = settings.change_type_column
+ add_package_type = settings.package_type_column
+ if not add_explicit and update_spec.explicit:
+ package_name_formatted = f"*{package_name}*"
+ else:
+ package_name_formatted = package_name
+
+ return (
+ f"| {package_name_formatted + maybe_downgrade_ref} |"
+ f" {before} |"
+ f" {after} |"
+ f"{f" {change_type.value} |" if add_change_type else ""}"
+ f"{f" {str(update_spec.explicit).lower()} |" if add_explicit else ""}"
+ f"{f' {update_spec.type_} |' if add_package_type else ''}"
+ )
+
+
+def generate_output(data: Environments, settings: Settings) -> str:
+ if settings.split_tables == "no":
+ return generate_table_no_split_tables(data, settings)
+ elif settings.split_tables == "environment":
+ return generate_table_environment_split_tables(data, settings)
+ else:
+ assert settings.split_tables == "platform"
+ return generate_table_platform_split_tables(data, settings)
+
+
+def generate_header(
+ split_type: Literal["no", "environment", "platform"], settings: Settings
+):
+ add_change_type = settings.change_type_column
+ add_explicit = settings.explicit_column
+ add_package_type = settings.package_type_column
+ if split_type == "no":
+ prefix = "| Environment "
+ elif split_type == "environment":
+ prefix = "| Platform "
+ else:
+ assert split_type == "platform"
+ prefix = ""
+ header_line1 = (
+ f"{prefix}| Dependency{"[^1]" if not add_explicit else ""} | Before | After |"
+ f"{" Change |" if add_change_type else ""}"
+ f"{" Explicit |" if add_explicit else ""}"
+ f"{" Package |" if add_package_type else ""}"
+ )
+ header_line2 = f"{"| -: " if split_type != "platform" else ""}| - | - | - |{" - |" if add_change_type else ""}{" - |" if add_explicit else ""}{" - |" if add_package_type else ""}"
+ return header_line1 + "\n" + header_line2
+
+
+def generate_footnotes() -> str:
+ return """[^1]: *Cursive* means explicit dependency.
+[^2]: Dependency got downgraded.
+"""
+
+
+def generate_table_no_split_tables(data: Environments, settings: Settings) -> str:
+ header = generate_header("no", settings)
+ lines = []
+ for environment, platforms in data.root.items():
+ for platform, dependencies in platforms.root.items():
+ lines_platform = [
+ update_spec_to_table_line(package_name, update_spec, settings)
+ for (package_name, update_spec) in sorted(
+ dependencies.root.items(), key=lambda x: (x[1], x[0])
+ )
+ ]
+ lines_platform[0] = f"| {environment} / {platform} {lines_platform[0]}"
+ for i in range(1, len(lines_platform)):
+ lines_platform[i] = "|" + lines_platform[i]
+ lines.extend(lines_platform)
+ lines.append("")
+ content = "\n".join(lines)
+
+ footnote = generate_footnotes()
+ table = header + "\n" + content + "\n" + footnote
+ return table
+
+
+def generate_table_environment_split_tables(
+ data: Environments, settings: Settings
+) -> str:
+ header = generate_header("environment", settings)
+ lines = []
+ for environment, platforms in data.root.items():
+ if settings.hide_tables:
+ lines.append("")
+ lines.append(f"{environment}
")
+ else:
+ lines.append(f"## {environment}")
+ lines.append("")
+ lines.append(header)
+ for platform, dependencies in platforms.root.items():
+ lines_platform = [
+ update_spec_to_table_line(package_name, update_spec, settings)
+ for (package_name, update_spec) in sorted(
+ dependencies.root.items(), key=lambda x: (x[1], x[0])
+ )
+ ]
+ lines_platform[0] = f"| {platform} {lines_platform[0]}"
+ for i in range(1, len(lines_platform)):
+ lines_platform[i] = "|" + lines_platform[i]
+ lines.extend(lines_platform)
+ if settings.hide_tables:
+ lines.append("")
+ lines.append(" ")
+ lines.append("")
+ content = "\n".join(lines)
+ footnote = generate_footnotes()
+ table = content + "\n" + footnote
+ return table
+
+
+def generate_table_platform_split_tables(data: Environments, settings: Settings) -> str:
+ header = generate_header("platform", settings)
+ lines = []
+ for environment, platforms in data.root.items():
+ lines.append(f"# {environment}")
+ lines.append("")
+ for platform, dependencies in platforms.root.items():
+ if settings.hide_tables:
+ lines.append("")
+ lines.append(f"{platform}
")
+ else:
+ lines.append(f"## {platform}")
+ lines.append("")
+ lines.append(header)
+ lines_platform = [
+ update_spec_to_table_line(package_name, update_spec, settings)
+ for (package_name, update_spec) in sorted(
+ dependencies.root.items(), key=lambda x: (x[1], x[0])
+ )
+ ]
+ lines.extend(lines_platform)
+ if settings.hide_tables:
+ lines.append("")
+ lines.append(" ")
+ lines.append("")
+ content = "\n".join(lines)
+ footnote = generate_footnotes()
+ table = content + "\n" + footnote
+ return table
diff --git a/pixi_diff_to_markdown/pydantic_settings_extension.py b/pixi_diff_to_markdown/pydantic_settings_extension.py
new file mode 100644
index 0000000..23e9daa
--- /dev/null
+++ b/pixi_diff_to_markdown/pydantic_settings_extension.py
@@ -0,0 +1,24 @@
+from pydantic_settings import BaseSettings, TomlConfigSettingsSource
+from pydantic_settings.sources import DEFAULT_PATH, PathType
+
+
+class TomlWithTableHeaderConfigSettingsSource(TomlConfigSettingsSource):
+ """
+ A source class that loads variables from a TOML file but only inside a header.
+ """
+
+ def __init__(
+ self,
+ settings_cls: type[BaseSettings],
+ toml_file: PathType | None = DEFAULT_PATH,
+ ) -> None:
+ self.toml_file_path = (
+ toml_file
+ if toml_file != DEFAULT_PATH
+ else settings_cls.model_config.get("toml_file")
+ )
+ self.toml_table_header = ("tool", "pixi-diff-to-markdown")
+ self.toml_data = self._read_files(self.toml_file_path)
+ for key in self.toml_table_header:
+ self.toml_data = self.toml_data.get(key, {})
+ super(TomlConfigSettingsSource, self).__init__(settings_cls, self.toml_data)
diff --git a/pixi_diff_to_markdown/settings.py b/pixi_diff_to_markdown/settings.py
new file mode 100644
index 0000000..7a3a9bc
--- /dev/null
+++ b/pixi_diff_to_markdown/settings.py
@@ -0,0 +1,46 @@
+from enum import Enum
+
+from pydantic_settings import (
+ BaseSettings,
+ PydanticBaseSettingsSource,
+ SettingsConfigDict,
+)
+
+from pixi_diff_to_markdown.pydantic_settings_extension import (
+ TomlWithTableHeaderConfigSettingsSource,
+)
+
+
+class SplitTables(str, Enum):
+ no = "no"
+ environment = "environment"
+ platform = "platform"
+
+
+class Settings(BaseSettings):
+ model_config = SettingsConfigDict(
+ # pixi.toml has higher priority if it exists
+ toml_file=["pyproject.toml", "pixi.toml"],
+ env_prefix="PIXI_DIFF_TO_MARKDOWN_",
+ alias_generator=lambda x: x.replace("_", "-"),
+ )
+ change_type_column: bool = True
+ package_type_column: bool = True
+ explicit_column: bool = False
+ split_tables: SplitTables = SplitTables.platform
+ hide_tables: bool = False
+
+ @classmethod
+ def settings_customise_sources(
+ cls,
+ settings_cls: type[BaseSettings],
+ init_settings: PydanticBaseSettingsSource, # correspond to CLI arguments
+ env_settings: PydanticBaseSettingsSource,
+ dotenv_settings: PydanticBaseSettingsSource,
+ file_secret_settings: PydanticBaseSettingsSource,
+ ) -> tuple[PydanticBaseSettingsSource, ...]:
+ return (
+ init_settings,
+ env_settings,
+ TomlWithTableHeaderConfigSettingsSource(settings_cls),
+ )
diff --git a/pyproject.toml b/pyproject.toml
index 6192492..8ba0674 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -17,7 +17,7 @@ requires-python = ">=3.12"
repository = "https://github.com/pavelzw/pixi-diff-to-markdown"
[project.scripts]
-pixi-diff-to-markdown = "pixi_diff_to_markdown.__main__:main"
+pixi-diff-to-markdown = "pixi_diff_to_markdown.__main__:app"
# pixi-diff-to-markdown2 = "pixi_diff_to_markdown.cli"
[tool.ruff]
diff --git a/tests/resources/output/split-tables-environment_hide-tables-False_change-type-False_explicit-type-False_package-type-False.md b/tests/resources/output/split-tables-environment_hide-tables-False_change-type-False_explicit-False_package-type-False.md
similarity index 100%
rename from tests/resources/output/split-tables-environment_hide-tables-False_change-type-False_explicit-type-False_package-type-False.md
rename to tests/resources/output/split-tables-environment_hide-tables-False_change-type-False_explicit-False_package-type-False.md
diff --git a/tests/resources/output/split-tables-environment_hide-tables-False_change-type-False_explicit-type-False_package-type-True.md b/tests/resources/output/split-tables-environment_hide-tables-False_change-type-False_explicit-False_package-type-True.md
similarity index 100%
rename from tests/resources/output/split-tables-environment_hide-tables-False_change-type-False_explicit-type-False_package-type-True.md
rename to tests/resources/output/split-tables-environment_hide-tables-False_change-type-False_explicit-False_package-type-True.md
diff --git a/tests/resources/output/split-tables-environment_hide-tables-False_change-type-False_explicit-type-True_package-type-False.md b/tests/resources/output/split-tables-environment_hide-tables-False_change-type-False_explicit-True_package-type-False.md
similarity index 100%
rename from tests/resources/output/split-tables-environment_hide-tables-False_change-type-False_explicit-type-True_package-type-False.md
rename to tests/resources/output/split-tables-environment_hide-tables-False_change-type-False_explicit-True_package-type-False.md
diff --git a/tests/resources/output/split-tables-environment_hide-tables-False_change-type-False_explicit-type-True_package-type-True.md b/tests/resources/output/split-tables-environment_hide-tables-False_change-type-False_explicit-True_package-type-True.md
similarity index 100%
rename from tests/resources/output/split-tables-environment_hide-tables-False_change-type-False_explicit-type-True_package-type-True.md
rename to tests/resources/output/split-tables-environment_hide-tables-False_change-type-False_explicit-True_package-type-True.md
diff --git a/tests/resources/output/split-tables-environment_hide-tables-False_change-type-True_explicit-type-False_package-type-False.md b/tests/resources/output/split-tables-environment_hide-tables-False_change-type-True_explicit-False_package-type-False.md
similarity index 100%
rename from tests/resources/output/split-tables-environment_hide-tables-False_change-type-True_explicit-type-False_package-type-False.md
rename to tests/resources/output/split-tables-environment_hide-tables-False_change-type-True_explicit-False_package-type-False.md
diff --git a/tests/resources/output/split-tables-environment_hide-tables-False_change-type-True_explicit-type-False_package-type-True.md b/tests/resources/output/split-tables-environment_hide-tables-False_change-type-True_explicit-False_package-type-True.md
similarity index 100%
rename from tests/resources/output/split-tables-environment_hide-tables-False_change-type-True_explicit-type-False_package-type-True.md
rename to tests/resources/output/split-tables-environment_hide-tables-False_change-type-True_explicit-False_package-type-True.md
diff --git a/tests/resources/output/split-tables-environment_hide-tables-False_change-type-True_explicit-type-True_package-type-False.md b/tests/resources/output/split-tables-environment_hide-tables-False_change-type-True_explicit-True_package-type-False.md
similarity index 100%
rename from tests/resources/output/split-tables-environment_hide-tables-False_change-type-True_explicit-type-True_package-type-False.md
rename to tests/resources/output/split-tables-environment_hide-tables-False_change-type-True_explicit-True_package-type-False.md
diff --git a/tests/resources/output/split-tables-environment_hide-tables-False_change-type-True_explicit-type-True_package-type-True.md b/tests/resources/output/split-tables-environment_hide-tables-False_change-type-True_explicit-True_package-type-True.md
similarity index 100%
rename from tests/resources/output/split-tables-environment_hide-tables-False_change-type-True_explicit-type-True_package-type-True.md
rename to tests/resources/output/split-tables-environment_hide-tables-False_change-type-True_explicit-True_package-type-True.md
diff --git a/tests/resources/output/split-tables-environment_hide-tables-True_change-type-False_explicit-type-False_package-type-False.md b/tests/resources/output/split-tables-environment_hide-tables-True_change-type-False_explicit-False_package-type-False.md
similarity index 100%
rename from tests/resources/output/split-tables-environment_hide-tables-True_change-type-False_explicit-type-False_package-type-False.md
rename to tests/resources/output/split-tables-environment_hide-tables-True_change-type-False_explicit-False_package-type-False.md
diff --git a/tests/resources/output/split-tables-environment_hide-tables-True_change-type-False_explicit-type-False_package-type-True.md b/tests/resources/output/split-tables-environment_hide-tables-True_change-type-False_explicit-False_package-type-True.md
similarity index 100%
rename from tests/resources/output/split-tables-environment_hide-tables-True_change-type-False_explicit-type-False_package-type-True.md
rename to tests/resources/output/split-tables-environment_hide-tables-True_change-type-False_explicit-False_package-type-True.md
diff --git a/tests/resources/output/split-tables-environment_hide-tables-True_change-type-False_explicit-type-True_package-type-False.md b/tests/resources/output/split-tables-environment_hide-tables-True_change-type-False_explicit-True_package-type-False.md
similarity index 100%
rename from tests/resources/output/split-tables-environment_hide-tables-True_change-type-False_explicit-type-True_package-type-False.md
rename to tests/resources/output/split-tables-environment_hide-tables-True_change-type-False_explicit-True_package-type-False.md
diff --git a/tests/resources/output/split-tables-environment_hide-tables-True_change-type-False_explicit-type-True_package-type-True.md b/tests/resources/output/split-tables-environment_hide-tables-True_change-type-False_explicit-True_package-type-True.md
similarity index 100%
rename from tests/resources/output/split-tables-environment_hide-tables-True_change-type-False_explicit-type-True_package-type-True.md
rename to tests/resources/output/split-tables-environment_hide-tables-True_change-type-False_explicit-True_package-type-True.md
diff --git a/tests/resources/output/split-tables-environment_hide-tables-True_change-type-True_explicit-type-False_package-type-False.md b/tests/resources/output/split-tables-environment_hide-tables-True_change-type-True_explicit-False_package-type-False.md
similarity index 100%
rename from tests/resources/output/split-tables-environment_hide-tables-True_change-type-True_explicit-type-False_package-type-False.md
rename to tests/resources/output/split-tables-environment_hide-tables-True_change-type-True_explicit-False_package-type-False.md
diff --git a/tests/resources/output/split-tables-environment_hide-tables-True_change-type-True_explicit-type-False_package-type-True.md b/tests/resources/output/split-tables-environment_hide-tables-True_change-type-True_explicit-False_package-type-True.md
similarity index 100%
rename from tests/resources/output/split-tables-environment_hide-tables-True_change-type-True_explicit-type-False_package-type-True.md
rename to tests/resources/output/split-tables-environment_hide-tables-True_change-type-True_explicit-False_package-type-True.md
diff --git a/tests/resources/output/split-tables-environment_hide-tables-True_change-type-True_explicit-type-True_package-type-False.md b/tests/resources/output/split-tables-environment_hide-tables-True_change-type-True_explicit-True_package-type-False.md
similarity index 100%
rename from tests/resources/output/split-tables-environment_hide-tables-True_change-type-True_explicit-type-True_package-type-False.md
rename to tests/resources/output/split-tables-environment_hide-tables-True_change-type-True_explicit-True_package-type-False.md
diff --git a/tests/resources/output/split-tables-environment_hide-tables-True_change-type-True_explicit-type-True_package-type-True.md b/tests/resources/output/split-tables-environment_hide-tables-True_change-type-True_explicit-True_package-type-True.md
similarity index 100%
rename from tests/resources/output/split-tables-environment_hide-tables-True_change-type-True_explicit-type-True_package-type-True.md
rename to tests/resources/output/split-tables-environment_hide-tables-True_change-type-True_explicit-True_package-type-True.md
diff --git a/tests/resources/output/split-tables-no_hide-tables-False_change-type-False_explicit-type-False_package-type-False.md b/tests/resources/output/split-tables-no_hide-tables-False_change-type-False_explicit-False_package-type-False.md
similarity index 100%
rename from tests/resources/output/split-tables-no_hide-tables-False_change-type-False_explicit-type-False_package-type-False.md
rename to tests/resources/output/split-tables-no_hide-tables-False_change-type-False_explicit-False_package-type-False.md
diff --git a/tests/resources/output/split-tables-no_hide-tables-False_change-type-False_explicit-type-False_package-type-True.md b/tests/resources/output/split-tables-no_hide-tables-False_change-type-False_explicit-False_package-type-True.md
similarity index 100%
rename from tests/resources/output/split-tables-no_hide-tables-False_change-type-False_explicit-type-False_package-type-True.md
rename to tests/resources/output/split-tables-no_hide-tables-False_change-type-False_explicit-False_package-type-True.md
diff --git a/tests/resources/output/split-tables-no_hide-tables-False_change-type-False_explicit-type-True_package-type-False.md b/tests/resources/output/split-tables-no_hide-tables-False_change-type-False_explicit-True_package-type-False.md
similarity index 100%
rename from tests/resources/output/split-tables-no_hide-tables-False_change-type-False_explicit-type-True_package-type-False.md
rename to tests/resources/output/split-tables-no_hide-tables-False_change-type-False_explicit-True_package-type-False.md
diff --git a/tests/resources/output/split-tables-no_hide-tables-False_change-type-False_explicit-type-True_package-type-True.md b/tests/resources/output/split-tables-no_hide-tables-False_change-type-False_explicit-True_package-type-True.md
similarity index 100%
rename from tests/resources/output/split-tables-no_hide-tables-False_change-type-False_explicit-type-True_package-type-True.md
rename to tests/resources/output/split-tables-no_hide-tables-False_change-type-False_explicit-True_package-type-True.md
diff --git a/tests/resources/output/split-tables-no_hide-tables-False_change-type-True_explicit-type-False_package-type-False.md b/tests/resources/output/split-tables-no_hide-tables-False_change-type-True_explicit-False_package-type-False.md
similarity index 100%
rename from tests/resources/output/split-tables-no_hide-tables-False_change-type-True_explicit-type-False_package-type-False.md
rename to tests/resources/output/split-tables-no_hide-tables-False_change-type-True_explicit-False_package-type-False.md
diff --git a/tests/resources/output/split-tables-no_hide-tables-False_change-type-True_explicit-type-False_package-type-True.md b/tests/resources/output/split-tables-no_hide-tables-False_change-type-True_explicit-False_package-type-True.md
similarity index 100%
rename from tests/resources/output/split-tables-no_hide-tables-False_change-type-True_explicit-type-False_package-type-True.md
rename to tests/resources/output/split-tables-no_hide-tables-False_change-type-True_explicit-False_package-type-True.md
diff --git a/tests/resources/output/split-tables-no_hide-tables-False_change-type-True_explicit-type-True_package-type-False.md b/tests/resources/output/split-tables-no_hide-tables-False_change-type-True_explicit-True_package-type-False.md
similarity index 100%
rename from tests/resources/output/split-tables-no_hide-tables-False_change-type-True_explicit-type-True_package-type-False.md
rename to tests/resources/output/split-tables-no_hide-tables-False_change-type-True_explicit-True_package-type-False.md
diff --git a/tests/resources/output/split-tables-no_hide-tables-False_change-type-True_explicit-type-True_package-type-True.md b/tests/resources/output/split-tables-no_hide-tables-False_change-type-True_explicit-True_package-type-True.md
similarity index 100%
rename from tests/resources/output/split-tables-no_hide-tables-False_change-type-True_explicit-type-True_package-type-True.md
rename to tests/resources/output/split-tables-no_hide-tables-False_change-type-True_explicit-True_package-type-True.md
diff --git a/tests/resources/output/split-tables-no_hide-tables-True_change-type-False_explicit-type-False_package-type-False.md b/tests/resources/output/split-tables-no_hide-tables-True_change-type-False_explicit-False_package-type-False.md
similarity index 100%
rename from tests/resources/output/split-tables-no_hide-tables-True_change-type-False_explicit-type-False_package-type-False.md
rename to tests/resources/output/split-tables-no_hide-tables-True_change-type-False_explicit-False_package-type-False.md
diff --git a/tests/resources/output/split-tables-no_hide-tables-True_change-type-False_explicit-type-False_package-type-True.md b/tests/resources/output/split-tables-no_hide-tables-True_change-type-False_explicit-False_package-type-True.md
similarity index 100%
rename from tests/resources/output/split-tables-no_hide-tables-True_change-type-False_explicit-type-False_package-type-True.md
rename to tests/resources/output/split-tables-no_hide-tables-True_change-type-False_explicit-False_package-type-True.md
diff --git a/tests/resources/output/split-tables-no_hide-tables-True_change-type-False_explicit-type-True_package-type-False.md b/tests/resources/output/split-tables-no_hide-tables-True_change-type-False_explicit-True_package-type-False.md
similarity index 100%
rename from tests/resources/output/split-tables-no_hide-tables-True_change-type-False_explicit-type-True_package-type-False.md
rename to tests/resources/output/split-tables-no_hide-tables-True_change-type-False_explicit-True_package-type-False.md
diff --git a/tests/resources/output/split-tables-no_hide-tables-True_change-type-False_explicit-type-True_package-type-True.md b/tests/resources/output/split-tables-no_hide-tables-True_change-type-False_explicit-True_package-type-True.md
similarity index 100%
rename from tests/resources/output/split-tables-no_hide-tables-True_change-type-False_explicit-type-True_package-type-True.md
rename to tests/resources/output/split-tables-no_hide-tables-True_change-type-False_explicit-True_package-type-True.md
diff --git a/tests/resources/output/split-tables-no_hide-tables-True_change-type-True_explicit-type-False_package-type-False.md b/tests/resources/output/split-tables-no_hide-tables-True_change-type-True_explicit-False_package-type-False.md
similarity index 100%
rename from tests/resources/output/split-tables-no_hide-tables-True_change-type-True_explicit-type-False_package-type-False.md
rename to tests/resources/output/split-tables-no_hide-tables-True_change-type-True_explicit-False_package-type-False.md
diff --git a/tests/resources/output/split-tables-no_hide-tables-True_change-type-True_explicit-type-False_package-type-True.md b/tests/resources/output/split-tables-no_hide-tables-True_change-type-True_explicit-False_package-type-True.md
similarity index 100%
rename from tests/resources/output/split-tables-no_hide-tables-True_change-type-True_explicit-type-False_package-type-True.md
rename to tests/resources/output/split-tables-no_hide-tables-True_change-type-True_explicit-False_package-type-True.md
diff --git a/tests/resources/output/split-tables-no_hide-tables-True_change-type-True_explicit-type-True_package-type-False.md b/tests/resources/output/split-tables-no_hide-tables-True_change-type-True_explicit-True_package-type-False.md
similarity index 100%
rename from tests/resources/output/split-tables-no_hide-tables-True_change-type-True_explicit-type-True_package-type-False.md
rename to tests/resources/output/split-tables-no_hide-tables-True_change-type-True_explicit-True_package-type-False.md
diff --git a/tests/resources/output/split-tables-no_hide-tables-True_change-type-True_explicit-type-True_package-type-True.md b/tests/resources/output/split-tables-no_hide-tables-True_change-type-True_explicit-True_package-type-True.md
similarity index 100%
rename from tests/resources/output/split-tables-no_hide-tables-True_change-type-True_explicit-type-True_package-type-True.md
rename to tests/resources/output/split-tables-no_hide-tables-True_change-type-True_explicit-True_package-type-True.md
diff --git a/tests/resources/output/split-tables-platform_hide-tables-False_change-type-False_explicit-type-False_package-type-False.md b/tests/resources/output/split-tables-platform_hide-tables-False_change-type-False_explicit-False_package-type-False.md
similarity index 100%
rename from tests/resources/output/split-tables-platform_hide-tables-False_change-type-False_explicit-type-False_package-type-False.md
rename to tests/resources/output/split-tables-platform_hide-tables-False_change-type-False_explicit-False_package-type-False.md
diff --git a/tests/resources/output/split-tables-platform_hide-tables-False_change-type-False_explicit-type-False_package-type-True.md b/tests/resources/output/split-tables-platform_hide-tables-False_change-type-False_explicit-False_package-type-True.md
similarity index 100%
rename from tests/resources/output/split-tables-platform_hide-tables-False_change-type-False_explicit-type-False_package-type-True.md
rename to tests/resources/output/split-tables-platform_hide-tables-False_change-type-False_explicit-False_package-type-True.md
diff --git a/tests/resources/output/split-tables-platform_hide-tables-False_change-type-False_explicit-type-True_package-type-False.md b/tests/resources/output/split-tables-platform_hide-tables-False_change-type-False_explicit-True_package-type-False.md
similarity index 100%
rename from tests/resources/output/split-tables-platform_hide-tables-False_change-type-False_explicit-type-True_package-type-False.md
rename to tests/resources/output/split-tables-platform_hide-tables-False_change-type-False_explicit-True_package-type-False.md
diff --git a/tests/resources/output/split-tables-platform_hide-tables-False_change-type-False_explicit-type-True_package-type-True.md b/tests/resources/output/split-tables-platform_hide-tables-False_change-type-False_explicit-True_package-type-True.md
similarity index 100%
rename from tests/resources/output/split-tables-platform_hide-tables-False_change-type-False_explicit-type-True_package-type-True.md
rename to tests/resources/output/split-tables-platform_hide-tables-False_change-type-False_explicit-True_package-type-True.md
diff --git a/tests/resources/output/split-tables-platform_hide-tables-False_change-type-True_explicit-type-False_package-type-False.md b/tests/resources/output/split-tables-platform_hide-tables-False_change-type-True_explicit-False_package-type-False.md
similarity index 100%
rename from tests/resources/output/split-tables-platform_hide-tables-False_change-type-True_explicit-type-False_package-type-False.md
rename to tests/resources/output/split-tables-platform_hide-tables-False_change-type-True_explicit-False_package-type-False.md
diff --git a/tests/resources/output/split-tables-platform_hide-tables-False_change-type-True_explicit-type-False_package-type-True.md b/tests/resources/output/split-tables-platform_hide-tables-False_change-type-True_explicit-False_package-type-True.md
similarity index 100%
rename from tests/resources/output/split-tables-platform_hide-tables-False_change-type-True_explicit-type-False_package-type-True.md
rename to tests/resources/output/split-tables-platform_hide-tables-False_change-type-True_explicit-False_package-type-True.md
diff --git a/tests/resources/output/split-tables-platform_hide-tables-False_change-type-True_explicit-type-True_package-type-False.md b/tests/resources/output/split-tables-platform_hide-tables-False_change-type-True_explicit-True_package-type-False.md
similarity index 100%
rename from tests/resources/output/split-tables-platform_hide-tables-False_change-type-True_explicit-type-True_package-type-False.md
rename to tests/resources/output/split-tables-platform_hide-tables-False_change-type-True_explicit-True_package-type-False.md
diff --git a/tests/resources/output/split-tables-platform_hide-tables-False_change-type-True_explicit-type-True_package-type-True.md b/tests/resources/output/split-tables-platform_hide-tables-False_change-type-True_explicit-True_package-type-True.md
similarity index 100%
rename from tests/resources/output/split-tables-platform_hide-tables-False_change-type-True_explicit-type-True_package-type-True.md
rename to tests/resources/output/split-tables-platform_hide-tables-False_change-type-True_explicit-True_package-type-True.md
diff --git a/tests/resources/output/split-tables-platform_hide-tables-True_change-type-False_explicit-type-False_package-type-False.md b/tests/resources/output/split-tables-platform_hide-tables-True_change-type-False_explicit-False_package-type-False.md
similarity index 100%
rename from tests/resources/output/split-tables-platform_hide-tables-True_change-type-False_explicit-type-False_package-type-False.md
rename to tests/resources/output/split-tables-platform_hide-tables-True_change-type-False_explicit-False_package-type-False.md
diff --git a/tests/resources/output/split-tables-platform_hide-tables-True_change-type-False_explicit-type-False_package-type-True.md b/tests/resources/output/split-tables-platform_hide-tables-True_change-type-False_explicit-False_package-type-True.md
similarity index 100%
rename from tests/resources/output/split-tables-platform_hide-tables-True_change-type-False_explicit-type-False_package-type-True.md
rename to tests/resources/output/split-tables-platform_hide-tables-True_change-type-False_explicit-False_package-type-True.md
diff --git a/tests/resources/output/split-tables-platform_hide-tables-True_change-type-False_explicit-type-True_package-type-False.md b/tests/resources/output/split-tables-platform_hide-tables-True_change-type-False_explicit-True_package-type-False.md
similarity index 100%
rename from tests/resources/output/split-tables-platform_hide-tables-True_change-type-False_explicit-type-True_package-type-False.md
rename to tests/resources/output/split-tables-platform_hide-tables-True_change-type-False_explicit-True_package-type-False.md
diff --git a/tests/resources/output/split-tables-platform_hide-tables-True_change-type-False_explicit-type-True_package-type-True.md b/tests/resources/output/split-tables-platform_hide-tables-True_change-type-False_explicit-True_package-type-True.md
similarity index 100%
rename from tests/resources/output/split-tables-platform_hide-tables-True_change-type-False_explicit-type-True_package-type-True.md
rename to tests/resources/output/split-tables-platform_hide-tables-True_change-type-False_explicit-True_package-type-True.md
diff --git a/tests/resources/output/split-tables-platform_hide-tables-True_change-type-True_explicit-type-False_package-type-False.md b/tests/resources/output/split-tables-platform_hide-tables-True_change-type-True_explicit-False_package-type-False.md
similarity index 100%
rename from tests/resources/output/split-tables-platform_hide-tables-True_change-type-True_explicit-type-False_package-type-False.md
rename to tests/resources/output/split-tables-platform_hide-tables-True_change-type-True_explicit-False_package-type-False.md
diff --git a/tests/resources/output/split-tables-platform_hide-tables-True_change-type-True_explicit-type-False_package-type-True.md b/tests/resources/output/split-tables-platform_hide-tables-True_change-type-True_explicit-False_package-type-True.md
similarity index 100%
rename from tests/resources/output/split-tables-platform_hide-tables-True_change-type-True_explicit-type-False_package-type-True.md
rename to tests/resources/output/split-tables-platform_hide-tables-True_change-type-True_explicit-False_package-type-True.md
diff --git a/tests/resources/output/split-tables-platform_hide-tables-True_change-type-True_explicit-type-True_package-type-False.md b/tests/resources/output/split-tables-platform_hide-tables-True_change-type-True_explicit-True_package-type-False.md
similarity index 100%
rename from tests/resources/output/split-tables-platform_hide-tables-True_change-type-True_explicit-type-True_package-type-False.md
rename to tests/resources/output/split-tables-platform_hide-tables-True_change-type-True_explicit-True_package-type-False.md
diff --git a/tests/resources/output/split-tables-platform_hide-tables-True_change-type-True_explicit-type-True_package-type-True.md b/tests/resources/output/split-tables-platform_hide-tables-True_change-type-True_explicit-True_package-type-True.md
similarity index 100%
rename from tests/resources/output/split-tables-platform_hide-tables-True_change-type-True_explicit-type-True_package-type-True.md
rename to tests/resources/output/split-tables-platform_hide-tables-True_change-type-True_explicit-True_package-type-True.md
diff --git a/tests/test_converter.py b/tests/test_converter.py
index 7148547..09dd002 100644
--- a/tests/test_converter.py
+++ b/tests/test_converter.py
@@ -2,34 +2,37 @@
import pytest
-from pixi_diff_to_markdown.__main__ import generate_output
-from pixi_diff_to_markdown.models import Configuration, Environments
+from pixi_diff_to_markdown.diff import generate_output
+from pixi_diff_to_markdown.models import Environments
+from pixi_diff_to_markdown.settings import Settings, SplitTables
-@pytest.mark.parametrize("enable_change_type_column", [True, False])
-@pytest.mark.parametrize("enable_package_type_column", [True, False])
-@pytest.mark.parametrize("enable_explicit_type_column", [True, False])
+@pytest.mark.parametrize("change_type_column", [True, False])
+@pytest.mark.parametrize("package_type_column", [True, False])
+@pytest.mark.parametrize("explicit_column", [True, False])
@pytest.mark.parametrize("split_tables", ["no", "environment", "platform"])
@pytest.mark.parametrize("hide_tables", [True, False])
def test_generate_table(
- enable_change_type_column,
- enable_package_type_column,
- enable_explicit_type_column,
- split_tables,
- hide_tables,
+ change_type_column: bool,
+ package_type_column: bool,
+ explicit_column: bool,
+ split_tables: SplitTables,
+ hide_tables: bool,
):
- configuration: Configuration = {
- "enable_change_type_column": enable_change_type_column,
- "enable_package_type_column": enable_package_type_column,
- "enable_explicit_type_column": enable_explicit_type_column,
- "split_tables": split_tables,
- "hide_tables": hide_tables,
- }
+ settings = Settings.model_validate(
+ {
+ "change-type-column": change_type_column,
+ "package-type-column": package_type_column,
+ "explicit-column": explicit_column,
+ "split-tables": split_tables,
+ "hide-tables": hide_tables,
+ }
+ )
with open("tests/resources/test.json") as f:
data = json.load(f)
data_parsed = Environments(data)
- actual_output = generate_output(data_parsed, configuration)
- file_name = f"tests/resources/output/split-tables-{split_tables}_hide-tables-{hide_tables}_change-type-{enable_change_type_column}_explicit-type-{enable_explicit_type_column}_package-type-{enable_package_type_column}.md"
+ actual_output = generate_output(data_parsed, settings)
+ file_name = f"tests/resources/output/split-tables-{settings.split_tables.value}_hide-tables-{settings.hide_tables}_change-type-{settings.change_type_column}_explicit-{settings.explicit_column}_package-type-{settings.package_type_column}.md"
with open(file_name) as f:
expected_output = "".join(f.readlines())
assert actual_output == expected_output