Skip to content

Commit 27c6918

Browse files
authored
Merge pull request #16 from InfrastructureAsCode-ch/develop
Release TUI and YAML command
2 parents 9957e16 + 5787393 commit 27c6918

24 files changed

+1112
-552
lines changed

.github/workflows/main.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
fail-fast: false
5050
matrix:
5151
python-version: [ '3.8', '3.9', '3.10' ]
52-
platform: [ubuntu-latest, macOS-10.15, windows-latest]
52+
platform: [ubuntu-latest, macOS-latest, windows-latest]
5353
runs-on: ${{ matrix.platform }}
5454
steps:
5555
- uses: actions/checkout@v2
@@ -78,7 +78,7 @@ jobs:
7878
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
7979

8080
- name: Run pytest
81-
run: make pytest
81+
run: poetry run pytest -vs
8282

8383
pytest_extras:
8484
name: Testing ${{ matrix.extra }} on Python ${{ matrix.python-version }} (${{ matrix.platform}})
@@ -89,7 +89,7 @@ jobs:
8989
fail-fast: false
9090
matrix:
9191
python-version: [ '3.8', '3.9', '3.10' ]
92-
platform: [ubuntu-latest, macOS-10.15, windows-latest]
92+
platform: [ubuntu-latest, macOS-latest, windows-latest]
9393
extra: [ 'jinja', 'ttp']
9494
runs-on: ${{ matrix.platform }}
9595
steps:

CODE_OF_CONDUCT.md

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, caste, color, religion, or sexual
10+
identity and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
* Demonstrating empathy and kindness toward other people
21+
* Being respectful of differing opinions, viewpoints, and experiences
22+
* Giving and gracefully accepting constructive feedback
23+
* Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
* Focusing on what is best not just for us as individuals, but for the overall
26+
community
27+
28+
Examples of unacceptable behavior include:
29+
30+
* The use of sexualized language or imagery, and sexual attention or advances of
31+
any kind
32+
* Trolling, insulting or derogatory comments, and personal or political attacks
33+
* Public or private harassment
34+
* Publishing others' private information, such as a physical or email address,
35+
without their explicit permission
36+
* Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official e-mail address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement at
63+
64+
All complaints will be reviewed and investigated promptly and fairly.
65+
66+
All community leaders are obligated to respect the privacy and security of the
67+
reporter of any incident.
68+
69+
## Enforcement Guidelines
70+
71+
Community leaders will follow these Community Impact Guidelines in determining
72+
the consequences for any action they deem in violation of this Code of Conduct:
73+
74+
### 1. Correction
75+
76+
**Community Impact**: Use of inappropriate language or other behavior deemed
77+
unprofessional or unwelcome in the community.
78+
79+
**Consequence**: A private, written warning from community leaders, providing
80+
clarity around the nature of the violation and an explanation of why the
81+
behavior was inappropriate. A public apology may be requested.
82+
83+
### 2. Warning
84+
85+
**Community Impact**: A violation through a single incident or series of
86+
actions.
87+
88+
**Consequence**: A warning with consequences for continued behavior. No
89+
interaction with the people involved, including unsolicited interaction with
90+
those enforcing the Code of Conduct, for a specified period of time. This
91+
includes avoiding interactions in community spaces as well as external channels
92+
like social media. Violating these terms may lead to a temporary or permanent
93+
ban.
94+
95+
### 3. Temporary Ban
96+
97+
**Community Impact**: A serious violation of community standards, including
98+
sustained inappropriate behavior.
99+
100+
**Consequence**: A temporary ban from any sort of interaction or public
101+
communication with the community for a specified period of time. No public or
102+
private interaction with the people involved, including unsolicited interaction
103+
with those enforcing the Code of Conduct, is allowed during this period.
104+
Violating these terms may lead to a permanent ban.
105+
106+
### 4. Permanent Ban
107+
108+
**Community Impact**: Demonstrating a pattern of violation of community
109+
standards, including sustained inappropriate behavior, harassment of an
110+
individual, or aggression toward or disparagement of classes of individuals.
111+
112+
**Consequence**: A permanent ban from any sort of public interaction within the
113+
community.
114+
115+
## Attribution
116+
117+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118+
version 2.1, available at
119+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120+
121+
Community Impact Guidelines were inspired by
122+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123+
124+
For answers to common questions about this code of conduct, see the FAQ at
125+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126+
[https://www.contributor-covenant.org/translations][translations].
127+
128+
[homepage]: https://www.contributor-covenant.org
129+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130+
[Mozilla CoC]: https://github.com/mozilla/diversity
131+
[FAQ]: https://www.contributor-covenant.org/faq
132+
[translations]: https://www.contributor-covenant.org/translations

CONTRIBUTING.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Contributing to NetTowel
2+
3+
Contributions are highly welcomed and appreciated!
4+
5+
## Development Environment
6+
7+
NetTowel uses [poetry](https://python-poetry.org/docs/) for packaging and
8+
dependency management.
9+
10+
### Tests
11+
12+
NetTowel uses [`pytest`](https://docs.pytest.org/) testing tool
13+
Run tests with the following command:
14+
15+
```
16+
make pytest
17+
```
18+
19+
Make sure to test new code and not break existing tests.
20+
21+
### Type Checking
22+
23+
NetTowel uses type annotations and `mypy` is used as a static type checker.
24+
Run the following to type check NetTowel:
25+
26+
```
27+
make mypy
28+
```
29+
30+
Please add type annotations for all new code.
31+
32+
### Code Formatting
33+
34+
NetTowel uses [`black`](https://github.com/psf/black) for code formatting.
35+
Run the following to check the formatting:
36+
37+
```
38+
make black
39+
```
40+
41+
### All Tests
42+
43+
Before pushing a commit all tests should be run.
44+
Run the following command:
45+
46+
```
47+
make pytest
48+
```
49+
50+
### Bump version
51+
52+
The version can be updated with the following command:
53+
Steps: patch, minor, major, prepatch, preminor, premajor, prerelease.
54+
55+
```bash
56+
make bump ARGS=patch
57+
```
58+
59+
### Install branch from git with extras
60+
61+
To install a branch with `pip` and be able to specify the extras use the following command:
62+
63+
```bash
64+
pip install git+https://github.com/InfrastructureAsCode-ch/nettowel.git@<branch_name>#egg=nettowel[<extras>]
65+
```
66+
67+
Example:
68+
69+
```bash
70+
pip install git+https://github.com/InfrastructureAsCode-ch/nettowel.git@develop#egg=nettowel[full]
71+
```

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,38 @@ PROJECT=nettowel
22
CODE_DIRS=${PROJECT} tests
33
IMG_URL=https://raw.githubusercontent.com/InfrastructureAsCode-ch/nettowel/main/imgs/
44

5+
# Run pytest
56
.PHONY: pytest
67
pytest:
78
poetry run pytest -vs ${ARGS}
89

10+
# Check if the python code needs to be reformatted
911
.PHONY: black
1012
black:
1113
poetry run black --check ${CODE_DIRS}
1214

15+
# Python type check
1316
.PHONY: mypy
1417
mypy:
1518
poetry run mypy ${CODE_DIRS}
1619

20+
# Runn pytest, black and mypy
1721
.PHONY: tests
1822
tests: pytest black mypy
1923

24+
# use "make bump ARGS=patch" to bump the version. ARGS can be patch, minor or major.
2025
.PHONY: bump
2126
bump:
2227
poetry version ${ARGS}
2328
sed -i -E "s|\"\b[0-9]+.\b[0-9]+.\b[0-9]+\" # From Makefile|\"`poetry version -s`\" # From Makefile|g" ${PROJECT}/__init__.py
2429
sed -i -E "s|\"\b[0-9]+.\b[0-9]+.\b[0-9]+\" # From Makefile|\"`poetry version -s`\" # From Makefile|g" tests/test_${PROJECT}.py
2530

31+
# Used in the pipeline to change the image urls befor publishing it on pypi.org
2632
.PHONY: fiximageurls
2733
fiximageurls:
2834
sed -i "s|](imgs/|](${IMG_URL}|g" README.md
2935

36+
# Create a new tag and push it to origin. This will triger the pipeline and a new release will be published
3037
.PHONY: tag
3138
tag:
3239
git checkout main

README.md

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
# nettowel
1+
[![PyPI versions](https://img.shields.io/pypi/pyversions/nettowel.svg)](https://pypi.python.org/pypi/nettowel/)
2+
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
3+
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md)
4+
[![Downloads](https://pepy.tech/badge/nettowel)](https://pepy.tech/project/nettowel)
5+
6+
# NetTowel
27
Collection of useful network automation functions
38

9+
410
> ⚠️ `nettowel` is under heavy construction and not production ready. Feedback is highly appreciated.
511
612

@@ -25,6 +31,7 @@ The following groups are available (more details in the pyproject.toml):
2531
- scrapli
2632
- nornir
2733
- pandas
34+
- tui
2835

2936
```bash
3037
pip install nettowel[jinja]
@@ -117,6 +124,16 @@ Many features are not implemented yet and many features will come.
117124
![network info](imgs/network-info.png)
118125

119126

127+
### YAML
128+
129+
#### load
130+
131+
![yaml load](imgs/yaml-load.png)
132+
133+
#### dump
134+
135+
![yaml dump](imgs/yaml-dump.png)
136+
120137
### Help
121138

122139
![Help QRcode](imgs/nettowel-help.png)
@@ -134,28 +151,8 @@ A `dotenv` file can be used as a settings file. The file can also be provided wi
134151
![piping](imgs/piping.png)
135152

136153

154+
### TUI
137155

138-
## Building CLI Docs
139-
140-
**At the moment `typer-cli` is not ready for typer 0.4.0**
141-
142-
```
143-
typer nettowel/cli/main.py utils docs --name nettowel --output CLI.md
144-
```
145-
146-
## Contributing
147-
148-
### Run tests:
149-
150-
```bash
151-
make tests
152-
```
153-
154-
155-
### Bump version:
156+
Using [Trogon](https://github.com/Textualize/trogon) a TUI (Terminal User Interface) can be generated to edit and run the NetTowel command.
156157

157-
Steps: patch, minor, major, prepatch, preminor, premajor, prerelease.
158-
159-
```bash
160-
make bump ARGS=patch
161-
```
158+
![TUI](imgs/trogon.png)

imgs/help.png

23.9 KB
Loading

imgs/trogon.png

49.8 KB
Loading

imgs/yaml-dump.png

64.4 KB
Loading

imgs/yaml-load.png

48 KB
Loading

nettowel/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.5.0" # From Makefile
1+
__version__ = "0.5.1" # From Makefile

0 commit comments

Comments
 (0)