commented-configparser 3.0.0__tar.gz → 3.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. {commented_configparser-3.0.0 → commented_configparser-3.1.1}/.github/workflows/pypi-publish.yml +14 -13
  2. commented_configparser-3.1.1/.github/workflows/python-tests.yml +116 -0
  3. commented_configparser-3.1.1/.python-version +1 -0
  4. {commented_configparser-3.0.0 → commented_configparser-3.1.1}/CONTRIBUTING.md +40 -36
  5. {commented_configparser-3.0.0 → commented_configparser-3.1.1}/PKG-INFO +10 -27
  6. {commented_configparser-3.0.0 → commented_configparser-3.1.1}/README.md +5 -10
  7. commented_configparser-3.1.1/noxfile.py +149 -0
  8. {commented_configparser-3.0.0 → commented_configparser-3.1.1}/pyproject.toml +36 -21
  9. {commented_configparser-3.0.0 → commented_configparser-3.1.1}/src/commentedconfigparser/commentedconfigparser.py +38 -5
  10. commented_configparser-3.1.1/uv.lock +685 -0
  11. commented_configparser-3.0.0/.github/workflows/pypi-test-publish.yml +0 -62
  12. commented_configparser-3.0.0/.github/workflows/python-tests.yml +0 -119
  13. commented_configparser-3.0.0/.pre-commit-config.yaml +0 -11
  14. commented_configparser-3.0.0/noxfile.py +0 -201
  15. commented_configparser-3.0.0/requirements/constraints.txt +0 -38
  16. commented_configparser-3.0.0/requirements/requirements-dev.txt +0 -13
  17. commented_configparser-3.0.0/requirements/requirements-test.txt +0 -5
  18. commented_configparser-3.0.0/requirements/requirements.txt +0 -1
  19. commented_configparser-3.0.0/setup.cfg +0 -4
  20. commented_configparser-3.0.0/src/commented_configparser.egg-info/PKG-INFO +0 -144
  21. commented_configparser-3.0.0/src/commented_configparser.egg-info/SOURCES.txt +0 -35
  22. commented_configparser-3.0.0/src/commented_configparser.egg-info/dependency_links.txt +0 -1
  23. commented_configparser-3.0.0/src/commented_configparser.egg-info/requires.txt +0 -13
  24. commented_configparser-3.0.0/src/commented_configparser.egg-info/top_level.txt +0 -1
  25. {commented_configparser-3.0.0 → commented_configparser-3.1.1}/.flake8 +0 -0
  26. {commented_configparser-3.0.0 → commented_configparser-3.1.1}/.gitignore +0 -0
  27. {commented_configparser-3.0.0 → commented_configparser-3.1.1}/LICENSE +0 -0
  28. {commented_configparser-3.0.0 → commented_configparser-3.1.1}/src/commentedconfigparser/__init__.py +0 -0
  29. {commented_configparser-3.0.0 → commented_configparser-3.1.1}/src/commentedconfigparser/py.typed +0 -0
  30. {commented_configparser-3.0.0 → commented_configparser-3.1.1}/tests/commentedconfigparser_test.py +0 -0
  31. {commented_configparser-3.0.0 → commented_configparser-3.1.1}/tests/empty_comments_expected.ini +0 -0
  32. {commented_configparser-3.0.0 → commented_configparser-3.1.1}/tests/empty_comments_input.ini +0 -0
  33. {commented_configparser-3.0.0 → commented_configparser-3.1.1}/tests/header_expected.ini +0 -0
  34. {commented_configparser-3.0.0 → commented_configparser-3.1.1}/tests/header_input.ini +0 -0
  35. {commented_configparser-3.0.0 → commented_configparser-3.1.1}/tests/multi01_input.ini +0 -0
  36. {commented_configparser-3.0.0 → commented_configparser-3.1.1}/tests/multi02_input.ini +0 -0
  37. {commented_configparser-3.0.0 → commented_configparser-3.1.1}/tests/multi_expected.ini +0 -0
  38. {commented_configparser-3.0.0 → commented_configparser-3.1.1}/tests/pydocs_expected.ini +0 -0
  39. {commented_configparser-3.0.0 → commented_configparser-3.1.1}/tests/pydocs_input.ini +0 -0
  40. {commented_configparser-3.0.0 → commented_configparser-3.1.1}/tests/regression_original_expected.ini +0 -0
  41. {commented_configparser-3.0.0 → commented_configparser-3.1.1}/tests/regression_original_input.ini +0 -0
@@ -1,10 +1,10 @@
1
1
  name: "Publish Python distribution to PyPI"
2
2
  # Uses:
3
- # https://github.com/actions/setup-python : a26af69be951a213d495a4c3e4e4022e16d87065
4
- # https://github.com/actions/checkout : 11bd71901bbe5b1630ceea73d27597364c9af683
5
- # https://github.com/actions/download-artifact : d3f86a106a0bac45b974a628896c90dbdf5c8093
6
- # https://github.com/actions/upload-artifact : ea165f8d65b6e75b540449e92b4886f43607fa02
7
- # https://github.com/actions/pypa/gh-action-pypi-publish : 76f52bc884231f62b9a034ebfe128415bbaabdfc
3
+ # https://github.com/actions/checkout : v7.0.1 de0fac2e4500dabe0009e67214ff5f5447ce83dd
4
+ # https://github.com/actions/download-artifact : v8.0.2 9000827ccba6bdab643e8b6fd33ac0654aef8333
5
+ # https://github.com/actions/upload-artifact : v7.0.2 cf430e030ddbb5b0abf93d22962f4752f3646cd9
6
+ # https://github.com/astral-sh/setup-uv : v10.3.2 07a047e608db84b3d8c06cd9a7c7dcc9c355c18e
7
+ # https://github.com/pypa/gh-action-pypi-publish : v1.14.3 7245906fb61fa33a13554f9d5fb856fe61758086
8
8
 
9
9
  on:
10
10
  release:
@@ -18,21 +18,22 @@ jobs:
18
18
  artifact-id: "${{ steps.upload-artifact.outputs.artifact-id }}"
19
19
 
20
20
  steps:
21
- - uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"
21
+ - uses: "actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd"
22
22
  with:
23
23
  persist-credentials: false
24
24
 
25
- - name: "Set up Python"
26
- uses: "actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065"
25
+ - name: "Install the latest version of uv"
26
+ uses: "astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e"
27
27
  with:
28
- python-version: "3.12"
28
+ version: "latest"
29
+ enable-cache: true
29
30
 
30
31
  - name: "Build the package"
31
- run: "python -m pip install nox; nox -s build"
32
+ run: "uvx nox --session build"
32
33
 
33
34
  - name: "Store the distribution packages"
34
35
  id: "upload-artifact"
35
- uses: "actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02"
36
+ uses: "actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9"
36
37
  with:
37
38
  path: "./dist"
38
39
 
@@ -48,14 +49,14 @@ jobs:
48
49
 
49
50
  steps:
50
51
  - name: "Download all the dists"
51
- uses: "actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093"
52
+ uses: "actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 "
52
53
  with:
53
54
  artifact-ids: "${{ needs.build.outputs.artifact-id }}"
54
55
  path: "./dist"
55
56
  merge-multiple: true
56
57
 
57
58
  - name: "Publish distribution to PyPI"
58
- uses: "pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc"
59
+ uses: "pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086"
59
60
  with:
60
61
  repository-url: "https://upload.pypi.org/legacy/"
61
62
  verbose: true
@@ -0,0 +1,116 @@
1
+ name: "python tests and coverage"
2
+ # Uses:
3
+ # https://github.com/actions/checkout : v7.0.1 de0fac2e4500dabe0009e67214ff5f5447ce83dd
4
+ # https://github.com/actions/download-artifact : v8.0.2 9000827ccba6bdab643e8b6fd33ac0654aef8333
5
+ # https://github.com/actions/upload-artifact : v7.0.2 cf430e030ddbb5b0abf93d22962f4752f3646cd9
6
+ # https://github.com/astral-sh/setup-uv : v10.3.2 07a047e608db84b3d8c06cd9a7c7dcc9c355c18e
7
+
8
+
9
+ on:
10
+ pull_request:
11
+ push:
12
+ branches:
13
+ - "main"
14
+
15
+ jobs:
16
+ set-statics:
17
+ name: "Set static values"
18
+ runs-on: "ubuntu-slim"
19
+ outputs:
20
+ linux-version: "ubuntu-26.04"
21
+ uv-version: "0.13.4"
22
+
23
+ steps:
24
+ - name: "Set Statics"
25
+ run: echo ""
26
+
27
+ run-tests-and-coverage:
28
+ name: "Run nox for tests and coverage"
29
+ needs: "set-statics"
30
+ runs-on: "${{ matrix.os }}"
31
+ strategy:
32
+ fail-fast: false
33
+ matrix:
34
+ os:
35
+ - "${{ needs.set-statics.outputs.linux-version }}"
36
+ - "windows-latest"
37
+ python-version:
38
+ - "3.11"
39
+ - "3.12"
40
+ - "3.13"
41
+ - "3.14"
42
+ - "3.15"
43
+
44
+ steps:
45
+ - name: "Repo checkout"
46
+ uses: "actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd"
47
+
48
+ - name: "Install the latest version of uv"
49
+ uses: "astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e"
50
+ with:
51
+ version: "${{ needs.set-statics.outputs.uv-version }}"
52
+ python-version: "${{ matrix.python-version }}"
53
+ enable-cache: true
54
+
55
+ - name: "Run tests and coverage via nox"
56
+ run: "uvx nox --session test -- partial-coverage"
57
+
58
+ - name: "Save coverage artifact"
59
+ uses: "actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9"
60
+ with:
61
+ name: "coverage-artifact-${{ matrix.os}}-${{ matrix.python-version}}"
62
+ path: ".coverage.*"
63
+ retention-days: 1
64
+ include-hidden-files: true
65
+
66
+ coverage-compile:
67
+ name: "coverage compile"
68
+ needs: ["set-statics", "run-tests-and-coverage"]
69
+ runs-on: "${{ needs.set-statics.outputs.linux-version }}"
70
+ steps:
71
+ - name: "Repo checkout"
72
+ uses: "actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd"
73
+
74
+ - name: "Install the latest version of uv"
75
+ uses: "astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e"
76
+ with:
77
+ version: "${{ needs.set-statics.outputs.uv-version }}"
78
+ enable-cache: true
79
+
80
+ - name: "Download coverage artifacts"
81
+ uses: "actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333"
82
+ with:
83
+ pattern: "coverage-artifact-*"
84
+ merge-multiple: true
85
+
86
+ - name: "Compile coverage data"
87
+ run: "uvx nox --session combine"
88
+
89
+ - name: "Post summary to step summary"
90
+ run: |
91
+ export TOTAL=$(python -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])")
92
+ echo "COVERAGE-TOTAL=$TOTAL" >> $GITHUB_ENV
93
+
94
+ linters-and-formatters:
95
+ name: "linters and formatters"
96
+ needs: "set-statics"
97
+ runs-on: "${{ needs.set-statics.outputs.linux-version }}"
98
+ steps:
99
+ - name: "Repo checkout"
100
+ uses: "actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd"
101
+
102
+ - name: "Install the latest version of uv"
103
+ uses: "astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e"
104
+ with:
105
+ version: "${{ needs.set-statics.outputs.uv-version }}"
106
+ enable-cache: true
107
+
108
+ - name: "Run linters and formatters"
109
+ run: "uvx nox --session format lint"
110
+
111
+ - name: "Check for any unstaged changes"
112
+ run: |
113
+ if [ -n "$(git status --porcelain)" ]; then
114
+ echo "#### Format or Lint changes found. Please run 'uvx nox' locally and push the changes." >> $GITHUB_STEP_SUMMARY
115
+ exit 1
116
+ fi
@@ -0,0 +1 @@
1
+ 3.11
@@ -42,70 +42,74 @@ The following steps outline how to install this repo for local development.
42
42
 
43
43
  ## Prerequisites
44
44
 
45
- ### Clone repo
45
+ ### [Install uv](https://docs.astral.sh/uv/getting-started/installation/)
46
46
 
47
- ```bash
48
- git clone https://github.com/Preocts/commented-configparser
47
+ uv is required to use the provided noxfile sessions for developer setup,
48
+ linting, and tests. Using nox is completely optional, all sessions can be
49
+ manually recreated. These instructions will not cover those cases.
49
50
 
50
- cd commented-configparser
51
+ ## Nox Sessions
52
+
53
+ ### Developer Install
54
+
55
+ ```console
56
+ uvx nox -s dev
51
57
  ```
52
58
 
53
- ### [Install nox](https://nox.thea.codes/en/stable/index.html)
59
+ ### Validate uv.lock
54
60
 
55
- It is recommended to use a tool such as `pipx` or `uvx` to install nox. nox is
56
- needed to run the provided sessions for developer setup, linting, tests, and
57
- dependency management. It is optional, but these instructions will not cover
58
- manually steps outside of nox.
61
+ ```console
62
+ uvx nox -s lock
63
+ ```
59
64
 
65
+ ### Run tests and display coverage
60
66
 
61
- ## Nox Sessions
67
+ ```console
68
+ uvx nox -s test
69
+ ```
62
70
 
63
- ### Developer Install
71
+ Passing extra arguements to pytest:
72
+
73
+ ```console
74
+ uvx nox -s test -- -vvv -x --full-trace
75
+ ```
64
76
 
65
- This builds the `/.venv`, installs the editable
66
- package, and installs all dependency files.
77
+ ### Run linters
67
78
 
68
- ```bash
69
- nox -s dev
79
+ ```console
80
+ uvx nox -s lint
70
81
  ```
71
82
 
72
- ### Run tests with coverage
83
+ ### Run formatters
73
84
 
74
- ```bash
75
- nox -s test
85
+ ```console
86
+ uvx nox -s format
76
87
  ```
77
88
 
78
- ### Run formatters and linters
89
+ ### Run all checks
79
90
 
80
- ```bash
81
- nox -s lint
91
+ ```console
92
+ uvx nox
82
93
  ```
83
94
 
84
95
  ### Build dist
85
96
 
86
- ```bash
87
- nox -s build
97
+ ```console
98
+ uvx nox -s build
88
99
  ```
89
100
 
90
101
  ---
91
102
 
92
103
  ## Updating dependencies
93
104
 
94
- New dependencys can be added to the `requirements-*.txt` file. It is recommended
95
- to only use pins when specific versions or upgrades beyond a certain version are
96
- to be avoided. Otherwise, allow `pip-compile` to manage the pins in the
97
- generated `constraints.txt` file.
98
-
99
- Once updated following the steps below, the package can be installed if needed.
105
+ Use the `uv` cli to add, update, and remove dependencies from the project.
100
106
 
101
- ### Update the generated files with changes
107
+ ```console
108
+ uv add [package name]
102
109
 
103
- ```bash
104
- nox -s update-deps
105
- ```
110
+ uv remove [package name]
106
111
 
107
- ### Upgrade all generated dependencies
112
+ uv lock --upgrade
108
113
 
109
- ```bash
110
- nox -s upgrade-deps
114
+ uv lock --upgrade-package [package name]
111
115
  ```
@@ -1,42 +1,25 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: commented-configparser
3
- Version: 3.0.0
3
+ Version: 3.1.1
4
4
  Summary: A custom ConfigParser class that preserves comments and most formatting when writing loaded config out.
5
+ Project-URL: homepage, https://github.com/Preocts/commented-configparser
5
6
  Author-email: Preocts <preocts@preocts.com>
6
7
  License-Expression: MIT
7
- Project-URL: homepage, https://github.com/Preocts/commented-configparser
8
+ License-File: LICENSE
8
9
  Classifier: Programming Language :: Python :: 3
9
10
  Classifier: Programming Language :: Python :: 3 :: Only
10
11
  Classifier: Programming Language :: Python :: Implementation :: CPython
11
- Requires-Python: >=3.9
12
+ Requires-Python: >=3.11
12
13
  Description-Content-Type: text/markdown
13
- License-File: LICENSE
14
- Provides-Extra: dev
15
- Requires-Dist: flake8; extra == "dev"
16
- Requires-Dist: flake8-builtins; extra == "dev"
17
- Requires-Dist: flake8-pep585; extra == "dev"
18
- Requires-Dist: black; extra == "dev"
19
- Requires-Dist: isort; extra == "dev"
20
- Requires-Dist: mypy; extra == "dev"
21
- Provides-Extra: test
22
- Requires-Dist: pytest; extra == "test"
23
- Requires-Dist: pytest-randomly; extra == "test"
24
- Requires-Dist: coverage; extra == "test"
25
- Dynamic: license-file
26
-
27
- [![Python 3.9 | 3.10 | 3.11 | 3.12 | 3.13 | 3.14](https://img.shields.io/badge/Python-3.9%20%7C%203.10%20%7C%203.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-blue)](https://www.python.org/downloads)
28
- [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
29
- [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
30
14
 
31
- [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/Preocts/commented-configparser/main.svg)](https://results.pre-commit.ci/latest/github/Preocts/commented-configparser/main)
15
+ [![Python >=3.11](https://img.shields.io/badge/Python->=3.11-blue)](https://www.python.org/downloads)
16
+ [![PyPI - Version](https://img.shields.io/pypi/v/commented-configparser)](https://pypi.org/project/commented-configparser)
32
17
  [![Python tests](https://github.com/Preocts/commented-configparser/actions/workflows/python-tests.yml/badge.svg?branch=main)](https://github.com/Preocts/commented-configparser/actions/workflows/python-tests.yml)
33
18
 
34
- # commented-configparser
35
-
36
- - [Contributing Guide and Developer Setup Guide](./CONTRIBUTING.md)
37
- - [License: MIT](./LICENSE)
19
+ [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
20
+ [![Nox](https://img.shields.io/badge/%F0%9F%A6%8A-Nox-D85E00.svg)](https://github.com/wntrblm/nox)
38
21
 
39
- ---
22
+ # commented-configparser
40
23
 
41
24
  A custom ConfigParser class that preserves comments and most formatting when
42
25
  writing loaded config out.
@@ -1,16 +1,11 @@
1
- [![Python 3.9 | 3.10 | 3.11 | 3.12 | 3.13 | 3.14](https://img.shields.io/badge/Python-3.9%20%7C%203.10%20%7C%203.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-blue)](https://www.python.org/downloads)
2
- [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
3
- [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
4
-
5
- [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/Preocts/commented-configparser/main.svg)](https://results.pre-commit.ci/latest/github/Preocts/commented-configparser/main)
1
+ [![Python >=3.11](https://img.shields.io/badge/Python->=3.11-blue)](https://www.python.org/downloads)
2
+ [![PyPI - Version](https://img.shields.io/pypi/v/commented-configparser)](https://pypi.org/project/commented-configparser)
6
3
  [![Python tests](https://github.com/Preocts/commented-configparser/actions/workflows/python-tests.yml/badge.svg?branch=main)](https://github.com/Preocts/commented-configparser/actions/workflows/python-tests.yml)
7
4
 
8
- # commented-configparser
9
-
10
- - [Contributing Guide and Developer Setup Guide](./CONTRIBUTING.md)
11
- - [License: MIT](./LICENSE)
5
+ [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
6
+ [![Nox](https://img.shields.io/badge/%F0%9F%A6%8A-Nox-D85E00.svg)](https://github.com/wntrblm/nox)
12
7
 
13
- ---
8
+ # commented-configparser
14
9
 
15
10
  A custom ConfigParser class that preserves comments and most formatting when
16
11
  writing loaded config out.
@@ -0,0 +1,149 @@
1
+ from __future__ import annotations
2
+
3
+ import os
4
+ import functools
5
+ import pathlib
6
+ import shutil
7
+
8
+ import nox
9
+
10
+ # Control factors for finding pieces of the module
11
+ MODULE_NAME = "commentedconfigparser"
12
+ LINT_PATH = "./src"
13
+ TESTS_PATH = "./tests"
14
+
15
+ _file_python_version = pathlib.Path(".python-version").read_text()
16
+ _uv_python_version = os.getenv("UV_PYTHON", "")
17
+ # Favor the UV_PYTHON environment variable as this should override the .python-version
18
+ PYTHON_VERSION = _uv_python_version or _file_python_version
19
+
20
+ # What we allowed to clean (delete)
21
+ CLEANABLE_TARGETS = [
22
+ "./dist",
23
+ "./build",
24
+ "./.nox",
25
+ "./.coverage",
26
+ "./.coverage.*",
27
+ "./coverage.json",
28
+ "./htmlcov",
29
+ "./**/.mypy_cache",
30
+ "./**/.pytest_cache",
31
+ "./**/__pycache__",
32
+ "./**/*.pyc",
33
+ "./**/*.pyo",
34
+ ]
35
+
36
+ # Define the default sessions run when `nox` is called on the CLI
37
+ nox.options.default_venv_backend = "uv"
38
+ nox.options.sessions = ["lock", "format", "lint", "test"]
39
+
40
+ # All linters and formatters are run with `uv run --active`
41
+ LINTERS: list[tuple[str, ...]] = [
42
+ ("flake8", "--show-source", LINT_PATH, TESTS_PATH),
43
+ ("mypy", "--pretty", "--package", MODULE_NAME),
44
+ ("mypy", "--pretty", TESTS_PATH),
45
+ ]
46
+ FORMATTERS: list[tuple[str, ...]] = [
47
+ (
48
+ "isort",
49
+ "--force-single-line-imports",
50
+ "--profile",
51
+ "black",
52
+ "--add-import",
53
+ "from __future__ import annotations",
54
+ LINT_PATH,
55
+ TESTS_PATH,
56
+ ),
57
+ ("black", LINT_PATH, TESTS_PATH),
58
+ ]
59
+
60
+ # Default args for all 'uv sync' and 'uv run' calls
61
+ UV_ARGS = [
62
+ "--frozen",
63
+ "--quiet",
64
+ "--active",
65
+ ]
66
+
67
+
68
+ @nox.session(name="dev", python=False)
69
+ def create_dev_environment(session: nox.Session) -> None:
70
+ """Create a development environment."""
71
+ session.run_install("uv", "sync", "--frozen")
72
+
73
+
74
+ @nox.session(name="test", python=PYTHON_VERSION)
75
+ def run_tests_with_coverage(session: nox.Session) -> None:
76
+ """Run pytest in isolated environment, display coverage. Extra arguements passed to pytest."""
77
+ partial = "partial-coverage" in session.posargs
78
+
79
+ session.run_install("uv", "sync", *UV_ARGS)
80
+
81
+ coverage = functools.partial(session.run, "uv", "run", *UV_ARGS, "coverage")
82
+
83
+ coverage("erase")
84
+
85
+ if partial:
86
+ session.posargs.remove("partial-coverage")
87
+ coverage("run", "--parallel-mode", "--module", "pytest", *session.posargs)
88
+ else:
89
+ coverage("run", "--module", "pytest", *session.posargs)
90
+ coverage("report", "--show-missing")
91
+ coverage("html")
92
+
93
+
94
+ @nox.session(name="combine", python=PYTHON_VERSION)
95
+ def combine_coverage(session: nox.Session) -> None:
96
+ """Combine parallel-mode coverage files and produce reports."""
97
+ session.run_install("uv", "sync", *UV_ARGS)
98
+
99
+ coverage = functools.partial(session.run, "uv", "run", *UV_ARGS, "coverage")
100
+
101
+ coverage("combine")
102
+ coverage("report", "--show-missing")
103
+ coverage("html")
104
+ coverage("json")
105
+
106
+
107
+ @nox.session(name="lint", python=PYTHON_VERSION)
108
+ def run_linters(session: nox.Session) -> None:
109
+ """Run code linters, and type checking against all files."""
110
+ session.run_install("uv", "sync", "--group", "lint", *UV_ARGS)
111
+
112
+ for linter_args in LINTERS:
113
+ session.run("uv", "run", *UV_ARGS, *linter_args)
114
+
115
+
116
+ @nox.session(name="format", python=PYTHON_VERSION)
117
+ def run_formatters(session: nox.Session) -> None:
118
+ """Run code formatters against all files."""
119
+ session.run_install("uv", "sync", "--group", "format", *UV_ARGS)
120
+
121
+ for formatter_args in FORMATTERS:
122
+ session.run("uv", "run", *UV_ARGS, *formatter_args)
123
+
124
+
125
+ @nox.session(name="build", python=False)
126
+ def build_artifacts(session: nox.Session) -> None:
127
+ """Build a sdist and wheel."""
128
+ session.run("uv", "build")
129
+
130
+
131
+ @nox.session(name="lock", python=False)
132
+ def validate_lock_file(session: nox.Session) -> None:
133
+ """Ensure the uv.lock file exists and is aligned with dependencies."""
134
+ session.run("uv", "lock", "--check")
135
+
136
+
137
+ @nox.session(name="clean", python=False)
138
+ def clean_project_files(session: nox.Session) -> None:
139
+ """Clean cache, .pyc, .pyo, and build artifact files from project."""
140
+ count = 0
141
+ for searchpath in CLEANABLE_TARGETS:
142
+ for filepath in pathlib.Path(".").glob(searchpath):
143
+ if filepath.is_dir():
144
+ shutil.rmtree(filepath)
145
+ else:
146
+ filepath.unlink()
147
+ count += 1
148
+
149
+ session.log(f"{count} files cleaned.")
@@ -1,39 +1,54 @@
1
1
  [build-system]
2
- requires = [ "setuptools", "setuptools_scm" ]
3
- build-backend = "setuptools.build_meta"
2
+ requires = ["hatchling", "hatch-vcs"]
3
+ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "commented-configparser"
7
- requires-python = ">=3.9"
7
+ requires-python = ">=3.11"
8
8
  description = "A custom ConfigParser class that preserves comments and most formatting when writing loaded config out."
9
9
  readme = "README.md"
10
10
  license = "MIT"
11
11
  authors = [
12
- { email = "preocts@preocts.com", name = "Preocts" }
12
+ { email = "preocts@preocts.com", name = "Preocts" },
13
13
  ]
14
14
  maintainers = []
15
15
  keywords = []
16
16
  classifiers = [
17
17
  "Programming Language :: Python :: 3",
18
18
  "Programming Language :: Python :: 3 :: Only",
19
- "Programming Language :: Python :: Implementation :: CPython"
19
+ "Programming Language :: Python :: Implementation :: CPython",
20
20
  ]
21
- dynamic = [ "dependencies", "optional-dependencies", "version" ]
21
+ dynamic = ["version"]
22
22
 
23
- [tool.setuptools_scm]
23
+ dependencies = []
24
24
 
25
- [tool.setuptools.dynamic.dependencies]
26
- file = [ "requirements/requirements.txt" ]
27
-
28
- [tool.setuptools.dynamic.optional-dependencies]
29
- dev = { file = [ "requirements/requirements-dev.txt" ] }
30
- test = { file = [ "requirements/requirements-test.txt" ] }
25
+ [dependency-groups]
26
+ format = [
27
+ "black",
28
+ "isort",
29
+ ]
30
+ lint = [
31
+ "flake8",
32
+ "flake8-pep585",
33
+ "mypy",
34
+ ]
35
+ dev = [
36
+ "pytest",
37
+ "pytest-randomly",
38
+ "coverage",
39
+ ]
31
40
 
32
41
  [project.urls]
33
42
  homepage = "https://github.com/Preocts/commented-configparser"
34
43
 
35
- [tool.setuptools.package-data]
36
- "commentedconfigparser" = [ "py.typed" ]
44
+ [tool.hatch.build.targets.wheel]
45
+ packages = ["src/commentedconfigparser"]
46
+
47
+ [tool.hatch.version]
48
+ source = "vcs"
49
+
50
+ [tool.uv]
51
+ exclude-newer = "P7D"
37
52
 
38
53
  [tool.mypy]
39
54
  check_untyped_defs = true
@@ -48,21 +63,21 @@ warn_unused_ignores = true
48
63
  module = "tests.*"
49
64
  disallow_incomplete_defs = false
50
65
  disallow_untyped_defs = false
66
+ warn_unused_ignores = false
51
67
 
52
68
  [tool.coverage.run]
53
69
  branch = true
54
- source = [ "tests" ]
55
- source_pkgs = [ "commentedconfigparser" ]
70
+ source = ["src", "tests"]
56
71
 
57
72
  [tool.coverage.paths]
58
- source = [ "src/", "*/site-packages" ]
59
- test = [ "tests/", "*/tests" ]
73
+ source = ["src/", "*/site-packages", "*/src"]
74
+ test = ["tests/", "*/tests"]
60
75
 
61
76
  [tool.coverage.report]
62
- exclude_lines =[
77
+ exclude_lines = [
63
78
  "pragma: no cover",
64
79
  "raise NotImplementedError",
65
80
  "if __name__ == .__main__.:",
66
- "if TYPE_CHECKING:",
67
81
  "\\.\\.\\.",
82
+ "if TYPE_CHECKING:",
68
83
  ]