You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The pyproject.toml is supported by most linters/formatters/type checkers and other python utilities to be used as the configuration file. Would you consider adding support for it here too, instead of, or as an alternative to the current standalone config file?
Note that python <3.11 doesn't have any stdlib TOML parsing library, a commonly used one is tomli, which you can use as an optional dependency (extras), making support for pyproject.toml entirely optional and if people don't need it, but still providing it if it's installed, as it's pretty much the standard configuration place for python tools.
To do this, people can install the dependency like: pip install python-kacl[tomli] (you'll need to specify tomli as one of extras to the library in setup.py). Then, in the file where you're handling configuration file parsing, you can do something like:
frompathlibimportPathtry:
importtomliexceptImportError:
tomli=Nonedefget_project_config():
primary_cfg_file=Path(".kacl.yml")
ifprimary_cfg_file.exists():
returnparse_yml_config(primary_cfg_file)
secondary_cfg_file=Path("pyproject.toml")
ifsecondary_cfg_file.exists():
iftomliisnotNone:
returnparse_toml_config(secondary_cfg_file)
raiseNoConfigFound(".kacl.yml configuration file is missing, and tomli isn't installed so pyproject.toml is ignored")
raiseNoConfigFound(".kacl.yml nor pyproject.toml was found, project config missing")
The text was updated successfully, but these errors were encountered:
Hi,
I either way planned to rework the system to some degree, as the CI does not really work well anymore. I will have a look at your proposal but it sounds reasonable.
The
pyproject.toml
is supported by most linters/formatters/type checkers and other python utilities to be used as the configuration file. Would you consider adding support for it here too, instead of, or as an alternative to the current standalone config file?Note that python <3.11 doesn't have any stdlib TOML parsing library, a commonly used one is
tomli
, which you can use as an optional dependency (extras), making support forpyproject.toml
entirely optional and if people don't need it, but still providing it if it's installed, as it's pretty much the standard configuration place for python tools.To do this, people can install the dependency like:
pip install python-kacl[tomli]
(you'll need to specifytomli
as one of extras to the library insetup.py
). Then, in the file where you're handling configuration file parsing, you can do something like:The text was updated successfully, but these errors were encountered: