Skip to content

Commit 90993f8

Browse files
Merge pull request #38 from Zuehlke/dev_tools
Dev tools
2 parents ac0aead + ecdef0e commit 90993f8

38 files changed

+1440
-440
lines changed

.github/workflows/coverage.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: coverage
2+
on: [ pull_request ]
3+
jobs:
4+
run-coverage:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v2
8+
- uses: ./.github/workflows/setup-env
9+
with:
10+
python-version: "3.10"
11+
- name: run coverage
12+
run: |
13+
coverage run -m pytest
14+
coverage report --fail-under=100

.github/workflows/format.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: format
2+
on: [ pull_request ]
3+
jobs:
4+
run-format:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v2
8+
- uses: ./.github/workflows/setup-env
9+
with:
10+
python-version: "3.10"
11+
- name: run black
12+
run: |
13+
black --check .

.github/workflows/lint.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: lint
2+
on: [ pull_request ]
3+
jobs:
4+
run-lint:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v2
8+
- uses: ./.github/workflows/setup-env
9+
with:
10+
python-version: "3.10"
11+
- name: run pylint
12+
run: |
13+
pylint confz

.github/workflows/publish.yaml renamed to .github/workflows/publish.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,9 @@ jobs:
77
runs-on: ubuntu-latest
88
steps:
99
- uses: actions/checkout@v2
10-
- uses: actions/setup-python@v2
10+
- uses: ./.github/workflows/setup-env
1111
with:
1212
python-version: "3.10"
13-
- name: install dependencies
14-
run: |
15-
python -m pip install --upgrade pip
16-
pip install poetry
17-
poetry config virtualenvs.create false
18-
poetry install
1913
- name: build and publish
2014
env:
2115
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: "Setup environment"
2+
description: "Sets up python and installs all dependencies."
3+
inputs:
4+
python-version:
5+
description: "Version of python"
6+
required: true
7+
runs:
8+
using: "composite"
9+
steps:
10+
- uses: actions/checkout@v2
11+
- uses: actions/setup-python@v2
12+
with:
13+
python-version: ${{ inputs.python-version }}
14+
- name: install dependencies
15+
run: |
16+
python -m pip install --upgrade pip
17+
pip install poetry
18+
poetry config virtualenvs.create false
19+
poetry install
20+
shell: bash

.github/workflows/test.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: test
2+
on: [ pull_request ]
3+
jobs:
4+
run-test:
5+
runs-on: ubuntu-latest
6+
strategy:
7+
matrix:
8+
python-version: ["3.7", "3.8", "3.9", "3.10"]
9+
steps:
10+
- uses: actions/checkout@v2
11+
- uses: ./.github/workflows/setup-env
12+
with:
13+
python-version: ${{ matrix.python-version }}
14+
- name: run pytest
15+
run: |
16+
pytest

.github/workflows/tests.yaml

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

.github/workflows/typecheck.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: typecheck
2+
on: [ pull_request ]
3+
jobs:
4+
run-typecheck:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v2
8+
- uses: ./.github/workflows/setup-env
9+
with:
10+
python-version: "3.10"
11+
- name: run mypy
12+
run: |
13+
mypy confz

CONTRIBUTING.md

Lines changed: 52 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Contribution Instruction & Guidelines
22

3+
Any kind of contribution to ConfZ is most welcome!
4+
5+
- If you have a question, please use GitHub
6+
[discussions](https://github.com/Zuehlke/ConfZ/discussions).
7+
- If you found a bug or have a feature request, please use GitHub
8+
[issues](https://github.com/Zuehlke/ConfZ/issues).
9+
- If you fixed a bug or implemented a new feature, please do a pull request. If it
10+
is a larger change or addition, it would be great to first discuss thorugh an
11+
[issue](https://github.com/Zuehlke/ConfZ/issues).
12+
313
## Setup Repo
414

515
This repository uses [poetry](https://python-poetry.org/) for dependency management.
@@ -12,37 +22,59 @@ poetry install
1222
in this folder.
1323

1424
Poetry is also used for building and publishing the library.
15-
This is normally handled by the corresponding [github action](.github/workflows/publish.yaml),
16-
but can also be done manually with
25+
This is normally handled by the corresponding
26+
[github action](github/workflows/publish.yml), but can also be done manually with
1727

1828
```
1929
poetry publish --build
2030
```
2131

2232
in this folder. The built package is hosted on [PyPI](https://pypi.org/project/confz/).
2333

24-
## Run Tests
34+
## Development Tools
35+
36+
[Pytest](https://pytest.org) is used for testing the code, just run
37+
38+
```
39+
pytest
40+
```
41+
42+
in this folder. We strive for a coverage of 100%. To check this, run the following:
43+
44+
```
45+
coverage run -m pytest
46+
coverage report --fail-under=100
47+
```
48+
49+
This repository furthermore uses [mypy](https://mypy.readthedocs.io/en/stable/) for
50+
type checking, which can be run with the following:
51+
52+
```
53+
mypy confz
54+
```
2555

26-
[Pytest](https://pytest.org) is used for testing the code, together with [coverage](https://coverage.readthedocs.io).
27-
To run all tests and build a coverage report, run
56+
For linting, we use [pylint](https://pylint.org/), which can be run with:
2857

2958
```
30-
pytest --cov=confz
59+
pylint confz
3160
```
3261

33-
in this folder. To get an in-depth analysis of the coverage, generate a report, e.g. in HTML format, with
62+
Last but not least, we use [black](https://black.readthedocs.io/en/stable/) for
63+
formatting. You can reformat all files with:
3464

3565
```
36-
coverage html
66+
black .
3767
```
3868

39-
in this folder. This will read the _.coverage_ file and generate a report out of it.
69+
There are GitHub actions in place for all these tools which make sure that no pull
70+
request will be merged if any of them shows an error.
4071

41-
## Build Docs
72+
## Documentation
4273

43-
[Sphinx](https://sphinx-doc.org/) is used for documentation, together with reST docstrings.
44-
A corresponding github webhook triggers builds on [readthedocs](https://readthedocs.org/).
45-
The documentation can also be built locally with
74+
[Sphinx](https://sphinx-doc.org/) is used for documentation, together with reST
75+
docstrings. A corresponding github webhook triggers builds on
76+
[readthedocs](https://readthedocs.org/). The documentation can also be built locally
77+
by running
4678

4779
```
4880
make html
@@ -52,16 +84,14 @@ in the [docs](docs) folder.
5284

5385
## Branching & Release Strategy
5486

55-
The default branch is called _main_.
56-
It contains the latest features, which would be ready for deployment.
57-
It is not possible to push to it directly.
58-
Instead, for every feature, a branch should be created, which will then be merged back into _main_ with a pull request.
59-
Github is configured to run all tests when a PR is created.
87+
The default branch is called _main_. It contains the latest features, which would be
88+
ready for deployment. It is not possible to push to it directly. Instead, for every
89+
feature, a branch should be created, which will then be merged back into _main_ with
90+
a pull request. GitHub is configured to run all tests when a PR is created.
6091

6192
At some point, a new version can be released.
62-
To do so, a separate PR should be opened, which increases the version number.
63-
After merging, a release with corresponding release notes can then be generated on Github.
64-
This also automatically triggers a deployment to PyPI.
93+
To do so, a release with corresponding release notes can then be generated on GitHub.
94+
This also automatically triggers a deployment to PyPI. The tag of the release should
95+
match the version specified in [pyproject.toml](pyproject.toml).
6596

6697
Semantic versioning is used for releases.
67-
Branches should be prefixed with _feature/_, _bugfix/_ or _release/_ accordingly.

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# ConfZ – Pydantic Config Management
22

3-
[![tests](https://github.com/Zuehlke/ConfZ/actions/workflows/tests.yaml/badge.svg)](https://github.com/Zuehlke/ConfZ/actions/workflows/tests.yaml)
4-
[![Documentation Status](https://readthedocs.org/projects/confz/badge/?version=latest)](https://confz.readthedocs.io/en/latest/?badge=latest)
5-
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/confz)
6-
![PyPI](https://img.shields.io/pypi/v/confz)
7-
![PyPI - License](https://img.shields.io/pypi/l/confz)
3+
[![test](https://github.com/Zuehlke/ConfZ/actions/workflows/test.yml/badge.svg)](https://github.com/Zuehlke/ConfZ/actions/workflows/test.yml)
4+
[![documentation](https://readthedocs.org/projects/confz/badge/?version=latest)](https://confz.readthedocs.io/en/latest/)
5+
[![coverage](https://img.shields.io/badge/coverage-100%25-brightgreen)](https://github.com/Zuehlke/ConfZ/actions/workflows/coverage.yml) <!-- hard-code because can not merge if below 100 -->
6+
[![python](https://img.shields.io/pypi/pyversions/confz)](https://pypi.org/project/confz/)
7+
[![pypi](https://img.shields.io/pypi/v/confz)](https://pypi.org/project/confz/)
88

99
`ConfZ` is a configuration management library for Python based on [pydantic](https://pydantic-docs.helpmanual.io/).
1010
It easily allows you to

confz/__init__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
from .change import depends_on
22
from .confz import ConfZ
3-
from .confz_source import ConfZSources, ConfZSource, ConfZFileSource, ConfZEnvSource, ConfZCLArgSource, FileFormat, \
4-
ConfZDataSource
3+
from .confz_source import (
4+
ConfZSources,
5+
ConfZSource,
6+
ConfZFileSource,
7+
ConfZEnvSource,
8+
ConfZCLArgSource,
9+
FileFormat,
10+
ConfZDataSource,
11+
)
512
from .validate import validate_all_configs

0 commit comments

Comments
 (0)