Skip to content

Commit

Permalink
Remove support for comments in JSON configuration files
Browse files Browse the repository at this point in the history
Remove dependency on unmaintained `commentjson`
Closes #1152
  • Loading branch information
kdeldycke committed Nov 30, 2024
1 parent 31e548c commit d7a9c7c
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 31 deletions.
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
> [!IMPORTANT]
> This version is not released yet and is under active development.
- Remove support for comments in JSON configuration files. Remove dependency on unmaintained `commentjson`. Closes [`click-extra#1152`](https://github.com/kdeldycke/click-extra/issues/1152).

## [4.11.6 (2024-11-28)](https://github.com/kdeldycke/click-extra/compare/v4.11.5...v4.11.6)

- Make `--timer` option eager so it can jumps the queue of processing order.
Expand Down
2 changes: 1 addition & 1 deletion click_extra/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from __future__ import annotations

import logging
import json
import os
import sys
from configparser import ConfigParser, ExtendedInterpolation
Expand All @@ -32,7 +33,6 @@
else:
import tomli as tomllib # type: ignore[import-not-found]

import commentjson as json
import requests
import xmltodict
import yaml
Expand Down
9 changes: 1 addition & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ dependencies = [
"click ~= 8.1.4",
# Cloup 3.0.5 fix incompatibility with autodoc: https://github.com/janluke/cloup/issues/177
"cloup ~= 3.0.5",
"commentjson ~= 0.9.0",
"extra-platforms ~= 1.6.0",
"mergedeep ~= 1.3.4",
"pyyaml ~= 6.0.0",
Expand Down Expand Up @@ -189,13 +188,7 @@ pretty = true

[[tool.mypy.overrides]]
ignore_missing_imports = true
module = [
"boltons.*",
"commentjson.*",
"furo",
"mergedeep.*",
"pallets_sphinx_themes.*",
]
module = ["boltons.*", "furo", "mergedeep.*", "pallets_sphinx_themes.*"]

[tool.pytest.ini_options]
# https://docs.pytest.org/en/latest/customize.html#pyproject-toml
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ To undestrand how we ended up with the result above, [go read the tutorial](http
- [Configuration file](https://kdeldycke.github.io/click-extra/config.html) loader for:
- `TOML`
- `YAML`
- `JSON`, with inline and block comments (Python-style `#` and Javascript-style `//`)
- `JSON`
- `INI`, with extended interpolation, multi-level sections and non-native types (`list`, `set`, …)
- `XML`
- Automatic inference of the configuration file structure from your CLI's options
Expand Down
4 changes: 1 addition & 3 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,14 @@
"npm",
"gem"
],
"verbosity": "DEBUG", // log level
"verbosity": "DEBUG",
# Subcommand config
"default-command": {
"int_param": 3,
"random_stuff": "will be ignored"
}
},
// Section to ignore
"garbage": {}
}
""",
Expand Down
19 changes: 1 addition & 18 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d7a9c7c

Please sign in to comment.