Skip to content

Switch packaging to hatchling, add scan CLI, optional extras, and include policy assets#7

Merged
Jeffrin-dev merged 1 commit intomainfrom
codex/update-pyproject.toml-for-shadowaudit-package
Mar 28, 2026
Merged

Switch packaging to hatchling, add scan CLI, optional extras, and include policy assets#7
Jeffrin-dev merged 1 commit intomainfrom
codex/update-pyproject.toml-for-shadowaudit-package

Conversation

@Jeffrin-dev
Copy link
Copy Markdown
Owner

Motivation

  • Use a modern build backend by switching the project to Hatchling and reduce core install size by moving heavy libraries to optional extras.
  • Ensure the package exposes the shadowaudit console script and provide a simple CLI scan subcommand to allow ad-hoc PII scans without loading optional heavyweight deps.
  • Include the policy YAMLs in source distributions so policies/* are packaged and available at install time.

Description

  • Added a [build-system] section to pyproject.toml to use hatchling and moved non-essential libraries into [project.optional-dependencies] groups ner and siem, while keeping minimal dependencies in the core install.
  • Registered the console script shadowaudit = "shadowaudit.cli:main" in pyproject.toml and preserved CLI behavior for policy check, report, and proxy.
  • Extended shadowaudit/cli.py with a scan subcommand that uses PIIScanner and prints JSON output, and updated serialization to fall back to dataclasses.asdict when model_dump is not available.
  • Added MANIFEST.in to include policies/gdpr.yaml, policies/hipaa.yaml, and policies/pci_dss.yaml in source distributions and added tests/test_cli_scan.py to cover the new scan command.

Testing

  • Ran pytest tests/test_cli_policy_check.py tests/test_cli_proxy.py tests/test_cli_report.py tests/test_cli_scan.py and all included tests passed (5 passed).
  • Ran pytest for the full suite which showed two existing unrelated failures in tests/test_policy_and_secrets.py (these are from an external detect-secrets API mismatch and were not caused by these changes).
  • Executed the CLI smoke flows python -m shadowaudit.cli scan "Reach me at alice@example.com", python -m shadowaudit.cli policy check policies/gdpr.yaml, and python -m shadowaudit.cli report --format gdpr --from 2026-01-01 --to 2026-01-31, all of which produced expected output.
  • Attempted python -m pip install -e . but the build step failed in this environment because hatchling could not be downloaded due to network/proxy restrictions, and pytest --cov=... --cov-fail-under=80 could not be run because pytest-cov is not installed in the current environment.

Codex Task

@Jeffrin-dev Jeffrin-dev merged commit 45fb49e into main Mar 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant