entangled / entangled.py

Python port of Entangled
Apache License 2.0
33 stars 7 forks source link

Faulty documentation on reading configuration from `pyproject.toml` #51

Closed FynnFreyer closed 1 month ago

FynnFreyer commented 1 month ago

Docs give the following example for pyproject.toml content:

[[tools.entangled]]
version = "2.0"
watch_list = ["docs/**/*.md"]

This doesn't work, because the double brackets turn the entangled config from a table into a list. They are however needed when configuring languages with [[tool.entangled.languages]].

Reproduce/Verify

For testing, put the following snippets in a pyproject.toml file and tangle something.

Fails

These don't work for me:

Config is a list, not a dict.

[[tool.entangled]]
version = '2.0'

[[tool.entangled.languages]]
name = 'SomeLang'
identifiers = ['some']
comment = { open = '//' }

Expected <class 'entangled.config.Config'>, got: [{'version': '2.0', 'watch_list': ['lit/*/.md'], 'ignore_list': ['**/README.md'], 'languages': [{'name': 'SomeLang', 'identifiers': ['some'], 'comment': {'open': '//'}}]}]

Languages is a dict, not a list.

[tool.entangled]
version = '2.0'

[tool.entangled.languages]
name = 'SomeLang'
identifiers = ['some']
comment = { open = '//' }

Expected list[entangled.config.language.Language], got: {'name': 'SomeLang', 'identifiers': ['some'], 'comment': {'open': '//'}}

Works

Config is a dict, languages is a list.

[tool.entangled]
version = '2.0'

[[tool.entangled.languages]]
name = 'SomeLang'
identifiers = ['some']
comment = { open = '//' }
FynnFreyer commented 1 month ago

just sent a PR #52 thanks for this project btw, it's pretty cool