-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: small improvements for push
- Loading branch information
Showing
13 changed files
with
186 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
.vscode | ||
__pycache__ | ||
*.rock | ||
.venv/ | ||
yaml_checker/yaml_checker.egg-info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,111 @@ | ||
# YAML Checker | ||
|
||
An internal CLI util for formatting and validating YAML files. This project | ||
relies on Pydantic and Ruamel libraries. | ||
|
||
**Installation** | ||
```bash | ||
pip install -e yaml_checker | ||
``` | ||
|
||
**Usage** | ||
``` | ||
usage: yaml_checker [-h] [-v] [-w] [--config CONFIG] [files ...] | ||
positional arguments: | ||
files Additional files to process (optional). | ||
options: | ||
-h, --help show this help message and exit | ||
-v, --verbose Enable verbose output. | ||
-w, --write Write yaml output to disk. | ||
--config CONFIG CheckYAML subclass to load | ||
``` | ||
|
||
**Example** | ||
|
||
```bash | ||
# Lets cat a demonstration file for comparison. | ||
$ cat yaml_checker/demo/slice.yaml | ||
# yaml_checker --config=Chisel demo/slice.yaml | ||
|
||
package: grep | ||
|
||
essential: | ||
- grep_copyright | ||
|
||
# hello: world | ||
|
||
slices: | ||
bins: | ||
essential: | ||
- libpcre2-8-0_libs # tests | ||
|
||
# another test | ||
- libc6_libs | ||
contents: | ||
/usr/bin/grep: | ||
|
||
deprecated: | ||
# These are shell scripts requiring a symlink from /usr/bin/dash to | ||
# /usr/bin/sh. | ||
# See: https://manpages.ubuntu.com/manpages/noble/en/man1/grep.1.html | ||
essential: | ||
- dash_bins | ||
- grep_bins | ||
contents: | ||
# we ned this leading comment | ||
/usr/bin/rgrep: # this should be last | ||
|
||
/usr/bin/fgrep: | ||
|
||
# careful with this path ... | ||
/usr/bin/egrep: # it is my favorite | ||
copyright: | ||
contents: | ||
/usr/share/doc/grep/copyright: | ||
# Note: Missing new line at EOF | ||
|
||
# Now we can run the yaml_checker to format the same file. | ||
# Note how comments are preserved during sorting of lists and | ||
# dict type objects. If you want to test the validator, | ||
# uncomment the hello field. | ||
$ yaml_checker --config=Chisel yaml_checker/demo/slice.yaml | ||
# yaml_checker --config=Chisel demo/slice.yaml | ||
|
||
package: grep | ||
|
||
essential: | ||
- grep_copyright | ||
|
||
# hello: world | ||
|
||
slices: | ||
bins: | ||
essential: | ||
- libc6_libs | ||
- libpcre2-8-0_libs # tests | ||
|
||
# another test | ||
contents: | ||
/usr/bin/grep: | ||
|
||
deprecated: | ||
# These are shell scripts requiring a symlink from /usr/bin/dash to | ||
# /usr/bin/sh. | ||
# See: https://manpages.ubuntu.com/manpages/noble/en/man1/grep.1.html | ||
essential: | ||
- dash_bins | ||
- grep_bins | ||
contents: | ||
# we ned this leading comment | ||
|
||
# careful with this path ... | ||
/usr/bin/egrep: # it is my favorite | ||
/usr/bin/fgrep: | ||
/usr/bin/rgrep: # this should be last | ||
copyright: | ||
contents: | ||
/usr/share/doc/grep/copyright: | ||
|
||
``` |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,37 @@ | ||
# python3 -m yaml_checker --config=Chisel demo/factory.yaml | ||
# yaml_checker --config=Chisel demo/slice.yaml | ||
|
||
package: grep | ||
|
||
essential: | ||
- grep_copyright | ||
- grep_copyright | ||
|
||
# hello: world | ||
|
||
slices: | ||
bins: | ||
essential: | ||
- libpcre2-8-0_libs # tests | ||
- libc6_libs | ||
- libpcre2-8-0_libs # tests | ||
|
||
# another test | ||
- libc6_libs | ||
contents: | ||
/usr/bin/grep: | ||
/usr/bin/grep: | ||
|
||
deprecated: | ||
# These are shell scripts requiring a symlink from /usr/bin/dash to | ||
# /usr/bin/sh. | ||
# See: https://manpages.ubuntu.com/manpages/noble/en/man1/grep.1.html | ||
essential: ["dash_bins", "grep_bins"] | ||
essential: | ||
- dash_bins | ||
- grep_bins | ||
contents: | ||
/usr/bin/rgrep: | ||
# we ned this leading comment | ||
/usr/bin/rgrep: # this should be last | ||
|
||
# tests | ||
/usr/bin/fgrep: | ||
|
||
/usr/bin/egrep: # tests1 | ||
|
||
# careful with this path ... | ||
/usr/bin/egrep: # it is my favorite | ||
copyright: | ||
contents: | ||
/usr/share/doc/grep/copyright: | ||
contents: | ||
/usr/share/doc/grep/copyright: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
ruyaml | ||
pytest | ||
pydantic==2.8.2 | ||
ruamel.yaml==0.18.6 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,23 @@ | ||
from pathlib import Path | ||
from setuptools import setup, find_packages | ||
|
||
from setuptools import find_packages, setup | ||
|
||
def read(filename): | ||
|
||
def read_text(filename): | ||
filepath = Path(__file__).parent / filename | ||
file = open(filepath, "r") | ||
return file.read() | ||
return filepath.read_text() | ||
|
||
|
||
setup( | ||
name="yaml_checker", | ||
version="0.1.0", | ||
long_description=read("README.md"), | ||
long_description=read_text("README.md"), | ||
packages=find_packages(), | ||
install_requires=read("requirements.txt"), | ||
install_requires=read_text("requirements.txt"), | ||
entry_points={ | ||
"console_scripts": [ | ||
"yaml_checker=yaml_checker.__main__:main", | ||
"clayaml=yaml_checker.__main__:main", | ||
], | ||
}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.