nac-validate 2.0.0b2__tar.gz → 2.0.0b3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/PKG-INFO +1 -1
  2. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/nac_validate/validator.py +18 -8
  3. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/pyproject.toml +1 -1
  4. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/uv.lock +1 -1
  5. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/.github/dependabot.yml +0 -0
  6. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/.github/workflows/release.yml +0 -0
  7. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/.github/workflows/test.yml +0 -0
  8. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/.gitignore +0 -0
  9. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/.pre-commit-config.yaml +0 -0
  10. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/.pre-commit-hooks.yaml +0 -0
  11. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/CHANGELOG.md +0 -0
  12. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/LICENSE +0 -0
  13. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/README.md +0 -0
  14. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/nac_validate/__init__.py +0 -0
  15. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/nac_validate/__main__.py +0 -0
  16. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/nac_validate/cli/__init__.py +0 -0
  17. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/nac_validate/cli/main.py +0 -0
  18. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/nac_validate/cli/options.py +0 -0
  19. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/nac_validate/constants.py +0 -0
  20. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/nac_validate/exceptions.py +0 -0
  21. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/nac_validate/models.py +0 -0
  22. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/nac_validate/output_formatter.py +0 -0
  23. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/scripts/license-headers.sh +0 -0
  24. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/__init__.py +0 -0
  25. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/__init__.py +0 -0
  26. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/additional_data/data.yaml +0 -0
  27. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/additional_data_schema/schema.yaml +0 -0
  28. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/data/data.yaml +0 -0
  29. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/data_empty/data.yaml +0 -0
  30. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/data_empty/empty.yaml +0 -0
  31. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/data_env/data.yaml +0 -0
  32. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/data_merge/file1.yaml +0 -0
  33. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/data_merge/file2.yaml +0 -0
  34. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/data_merge/result.yaml +0 -0
  35. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/data_non_strict/data.yaml +0 -0
  36. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/data_semantic_error/data.yaml +0 -0
  37. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/data_syntax_error/data.yaml +0 -0
  38. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/data_vault/data.yaml +0 -0
  39. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/rules/rule_101.py +0 -0
  40. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/rules_schema/rule_101.py +0 -0
  41. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/schema/schema.yaml +0 -0
  42. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/test_integration.py +0 -0
  43. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/unit/__init__.py +0 -0
  44. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/unit/test_cli.py +0 -0
  45. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/unit/test_output_formatter.py +0 -0
  46. {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/unit/test_validator.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nac-validate
3
- Version: 2.0.0b2
3
+ Version: 2.0.0b3
4
4
  Summary: A CLI tool to perform syntactic and semantic validation of YAML files.
5
5
  Project-URL: homepage, https://github.com/netascode/nac-validate
6
6
  Project-URL: repository, https://github.com/netascode/nac-validate
@@ -5,6 +5,7 @@ import importlib.util
5
5
  import logging
6
6
  import sys
7
7
  import warnings
8
+ from collections.abc import Sequence
8
9
  from inspect import signature
9
10
  from pathlib import Path
10
11
  from typing import Any
@@ -183,7 +184,9 @@ class Validator:
183
184
  """
184
185
  self.data = data
185
186
 
186
- def _load_data_from_paths(self, input_paths: list[Path]) -> dict[str, Any]:
187
+ def _load_data_from_paths(
188
+ self, input_paths: Sequence[Path | str]
189
+ ) -> dict[str, Any]:
187
190
  """Load and merge YAML data from file system paths.
188
191
 
189
192
  Args:
@@ -192,6 +195,7 @@ class Validator:
192
195
  Returns:
193
196
  Merged YAML data dictionary
194
197
  """
198
+ input_paths = [Path(p) for p in input_paths]
195
199
  logger.info("Loading yaml files from %s", input_paths)
196
200
  self.data = load_yaml_files(input_paths)
197
201
  return self.data
@@ -298,11 +302,14 @@ class Validator:
298
302
 
299
303
  def validate_syntax(
300
304
  self,
301
- input_paths: list[Path] | None = None,
305
+ input_paths: Sequence[Path | str] | None = None,
302
306
  strict: bool = True,
303
307
  rich_output: bool = True,
304
308
  ) -> None:
305
309
  """Run syntactic validation"""
310
+ resolved_paths: list[Path] | None = (
311
+ [Path(p) for p in input_paths] if input_paths is not None else None
312
+ )
306
313
  self.errors.clear()
307
314
  self.structured_syntax_errors.clear()
308
315
  self.file_count = 0
@@ -310,8 +317,8 @@ class Validator:
310
317
  if self.data is not None:
311
318
  if self.schema is not None:
312
319
  source = (
313
- str(input_paths[0])
314
- if input_paths and len(input_paths) > 0
320
+ str(resolved_paths[0])
321
+ if resolved_paths and len(resolved_paths) > 0
315
322
  else "<pre-loaded>"
316
323
  )
317
324
  try:
@@ -341,9 +348,9 @@ class Validator:
341
348
  )
342
349
  )
343
350
  else:
344
- if not input_paths:
351
+ if not resolved_paths:
345
352
  return
346
- for input_path in input_paths:
353
+ for input_path in resolved_paths:
347
354
  if input_path.is_file():
348
355
  self._validate_syntax_file(input_path, strict)
349
356
  if input_path.suffix in YAML_SUFFIXES:
@@ -387,7 +394,10 @@ class Validator:
387
394
  return self._get_violation_count(result) > 0
388
395
 
389
396
  def validate_semantics(
390
- self, input_paths: list[Path], rich_output: bool = True, compact: bool = False
397
+ self,
398
+ input_paths: Sequence[Path | str],
399
+ rich_output: bool = True,
400
+ compact: bool = False,
391
401
  ) -> None:
392
402
  """Run semantic validation"""
393
403
  if not self.rules:
@@ -468,7 +478,7 @@ class Validator:
468
478
  file=sys.stderr,
469
479
  )
470
480
 
471
- def write_output(self, input_paths: list[Path], path: Path) -> None:
481
+ def write_output(self, input_paths: Sequence[Path | str], path: Path) -> None:
472
482
  """Write loaded YAML data to output file."""
473
483
  if self.data is None:
474
484
  self._load_data_from_paths(input_paths)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "nac-validate"
3
- version = "2.0.0b2"
3
+ version = "2.0.0b3"
4
4
  description = "A CLI tool to perform syntactic and semantic validation of YAML files."
5
5
  license = { text = "MPL-2.0" }
6
6
  readme = "README.md"
@@ -755,7 +755,7 @@ wheels = [
755
755
 
756
756
  [[package]]
757
757
  name = "nac-validate"
758
- version = "2.0.0b2"
758
+ version = "2.0.0b3"
759
759
  source = { editable = "." }
760
760
  dependencies = [
761
761
  { name = "jmespath" },
File without changes
File without changes