Skip to content

Commit 7108e2a

Browse files
authored
Merge pull request #5 from RalfG/infrastructure-updates
Infrastructure updates
2 parents 15bfe96 + 1b2ae13 commit 7108e2a

File tree

11 files changed

+153
-120
lines changed

11 files changed

+153
-120
lines changed

.github/workflows/publish.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
name: Publish to PyPI and GitHub release
22

33
on:
4-
push:
5-
tags:
6-
- '*'
4+
release:
5+
types: [created]
76

87
jobs:
98
publish:
@@ -28,11 +27,3 @@ jobs:
2827
run: |
2928
flit build
3029
twine upload dist/*
31-
32-
- name: Create GitHub Release
33-
uses: docker://antonyurchenko/git-release:v4
34-
env:
35-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36-
DRAFT_RELEASE: "false"
37-
PRE_RELEASE: "false"
38-
CHANGELOG_FILE: "CHANGELOG.md"

.github/workflows/test.yml

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,59 +3,68 @@ name: Test Python package
33
on:
44
push:
55
branches:
6-
- master
6+
- main
77
pull_request:
88

99
jobs:
1010
full_test:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v2
14-
- name: Set up Python 3.8
15-
uses: actions/setup-python@v2
16-
with:
17-
python-version: 3.8
18-
- name: Install dependencies
19-
run: |
20-
python -m pip install --upgrade pip
21-
pip install flit flake8
22-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
23-
- name: Lint with flake8
24-
run: |
25-
# stop the build if there are Python syntax errors or undefined names
26-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
27-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
28-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
29-
- name: Install with Flit
30-
run: flit install
31-
- name: Test with pytest
32-
run: |
33-
pytest --cov=cascade_config tests
34-
- name: Uploade coverage reports to Codecov
35-
uses: codecov/codecov-action@v3
13+
- uses: actions/checkout@v2
14+
15+
- name: Set up Python 3.8
16+
uses: actions/setup-python@v2
17+
with:
18+
python-version: 3.8
19+
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install flit flake8
24+
25+
- name: Lint with flake8
26+
run: |
27+
# stop the build if there are Python syntax errors or undefined names
28+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
29+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
30+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
31+
32+
- name: Install with Flit
33+
run: flit install
34+
35+
- name: Test with pytest
36+
run: |
37+
pytest --cov=cascade_config tests
38+
39+
- name: Upload coverage reports to Codecov
40+
uses: codecov/codecov-action@v3
3641

3742
test_platforms:
38-
runs-on: ${{ matrix.os }}
43+
runs-on: ubuntu-latest
3944
strategy:
4045
matrix:
41-
python-version: [3.6, 3.7, 3.8]
42-
os: [ubuntu-latest, windows-latest, macos-latest]
46+
python-version: ["3.8", "3.9", "3.10", "3.11"]
4347
steps:
4448
- uses: actions/checkout@v2
49+
4550
- name: Set up Python ${{ matrix.python-version }}
4651
uses: actions/setup-python@v2
4752
with:
4853
python-version: ${{ matrix.python-version }}
54+
4955
- name: Install dependencies
5056
run: |
5157
python -m pip install --upgrade pip
5258
pip install flit flake8
59+
5360
- name: Lint with flake8
5461
run: |
5562
# stop the build if there are Python syntax errors or undefined names
5663
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
64+
5765
- name: Install project
5866
run: flit install
67+
5968
- name: Test with pytest
6069
run: |
6170
pytest

.readthedocs.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
3+
python:
4+
install:
5+
- method: pip
6+
path: .
7+
extra_requirements:
8+
- docs
9+
10+
sphinx:
11+
builder: dirhtml

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,35 @@
11
# Changelog
2+
23
All notable changes to this project will be documented in this file.
34

45
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
56
and this project adheres to
67
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
78

9+
## [0.3.1] - 03/07/2023
10+
11+
### Fixed
12+
13+
- Fix previous broken build (did not include changes)
14+
815
## [0.3.0] - 15/11/2021
16+
17+
### Fixed
18+
919
- Fix parsing of empty dictionaries and `False` configuration values. These would
1020
previously be overridden by the downstream configuration.
1121

1222
## [0.2.0] - 28/09/2021
23+
24+
### Added
25+
1326
- Add none_overrides_value option. Before this change, None values would unexpectedly
1427
override previously configured values. Now, the previous value will be retained if
1528
newer values are None. The old behavior can be re-enabled with by setting the
1629
none_overrides_value argument of CascadeConfig to True.
1730

1831
## [0.1.0-a0] - 03/08/2020
32+
33+
### Added
34+
1935
- Initial release

CONTRIBUTING.md

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,44 +12,36 @@ you are welcome to communicate it with the community by creating an issue in
1212
## How to contribute
1313

1414
- Fork [cascade-config](https://github.com/ralfg/cascade-config) on GitHub to
15-
make your changes.
15+
make your changes.
1616
- Commit and push your changes to your
17-
[fork](https://help.github.com/articles/pushing-to-a-remote/).
17+
[fork](https://help.github.com/articles/pushing-to-a-remote/).
1818
- Open a
19-
[pull request](https://help.github.com/articles/creating-a-pull-request/)
20-
with these changes. You pull request message ideally should include:
21-
- A description of why the changes should be made.
22-
- A description of the implementation of the changes.
23-
- A description of how to test the changes.
19+
[pull request](https://help.github.com/articles/creating-a-pull-request/)
20+
with these changes. You pull request message ideally should include:
21+
- A description of why the changes should be made.
22+
- A description of the implementation of the changes.
23+
- A description of how to test the changes.
2424
- The pull request should pass all the continuous integration tests which are
2525
automatically run by
2626
[GitHub Actions](https://github.com/ralfg/cascade-config/actions).
2727

28-
2928
## Development setup
3029

3130
1. Setup Python 3 and [Flit](https://flit.readthedocs.io/en/latest/)
3231
2. Clone the [cascade-config repository](https://github.com/ralfg/cascade-config) and
3332
run `flit install` to setup an editable version of cascade-config.
3433

35-
3634
## Development workflow
3735

3836
- When a new version is ready to be published:
3937

40-
1. Change the `__version__` in `cascade_config.py` following
41-
[semantic versioning](https://semver.org/).
42-
2. Update the documentation (`README.md` and `docs/source/usage.rst`) if required.
43-
3. Update the changelog (if not already done) in `CHANGELOG.md` according to
44-
[Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
45-
4. Commit all final changes to the `master` branch.
46-
4. On `master`, set a new tag with the version number, e.g. `git tag v0.1.5`.
47-
5. Push to GitHub, with the tag: `git push; git push --tags`.
48-
49-
- When a new tag is pushed to (or made on) GitHub that matches `v*`, the
50-
following GitHub Actions are triggered:
51-
52-
1. The Python package is build and published to PyPI.
53-
2. Using the [Git Release](https://github.com/marketplace/actions/git-release)
54-
action, a new GitHub release is made with the changes that are listed in
55-
`CHANGELOG.md`.
38+
1. Change the `__version__` in `cascade_config.py` following
39+
[semantic versioning](https://semver.org/).
40+
2. Update the documentation (`README.md` and `docs/source/usage.rst`) if required.
41+
3. Update the changelog (if not already done) in `CHANGELOG.md` according to
42+
[Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
43+
4. Merge all final changes into the `main` branch.
44+
5. Create a new GitHub release.
45+
46+
- When a new GitHub release is created, the publish GitHub Action is triggered,
47+
building the Python package is build and publishes it to PyPI.

cascade_config.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Cascading configuration from the CLI and config files."""
22

3-
__version__ = "0.3.0"
3+
__version__ = "0.3.1"
44

55
import json
66
import os
@@ -55,22 +55,25 @@ def _update_dict_recursively(self, original: Dict, updater: Dict) -> Dict:
5555
"""Update dictionary recursively."""
5656
for k, v in updater.items():
5757
if isinstance(v, dict):
58-
if not v: # v is not None, v is empty dictionary
58+
if not v: # v is not None, v is empty dictionary
5959
original[k] = dict()
6060
else:
6161
original[k] = self._update_dict_recursively(original.get(k, {}), v)
6262
elif isinstance(v, bool):
6363
original[k] = v # v is True or False
6464
elif v or k not in original: # v is not None, or key does not exist yet
6565
original[k] = v
66-
elif self.none_overrides_value: # v is None, but can override previous value
66+
elif (
67+
self.none_overrides_value
68+
): # v is None, but can override previous value
6769
original[k] = v
6870
return original
6971

7072
def add_dict(self, *args, **kwargs):
7173
"""
7274
Add dictionary configuration source to source list.
73-
*args and **kwargs are passed to :class:`cascade_config.DictConfigSource()`.
75+
76+
``*args`` and ``**kwargs`` are passed to :class:`cascade_config.DictConfigSource()`.
7477
7578
"""
7679
source = DictConfigSource(*args, **kwargs)
@@ -79,7 +82,9 @@ def add_dict(self, *args, **kwargs):
7982
def add_argumentparser(self, *args, **kwargs):
8083
"""
8184
Add argumentparser configuration source to source list.
82-
*args and **kwargs are passed to :class:`cascade_config.ArgumentParserConfigSource()`.
85+
86+
``*args`` and ``**kwargs`` are passed to
87+
:class:`cascade_config.ArgumentParserConfigSource()`.
8388
8489
"""
8590
source = ArgumentParserConfigSource(*args, **kwargs)
@@ -88,15 +93,19 @@ def add_argumentparser(self, *args, **kwargs):
8893
def add_namespace(self, *args, **kwargs):
8994
"""
9095
Add argparse Namespace configuration source to source list.
91-
*args and **kwargs are passed to :class:`cascade_config.NamespaceConfigSource()`.
96+
97+
``*args`` and ``**kwargs`` are passed to
98+
:class:`cascade_config.NamespaceConfigSource()`.
9299
"""
93100
source = NamespaceConfigSource(*args, **kwargs)
94101
self.sources.append(source)
95102

96103
def add_json(self, *args, **kwargs):
97104
"""
98105
Add JSON configuration source to source list.
99-
*args and **kwargs are passed to :class:`cascade_config.JSONConfigSource()`.
106+
107+
``*args`` and ``**kwargs`` are passed to
108+
:class:`cascade_config.JSONConfigSource()`.
100109
"""
101110
source = JSONConfigSource(*args, **kwargs)
102111
self.sources.append(source)

docs/requirements.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)