Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support 3.13, add [ruamel] optional package dep #259

Merged
merged 1 commit into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.12"]
python-version: ["3.8", "3.13"]

steps:
- uses: actions/checkout@v2
Expand Down
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
version=version,
url="https://github.com/23andMe/Yamale",
author="Bo Lopker",
author_email="blopker@23andme.com",
author_email="dev-api@23andme.com",
description="A schema and validator for YAML.",
long_description=readme,
long_description_content_type="text/markdown",
license="MIT",
packages=find_packages(),
include_package_data=True,
install_requires=["pyyaml"],
extras_requires={"ruamel": ["ruamel.yaml"]},
python_requires=">=3.8",
entry_points={
"console_scripts": ["yamale=yamale.command_line:main"],
Expand All @@ -34,5 +35,6 @@
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
],
)
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[tox]
envlist = py38, py310
envlist = py38, py313

[gh-actions]
python =
3.8: py38
3.12: py312
3.13: py313

[testenv]
commands = py.test --cov yamale --cov-report term-missing yamale
Expand Down
2 changes: 1 addition & 1 deletion yamale/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.2.1
5.3.0
6 changes: 5 additions & 1 deletion yamale/command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ def _router(paths, schema_name, cpus, parser, strict=True):
def main():
parser = argparse.ArgumentParser(description="Validate yaml files.")
parser.add_argument(
"paths", metavar="PATHS", default=["./"], nargs="*", help="Paths to validate, either directories or files. Default is the current directory."
"paths",
metavar="PATH",
default=["./"],
nargs="*",
help="Paths to validate, either directories or files. Default is the current directory.",
)
parser.add_argument("-V", "--version", action="version", version=__version__)
parser.add_argument("-s", "--schema", default="schema.yaml", help="filename of schema. Default is schema.yaml.")
Expand Down
26 changes: 18 additions & 8 deletions yamale/tests/test_command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,28 @@ def test_good_yaml(parser):


def test_multiple_paths_good_yaml():
command_line._router([
"yamale/tests/command_line_fixtures/yamls/good.yaml",
"yamale/tests/command_line_fixtures/yamls/good2.yaml",
], "schema.yaml", 1, "PyYAML")
command_line._router(
[
"yamale/tests/command_line_fixtures/yamls/good.yaml",
"yamale/tests/command_line_fixtures/yamls/good2.yaml",
],
"schema.yaml",
1,
"PyYAML",
)


def test_multiple_paths_bad_yaml():
with pytest.raises(ValueError) as e:
command_line._router([
"yamale/tests/command_line_fixtures/yamls/good.yaml",
"yamale/tests/command_line_fixtures/yamls/bad.yaml",
], "schema.yaml", 1, "PyYAML")
command_line._router(
[
"yamale/tests/command_line_fixtures/yamls/good.yaml",
"yamale/tests/command_line_fixtures/yamls/bad.yaml",
],
"schema.yaml",
1,
"PyYAML",
)
assert "map.bad: '12.5' is not a int." in e.value.message


Expand Down
4 changes: 3 additions & 1 deletion yamale/validators/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,9 @@ def __init__(self, *args, **kwargs):
super(SemVer, self).__init__(*args, **kwargs)
self.regexes = [
# https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
re.compile(r"^(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:-(?P<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$"),
re.compile(
r"^(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:-(?P<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$"
),
]


Expand Down
Loading