commented-configparser 2.1.0__tar.gz → 3.0.0__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.
- commented_configparser-3.0.0/.github/workflows/pypi-publish.yml +61 -0
- commented_configparser-3.0.0/.github/workflows/pypi-test-publish.yml +62 -0
- commented_configparser-3.0.0/.github/workflows/python-tests.yml +119 -0
- {commented_configparser-2.1.0 → commented_configparser-3.0.0}/.gitignore +1 -1
- commented_configparser-3.0.0/.pre-commit-config.yaml +11 -0
- commented_configparser-3.0.0/CONTRIBUTING.md +111 -0
- {commented_configparser-2.1.0/src/commented_configparser.egg-info → commented_configparser-3.0.0}/PKG-INFO +29 -40
- {commented_configparser-2.1.0 → commented_configparser-3.0.0}/README.md +20 -9
- commented_configparser-3.0.0/noxfile.py +201 -0
- {commented_configparser-2.1.0 → commented_configparser-3.0.0}/pyproject.toml +13 -24
- commented_configparser-3.0.0/requirements/constraints.txt +38 -0
- {commented_configparser-2.1.0 → commented_configparser-3.0.0}/requirements/requirements-dev.txt +8 -3
- {commented_configparser-2.1.0 → commented_configparser-3.0.0}/requirements/requirements-test.txt +0 -1
- {commented_configparser-2.1.0 → commented_configparser-3.0.0/src/commented_configparser.egg-info}/PKG-INFO +29 -40
- {commented_configparser-2.1.0 → commented_configparser-3.0.0}/src/commented_configparser.egg-info/SOURCES.txt +5 -1
- {commented_configparser-2.1.0 → commented_configparser-3.0.0}/src/commented_configparser.egg-info/requires.txt +3 -4
- {commented_configparser-2.1.0 → commented_configparser-3.0.0}/src/commentedconfigparser/commentedconfigparser.py +37 -19
- {commented_configparser-2.1.0 → commented_configparser-3.0.0}/tests/commentedconfigparser_test.py +10 -7
- commented_configparser-3.0.0/tests/empty_comments_expected.ini +17 -0
- commented_configparser-3.0.0/tests/empty_comments_input.ini +17 -0
- {commented_configparser-2.1.0 → commented_configparser-3.0.0}/tests/header_expected.ini +0 -1
- {commented_configparser-2.1.0 → commented_configparser-3.0.0}/tests/multi_expected.ini +0 -1
- {commented_configparser-2.1.0 → commented_configparser-3.0.0}/tests/pydocs_expected.ini +2 -2
- {commented_configparser-2.1.0 → commented_configparser-3.0.0}/tests/regression_original_expected.ini +3 -2
- {commented_configparser-2.1.0 → commented_configparser-3.0.0}/tests/regression_original_input.ini +1 -0
- commented_configparser-2.1.0/.github/workflows/python-tests.yml +0 -108
- commented_configparser-2.1.0/.pre-commit-config.yaml +0 -50
- commented_configparser-2.1.0/CONTRIBUTING.md +0 -186
- commented_configparser-2.1.0/noxfile.py +0 -160
- commented_configparser-2.1.0/requirements/requirements.txt +0 -6
- {commented_configparser-2.1.0 → commented_configparser-3.0.0}/.flake8 +0 -0
- {commented_configparser-2.1.0 → commented_configparser-3.0.0}/LICENSE +0 -0
- /commented_configparser-2.1.0/requirements/requirements.in → /commented_configparser-3.0.0/requirements/requirements.txt +0 -0
- {commented_configparser-2.1.0 → commented_configparser-3.0.0}/setup.cfg +0 -0
- {commented_configparser-2.1.0 → commented_configparser-3.0.0}/src/commented_configparser.egg-info/dependency_links.txt +0 -0
- {commented_configparser-2.1.0 → commented_configparser-3.0.0}/src/commented_configparser.egg-info/top_level.txt +0 -0
- {commented_configparser-2.1.0 → commented_configparser-3.0.0}/src/commentedconfigparser/__init__.py +0 -0
- {commented_configparser-2.1.0 → commented_configparser-3.0.0}/src/commentedconfigparser/py.typed +0 -0
- {commented_configparser-2.1.0 → commented_configparser-3.0.0}/tests/header_input.ini +0 -0
- {commented_configparser-2.1.0 → commented_configparser-3.0.0}/tests/multi01_input.ini +0 -0
- {commented_configparser-2.1.0 → commented_configparser-3.0.0}/tests/multi02_input.ini +0 -0
- {commented_configparser-2.1.0 → commented_configparser-3.0.0}/tests/pydocs_input.ini +0 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
name: "Publish Python distribution to PyPI"
|
|
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
|
|
8
|
+
|
|
9
|
+
on:
|
|
10
|
+
release:
|
|
11
|
+
types: [published]
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
build:
|
|
15
|
+
name: "Build package"
|
|
16
|
+
runs-on: "ubuntu-latest"
|
|
17
|
+
outputs:
|
|
18
|
+
artifact-id: "${{ steps.upload-artifact.outputs.artifact-id }}"
|
|
19
|
+
|
|
20
|
+
steps:
|
|
21
|
+
- uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"
|
|
22
|
+
with:
|
|
23
|
+
persist-credentials: false
|
|
24
|
+
|
|
25
|
+
- name: "Set up Python"
|
|
26
|
+
uses: "actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065"
|
|
27
|
+
with:
|
|
28
|
+
python-version: "3.12"
|
|
29
|
+
|
|
30
|
+
- name: "Build the package"
|
|
31
|
+
run: "python -m pip install nox; nox -s build"
|
|
32
|
+
|
|
33
|
+
- name: "Store the distribution packages"
|
|
34
|
+
id: "upload-artifact"
|
|
35
|
+
uses: "actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02"
|
|
36
|
+
with:
|
|
37
|
+
path: "./dist"
|
|
38
|
+
|
|
39
|
+
publish-to-pypi:
|
|
40
|
+
name: "Publish Python Distribution to PyPI"
|
|
41
|
+
needs: ["build"]
|
|
42
|
+
runs-on: "ubuntu-latest"
|
|
43
|
+
environment:
|
|
44
|
+
name: "pypi"
|
|
45
|
+
url: "https://pypi.org/project/commented-configparser/"
|
|
46
|
+
permissions:
|
|
47
|
+
id-token: "write"
|
|
48
|
+
|
|
49
|
+
steps:
|
|
50
|
+
- name: "Download all the dists"
|
|
51
|
+
uses: "actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093"
|
|
52
|
+
with:
|
|
53
|
+
artifact-ids: "${{ needs.build.outputs.artifact-id }}"
|
|
54
|
+
path: "./dist"
|
|
55
|
+
merge-multiple: true
|
|
56
|
+
|
|
57
|
+
- name: "Publish distribution to PyPI"
|
|
58
|
+
uses: "pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc"
|
|
59
|
+
with:
|
|
60
|
+
repository-url: "https://upload.pypi.org/legacy/"
|
|
61
|
+
verbose: true
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
name: "Publish Python distribution to PyPI Test"
|
|
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
|
|
8
|
+
|
|
9
|
+
on:
|
|
10
|
+
push:
|
|
11
|
+
tags:
|
|
12
|
+
- "[0-9]+.[0-9]+.[a-z]+[0-9]+"
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
build:
|
|
16
|
+
name: "Build package"
|
|
17
|
+
runs-on: "ubuntu-latest"
|
|
18
|
+
outputs:
|
|
19
|
+
artifact-id: "${{ steps.upload-artifact.outputs.artifact-id }}"
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
- uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"
|
|
23
|
+
with:
|
|
24
|
+
persist-credentials: false
|
|
25
|
+
|
|
26
|
+
- name: "Set up Python"
|
|
27
|
+
uses: "actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065"
|
|
28
|
+
with:
|
|
29
|
+
python-version: "3.12"
|
|
30
|
+
|
|
31
|
+
- name: "Build the package"
|
|
32
|
+
run: "python -m pip install nox; nox -s build"
|
|
33
|
+
|
|
34
|
+
- name: "Store the distribution packages"
|
|
35
|
+
id: "upload-artifact"
|
|
36
|
+
uses: "actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02"
|
|
37
|
+
with:
|
|
38
|
+
path: "./dist"
|
|
39
|
+
|
|
40
|
+
publish-to-pypi:
|
|
41
|
+
name: "Publish Python Distribution to PyPI"
|
|
42
|
+
needs: ["build"]
|
|
43
|
+
runs-on: "ubuntu-latest"
|
|
44
|
+
environment:
|
|
45
|
+
name: "testpypi"
|
|
46
|
+
url: "https://test.pypi.org/project/commented-configparser/"
|
|
47
|
+
permissions:
|
|
48
|
+
id-token: "write"
|
|
49
|
+
|
|
50
|
+
steps:
|
|
51
|
+
- name: "Download all the dists"
|
|
52
|
+
uses: "actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093"
|
|
53
|
+
with:
|
|
54
|
+
artifact-ids: "${{ needs.build.outputs.artifact-id }}"
|
|
55
|
+
path: "./dist"
|
|
56
|
+
merge-multiple: true
|
|
57
|
+
|
|
58
|
+
- name: "Publish distribution to PyPI"
|
|
59
|
+
uses: "pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc"
|
|
60
|
+
with:
|
|
61
|
+
repository-url: "https://test.pypi.org/legacy/"
|
|
62
|
+
verbose: true
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
name: "python tests and coverage"
|
|
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
|
+
|
|
8
|
+
on:
|
|
9
|
+
pull_request:
|
|
10
|
+
branches:
|
|
11
|
+
- "main"
|
|
12
|
+
push:
|
|
13
|
+
branches:
|
|
14
|
+
- "main"
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
settings:
|
|
18
|
+
runs-on: "ubuntu-latest"
|
|
19
|
+
name: "Define workflow settings"
|
|
20
|
+
outputs:
|
|
21
|
+
default-python-version: "3.12"
|
|
22
|
+
steps:
|
|
23
|
+
- name: "Define settings"
|
|
24
|
+
run: ""
|
|
25
|
+
|
|
26
|
+
run-tests-and-coverage:
|
|
27
|
+
name: "Run pytest with coverage."
|
|
28
|
+
needs: ["settings"]
|
|
29
|
+
runs-on: "${{ matrix.os }}"
|
|
30
|
+
strategy:
|
|
31
|
+
fail-fast: false
|
|
32
|
+
matrix:
|
|
33
|
+
os:
|
|
34
|
+
- "windows-latest"
|
|
35
|
+
- "ubuntu-latest"
|
|
36
|
+
python-version:
|
|
37
|
+
- "3.9"
|
|
38
|
+
- "3.10"
|
|
39
|
+
- "3.11"
|
|
40
|
+
- "3.12"
|
|
41
|
+
- "3.13"
|
|
42
|
+
- "3.14"
|
|
43
|
+
|
|
44
|
+
steps:
|
|
45
|
+
- name: "Repo checkout"
|
|
46
|
+
uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"
|
|
47
|
+
|
|
48
|
+
- name: "Set up Python ${{ matrix.python-version }}"
|
|
49
|
+
uses: "actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065"
|
|
50
|
+
with:
|
|
51
|
+
python-version: "${{ matrix.python-version }}"
|
|
52
|
+
allow-prereleases: true
|
|
53
|
+
|
|
54
|
+
- name: "Install nox"
|
|
55
|
+
run: |
|
|
56
|
+
python -m pip install --upgrade nox
|
|
57
|
+
|
|
58
|
+
- name: "Run tests and coverage via nox"
|
|
59
|
+
run: |
|
|
60
|
+
nox --session test -- partial-coverage
|
|
61
|
+
|
|
62
|
+
- name: "Save coverage artifact"
|
|
63
|
+
uses: "actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02"
|
|
64
|
+
with:
|
|
65
|
+
name: "coverage-artifact-${{ matrix.os}}-${{ matrix.python-version}}"
|
|
66
|
+
path: ".coverage.*"
|
|
67
|
+
retention-days: 1
|
|
68
|
+
include-hidden-files: true
|
|
69
|
+
|
|
70
|
+
coverage-compile:
|
|
71
|
+
name: "Compile coverage reports."
|
|
72
|
+
needs: ["settings", "run-tests-and-coverage"]
|
|
73
|
+
runs-on: "ubuntu-latest"
|
|
74
|
+
steps:
|
|
75
|
+
- name: "Repo checkout"
|
|
76
|
+
uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"
|
|
77
|
+
|
|
78
|
+
- name: "Set up Python"
|
|
79
|
+
uses: "actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065"
|
|
80
|
+
with:
|
|
81
|
+
python-version: "${{ needs.settings.outputs.default-python-version }}"
|
|
82
|
+
|
|
83
|
+
- name: "Install nox"
|
|
84
|
+
run: |
|
|
85
|
+
python -m pip install --upgrade nox
|
|
86
|
+
|
|
87
|
+
- name: "Download coverage artifacts"
|
|
88
|
+
uses: "actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093"
|
|
89
|
+
with:
|
|
90
|
+
pattern: "coverage-artifact-*"
|
|
91
|
+
merge-multiple: true
|
|
92
|
+
|
|
93
|
+
- name: "Compile coverage data, print report"
|
|
94
|
+
run: |
|
|
95
|
+
nox --session coverage_combine
|
|
96
|
+
export TOTAL=$(python -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])")
|
|
97
|
+
echo "TOTAL=$TOTAL" >> $GITHUB_ENV
|
|
98
|
+
echo "### Total coverage: ${TOTAL}%" >> $GITHUB_STEP_SUMMARY
|
|
99
|
+
|
|
100
|
+
linting:
|
|
101
|
+
name: "Check linting and formatting requirements"
|
|
102
|
+
needs: ["settings"]
|
|
103
|
+
runs-on: "ubuntu-latest"
|
|
104
|
+
steps:
|
|
105
|
+
- name: "Repo checkout"
|
|
106
|
+
uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"
|
|
107
|
+
|
|
108
|
+
- name: "Set up Python"
|
|
109
|
+
uses: "actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065"
|
|
110
|
+
with:
|
|
111
|
+
python-version: "${{ needs.settings.outputs.default-python-version }}"
|
|
112
|
+
|
|
113
|
+
- name: "Install nox"
|
|
114
|
+
run: |
|
|
115
|
+
python -m pip install --upgrade nox
|
|
116
|
+
|
|
117
|
+
- name: "Run formatters and linters"
|
|
118
|
+
run: |
|
|
119
|
+
nox --session lint
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
ci:
|
|
2
|
+
autoupdate_schedule: monthly
|
|
3
|
+
exclude: ^.+\.ini$
|
|
4
|
+
repos:
|
|
5
|
+
# Batch of helpful formatters and patterns
|
|
6
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
7
|
+
rev: "v5.0.0"
|
|
8
|
+
hooks:
|
|
9
|
+
- id: trailing-whitespace
|
|
10
|
+
- id: end-of-file-fixer
|
|
11
|
+
- id: mixed-line-ending
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Before contributing, please either ask to claim an existing open issue or create
|
|
4
|
+
a new issue to discuss your proposed changes with the owner(s) of this repo
|
|
5
|
+
before making any changes.
|
|
6
|
+
|
|
7
|
+
Any pull requests without a clearly defined issue being solved will be closed.
|
|
8
|
+
|
|
9
|
+
### Bug reports
|
|
10
|
+
|
|
11
|
+
Found a bug but do not have time or do not wish to contribute a fix? Please
|
|
12
|
+
submit an issue for our awareness. Your feedback drives the continued
|
|
13
|
+
development of the project!
|
|
14
|
+
|
|
15
|
+
### Pull Request
|
|
16
|
+
|
|
17
|
+
All pull requests must:
|
|
18
|
+
|
|
19
|
+
- Pass all linting and formatting checks
|
|
20
|
+
- Have tests that cover all branches of the added feature
|
|
21
|
+
- If the PR is a bug fix there must be a test that duplicates the bug, proving
|
|
22
|
+
it is fixed
|
|
23
|
+
|
|
24
|
+
### Code Style
|
|
25
|
+
|
|
26
|
+
Follow the patterns seen in the code. Walk where others have walked.
|
|
27
|
+
|
|
28
|
+
Be sure to run the expected formatters and linters prior to opening the PR.
|
|
29
|
+
|
|
30
|
+
### Tests
|
|
31
|
+
|
|
32
|
+
- Smaller tests are easier to work with
|
|
33
|
+
- Mock at a minimum
|
|
34
|
+
- No test should be dependent on another
|
|
35
|
+
- No test should be dependent on secrets/tokens
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
# Local developer installation
|
|
40
|
+
|
|
41
|
+
The following steps outline how to install this repo for local development.
|
|
42
|
+
|
|
43
|
+
## Prerequisites
|
|
44
|
+
|
|
45
|
+
### Clone repo
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
git clone https://github.com/Preocts/commented-configparser
|
|
49
|
+
|
|
50
|
+
cd commented-configparser
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### [Install nox](https://nox.thea.codes/en/stable/index.html)
|
|
54
|
+
|
|
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.
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
## Nox Sessions
|
|
62
|
+
|
|
63
|
+
### Developer Install
|
|
64
|
+
|
|
65
|
+
This builds the `/.venv`, installs the editable
|
|
66
|
+
package, and installs all dependency files.
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
nox -s dev
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Run tests with coverage
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
nox -s test
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Run formatters and linters
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
nox -s lint
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Build dist
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
nox -s build
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Updating dependencies
|
|
93
|
+
|
|
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.
|
|
100
|
+
|
|
101
|
+
### Update the generated files with changes
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
nox -s update-deps
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Upgrade all generated dependencies
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
nox -s upgrade-deps
|
|
111
|
+
```
|
|
@@ -1,52 +1,30 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: commented-configparser
|
|
3
|
-
Version:
|
|
4
|
-
Summary:
|
|
3
|
+
Version: 3.0.0
|
|
4
|
+
Summary: A custom ConfigParser class that preserves comments and most formatting when writing loaded config out.
|
|
5
5
|
Author-email: Preocts <preocts@preocts.com>
|
|
6
|
-
License: MIT
|
|
7
|
-
|
|
8
|
-
Copyright (c) 2024 Preocts
|
|
9
|
-
|
|
10
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
-
in the Software without restriction, including without limitation the rights
|
|
13
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
-
furnished to do so, subject to the following conditions:
|
|
16
|
-
|
|
17
|
-
The above copyright notice and this permission notice shall be included in all
|
|
18
|
-
copies or substantial portions of the Software.
|
|
19
|
-
|
|
20
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
-
SOFTWARE.
|
|
27
|
-
|
|
6
|
+
License-Expression: MIT
|
|
28
7
|
Project-URL: homepage, https://github.com/Preocts/commented-configparser
|
|
29
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
30
8
|
Classifier: Programming Language :: Python :: 3
|
|
31
9
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
32
10
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
33
|
-
Requires-Python: >=3.
|
|
11
|
+
Requires-Python: >=3.9
|
|
34
12
|
Description-Content-Type: text/markdown
|
|
35
13
|
License-File: LICENSE
|
|
36
14
|
Provides-Extra: dev
|
|
37
|
-
Requires-Dist: pre-commit; extra == "dev"
|
|
38
|
-
Requires-Dist: black; extra == "dev"
|
|
39
|
-
Requires-Dist: mypy; extra == "dev"
|
|
40
15
|
Requires-Dist: flake8; extra == "dev"
|
|
41
16
|
Requires-Dist: flake8-builtins; extra == "dev"
|
|
42
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"
|
|
43
21
|
Provides-Extra: test
|
|
44
22
|
Requires-Dist: pytest; extra == "test"
|
|
45
23
|
Requires-Dist: pytest-randomly; extra == "test"
|
|
46
24
|
Requires-Dist: coverage; extra == "test"
|
|
47
|
-
|
|
25
|
+
Dynamic: license-file
|
|
48
26
|
|
|
49
|
-
[](https://www.python.org/downloads)
|
|
50
28
|
[](https://github.com/psf/black)
|
|
51
29
|
[](https://github.com/pre-commit/pre-commit)
|
|
52
30
|
|
|
@@ -55,9 +33,17 @@ Requires-Dist: nox; extra == "test"
|
|
|
55
33
|
|
|
56
34
|
# commented-configparser
|
|
57
35
|
|
|
58
|
-
|
|
36
|
+
- [Contributing Guide and Developer Setup Guide](./CONTRIBUTING.md)
|
|
37
|
+
- [License: MIT](./LICENSE)
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
A custom ConfigParser class that preserves comments and most formatting when
|
|
42
|
+
writing loaded config out.
|
|
59
43
|
|
|
60
|
-
This library gives you a custom class of the standard library's
|
|
44
|
+
This library gives you a custom class of the standard library's
|
|
45
|
+
`configparser.ConfigParger` which will preserve the comments of a loaded config
|
|
46
|
+
file when writing that file back out.
|
|
61
47
|
|
|
62
48
|
---
|
|
63
49
|
|
|
@@ -101,7 +87,11 @@ with open("myconfig.ini", "w") as savefile:
|
|
|
101
87
|
|
|
102
88
|
## Results
|
|
103
89
|
|
|
104
|
-
|
|
90
|
+
There is the attempt to retain the original format. Known formats that will not
|
|
91
|
+
be preserved:
|
|
92
|
+
|
|
93
|
+
1. Indents will not be preserved outside of multi-line values
|
|
94
|
+
2. Spacing around assignments will be normalized.
|
|
105
95
|
|
|
106
96
|
### Before
|
|
107
97
|
|
|
@@ -120,13 +110,12 @@ logging=true
|
|
|
120
110
|
; and many could be between things
|
|
121
111
|
[NEW SECTION]
|
|
122
112
|
# Another comment
|
|
123
|
-
|
|
113
|
+
multiLine=
|
|
124
114
|
value01
|
|
125
115
|
value02
|
|
126
116
|
value03
|
|
127
117
|
closing=0
|
|
128
118
|
# Trailing comment
|
|
129
|
-
|
|
130
119
|
```
|
|
131
120
|
|
|
132
121
|
### After
|
|
@@ -140,16 +129,16 @@ foo = bar
|
|
|
140
129
|
trace = false
|
|
141
130
|
logging = true
|
|
142
131
|
; This is a comment as well
|
|
132
|
+
|
|
143
133
|
# so we need to track all of them
|
|
144
|
-
; and many could be between things
|
|
145
134
|
|
|
135
|
+
; and many could be between things
|
|
146
136
|
[NEW SECTION]
|
|
147
137
|
# Another comment
|
|
148
|
-
|
|
138
|
+
multiLine =
|
|
149
139
|
value01
|
|
150
140
|
value02
|
|
151
141
|
value03
|
|
152
142
|
closing = 0
|
|
153
143
|
# Trailing comment
|
|
154
|
-
|
|
155
144
|
```
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[](https://www.python.org/downloads)
|
|
2
2
|
[](https://github.com/psf/black)
|
|
3
3
|
[](https://github.com/pre-commit/pre-commit)
|
|
4
4
|
|
|
@@ -7,9 +7,17 @@
|
|
|
7
7
|
|
|
8
8
|
# commented-configparser
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
- [Contributing Guide and Developer Setup Guide](./CONTRIBUTING.md)
|
|
11
|
+
- [License: MIT](./LICENSE)
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
A custom ConfigParser class that preserves comments and most formatting when
|
|
16
|
+
writing loaded config out.
|
|
17
|
+
|
|
18
|
+
This library gives you a custom class of the standard library's
|
|
19
|
+
`configparser.ConfigParger` which will preserve the comments of a loaded config
|
|
20
|
+
file when writing that file back out.
|
|
13
21
|
|
|
14
22
|
---
|
|
15
23
|
|
|
@@ -53,7 +61,11 @@ with open("myconfig.ini", "w") as savefile:
|
|
|
53
61
|
|
|
54
62
|
## Results
|
|
55
63
|
|
|
56
|
-
|
|
64
|
+
There is the attempt to retain the original format. Known formats that will not
|
|
65
|
+
be preserved:
|
|
66
|
+
|
|
67
|
+
1. Indents will not be preserved outside of multi-line values
|
|
68
|
+
2. Spacing around assignments will be normalized.
|
|
57
69
|
|
|
58
70
|
### Before
|
|
59
71
|
|
|
@@ -72,13 +84,12 @@ logging=true
|
|
|
72
84
|
; and many could be between things
|
|
73
85
|
[NEW SECTION]
|
|
74
86
|
# Another comment
|
|
75
|
-
|
|
87
|
+
multiLine=
|
|
76
88
|
value01
|
|
77
89
|
value02
|
|
78
90
|
value03
|
|
79
91
|
closing=0
|
|
80
92
|
# Trailing comment
|
|
81
|
-
|
|
82
93
|
```
|
|
83
94
|
|
|
84
95
|
### After
|
|
@@ -92,16 +103,16 @@ foo = bar
|
|
|
92
103
|
trace = false
|
|
93
104
|
logging = true
|
|
94
105
|
; This is a comment as well
|
|
106
|
+
|
|
95
107
|
# so we need to track all of them
|
|
96
|
-
; and many could be between things
|
|
97
108
|
|
|
109
|
+
; and many could be between things
|
|
98
110
|
[NEW SECTION]
|
|
99
111
|
# Another comment
|
|
100
|
-
|
|
112
|
+
multiLine =
|
|
101
113
|
value01
|
|
102
114
|
value02
|
|
103
115
|
value03
|
|
104
116
|
closing = 0
|
|
105
117
|
# Trailing comment
|
|
106
|
-
|
|
107
118
|
```
|