Title: Pre-commit check fails when dependency group includes are used in `pyproject.toml` · Issue #1500 · commitizen-tools/commitizen · GitHub
Open Graph Title: Pre-commit check fails when dependency group includes are used in `pyproject.toml` · Issue #1500 · commitizen-tools/commitizen
X Title: Pre-commit check fails when dependency group includes are used in `pyproject.toml` · Issue #1500 · commitizen-tools/commitizen
Description: Description When committing a pyproject.toml file that uses dependency group includes and the commitizen pre-commit hook, a tomlkit.exceptions.MixedArrayTypesError is raised, failing the check and preventing the commit. This happens when...
Open Graph Description: Description When committing a pyproject.toml file that uses dependency group includes and the commitizen pre-commit hook, a tomlkit.exceptions.MixedArrayTypesError is raised, failing the check and ...
X Description: Description When committing a pyproject.toml file that uses dependency group includes and the commitizen pre-commit hook, a tomlkit.exceptions.MixedArrayTypesError is raised, failing the check and ...
Opengraph URL: https://github.com/commitizen-tools/commitizen/issues/1500
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Pre-commit check fails when dependency group includes are used in `pyproject.toml`","articleBody":"### Description\n\nWhen committing a `pyproject.toml` file that uses [dependency group includes](https://packaging.python.org/en/latest/specifications/dependency-groups/#dependency-group-include) and the commitizen pre-commit hook, a `tomlkit.exceptions.MixedArrayTypesError` is raised, failing the check and preventing the commit.\n\nThis happens when using `uv` as dependency manager, I don't know about others.\n\n### Steps to reproduce\n\n1. Create a blank project with `uv init cz-dgi` and enter with `cd cz-dgi`\n2. Add the following `pyproject.toml`:\n ```toml\n [project]\n name = \"czdgi\"\n version = \"0.1.0\"\n description = \"Add your description here\"\n readme = \"README.md\"\n requires-python = \"\u003e=3.12\"\n dependencies = [\n \"commitizen\u003e=4.8.2\",\n \"pre-commit\u003e=4.2.0\",\n ]\n \n [dependency-groups]\n nums = [\n \"pandas\u003e=2.2.3\",\n ]\n test = [\n {include-group = \"nums\"},\n \"pytest\u003e=8.4.0\",\n ]\n ```\n3. Create a `.pre-commit-config.yaml` with the following content:\n ```yaml default_install_hook_types:\n - pre-commit\n - commit-msg\n repos:\n - repo: https://github.com/commitizen-tools/commitizen\n rev: v1.17.0\n hooks:\n - id: commitizen\n stages: [ commit-msg ]\n ```\n4. Run `uv run pre-commit install --install-hooks` to install hooks\n5. Try to commit\n\n### Current behavior\n\nThe commit check fails with error:\n```\ncommitizen check.........................................................Failed\n- hook id: commitizen\n- exit code: 1\n\nTraceback (most recent call last):\n File \"/home/kinami/.cache/pre-commit/repoo6u1swju/py_env-python3/bin/cz\", line 8, in \u003cmodule\u003e\n sys.exit(main())\n ^^^^^^\n File \"/home/kinami/.cache/pre-commit/repoo6u1swju/py_env-python3/lib/python3.12/site-packages/commitizen/cli.py\", line 179, in main\n conf = config.read_cfg()\n ^^^^^^^^^^^^^^^^^\n File \"/home/kinami/.cache/pre-commit/repoo6u1swju/py_env-python3/lib/python3.12/site-packages/commitizen/config/__init__.py\", line 60, in read_cfg\n _conf = TomlConfig(data=data, path=filename)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/kinami/.cache/pre-commit/repoo6u1swju/py_env-python3/lib/python3.12/site-packages/commitizen/config/toml_config.py\", line 10, in __init__\n self._parse_setting(data)\n File \"/home/kinami/.cache/pre-commit/repoo6u1swju/py_env-python3/lib/python3.12/site-packages/commitizen/config/toml_config.py\", line 39, in _parse_setting\n doc = parse(data)\n ^^^^^^^^^^^\n File \"/home/kinami/.cache/pre-commit/repoo6u1swju/py_env-python3/lib/python3.12/site-packages/tomlkit/api.py\", line 51, in parse\n return Parser(string).parse()\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/kinami/.cache/pre-commit/repoo6u1swju/py_env-python3/lib/python3.12/site-packages/tomlkit/parser.py\", line 153, in parse\n key, value = self._parse_table()\n ^^^^^^^^^^^^^^^^^^^\n File \"/home/kinami/.cache/pre-commit/repoo6u1swju/py_env-python3/lib/python3.12/site-packages/tomlkit/parser.py\", line 1056, in _parse_table\n item = self._parse_item()\n ^^^^^^^^^^^^^^^^^^\n File \"/home/kinami/.cache/pre-commit/repoo6u1swju/py_env-python3/lib/python3.12/site-packages/tomlkit/parser.py\", line 302, in _parse_item\n return self._parse_key_value(True)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/kinami/.cache/pre-commit/repoo6u1swju/py_env-python3/lib/python3.12/site-packages/tomlkit/parser.py\", line 387, in _parse_key_value\n val = self._parse_value()\n ^^^^^^^^^^^^^^^^^^^\n File \"/home/kinami/.cache/pre-commit/repoo6u1swju/py_env-python3/lib/python3.12/site-packages/tomlkit/parser.py\", line 524, in _parse_value\n return self._parse_array()\n ^^^^^^^^^^^^^^^^^^^\n File \"/home/kinami/.cache/pre-commit/repoo6u1swju/py_env-python3/lib/python3.12/site-packages/tomlkit/parser.py\", line 680, in _parse_array\n raise self.parse_error(MixedArrayTypesError)\ntomlkit.exceptions.MixedArrayTypesError: Mixed types found in array at line 19 col 1\n```\n\n\n### Desired behavior\n\nThe `pyproject.toml` gets parsed correctly and no errors appear.\n\n### Screenshots\n\n_No response_\n\n### Environment\n\nCommitizen Version: 4.8.2\nPython Version: 3.12.10 (main, May 17 2025, 13:50:06) [Clang 20.1.4 ]\nOperating System: Linux","author":{"url":"https://github.com/kiinami","@type":"Person","name":"kiinami"},"datePublished":"2025-06-03T15:49:21.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/1500/commitizen/issues/1500"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:f66a578b-3c15-57d0-967f-c02c5b486f18 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CC00:35FB06:EF7A63:1498433:6A4DD542 |
| html-safe-nonce | b12680b5f315c181f50ada465db04c32bec2070c7a46ea856d6d02a370a2ffd0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQzAwOjM1RkIwNjpFRjdBNjM6MTQ5ODQzMzo2QTRERDU0MiIsInZpc2l0b3JfaWQiOiIzNjc2ODIyMDQxMDM2NDQ0OTk0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 9a1e378fe156d6580ca5136ea53f115f7a8447ca220d1502060671bd367194d2 |
| hovercard-subject-tag | issue:3114528582 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/commitizen-tools/commitizen/1500/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0ab627fd53339eb32cbf36c87cd03d27a998fef48692495361126461f3fa15df/commitizen-tools/commitizen/issues/1500 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0ab627fd53339eb32cbf36c87cd03d27a998fef48692495361126461f3fa15df/commitizen-tools/commitizen/issues/1500 |
| og:image:alt | Description When committing a pyproject.toml file that uses dependency group includes and the commitizen pre-commit hook, a tomlkit.exceptions.MixedArrayTypesError is raised, failing the check and ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | kiinami |
| hostname | github.com |
| expected-hostname | github.com |
| None | 06b8a6144231bf3a234f1c2e9993861e07ce98a905912b114aa386c2d7e84b33 |
| turbo-cache-control | no-preview |
| go-import | github.com/commitizen-tools/commitizen git https://github.com/commitizen-tools/commitizen.git |
| octolytics-dimension-user_id | 62252524 |
| octolytics-dimension-user_login | commitizen-tools |
| octolytics-dimension-repository_id | 106127589 |
| octolytics-dimension-repository_nwo | commitizen-tools/commitizen |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 106127589 |
| octolytics-dimension-repository_network_root_nwo | commitizen-tools/commitizen |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 1d344bdb7547fe6bca17a59bb2b8aac3dc9532a0 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width