Skip to content

Library packaging: import as babel_validation + split runtime/dev deps#95

Open
gaurav wants to merge 2 commits into
add-github-issue-testsfrom
library-packaging
Open

Library packaging: import as babel_validation + split runtime/dev deps#95
gaurav wants to merge 2 commits into
add-github-issue-testsfrom
library-packaging

Conversation

@gaurav

@gaurav gaurav commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #67 (base branch is add-github-issue-tests, not main). This is the first of two follow-up PRs that make the GitHub-issue test framework usable as an installable library; see #67 for how they relate.

This PR is the packaging groundwork — no behavior change.

Changes

  • Rename the import package src.babel_validationbabel_validation (40 references across 17 files; purely mechanical). Filesystem paths (src/babel_validation/... in comments/docs) are unchanged — the code still lives under src/.
  • Ship src/babel_validation as the top-level wheel package (was the whole src/ dir), so consumers import babel_validation rather than the non-idiomatic src. prefix (which could also collide with a consumer's own top-level src/). Drops the now-dead src/__init__.py.
  • Repoint the csv-to-babeltests console script at babel_validation.tools.*.
  • Split dependencies: keep only runtime deps (requests, pyyaml, pygithub, python-dotenv, click, tqdm, filelock) in [project.dependencies] so library consumers don't pull the test stack. Move pytest/pytest-xdist/pytest-subtests/pytest-timeout/deepdiff/openapi-spec-validator/black into a uv [dependency-groups] dev group — uv run/uv sync install it for local dev + CI, but it is never shipped to consumers.

PyGitHub stays a core dependency: issue-test definitions live in GitHub issues, so every consumer needs it to fetch them.

Verification

  • uv run pytest -m unit → green (49 passed).
  • uv build produces a wheel whose only top-level entry is babel_validation (no src/); import babel_validation works; import src.babel_validation no longer resolves from an install.

🤖 Generated with Claude Code

gaurav and others added 2 commits June 24, 2026 11:34
Mechanical rename of every dotted module reference (imports, `python -m`
commands, and doc strings) from `src.babel_validation` to `babel_validation`,
so consumers import the library as `babel_validation` rather than the
non-idiomatic `src.` prefix. Filesystem paths (`src/babel_validation/...` in
comments/docs) are unchanged; the code still lives under src/.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Ship src/babel_validation as the top-level wheel package (was the whole
  src/ dir), and drop the now-dead src/__init__.py.
- Point the csv-to-babeltests script at babel_validation.tools.*.
- Keep only runtime deps (requests, pyyaml, pygithub, python-dotenv, click,
  tqdm, filelock) in [project.dependencies] so library consumers don't pull
  the test stack. Move pytest/xdist/subtests/timeout/deepdiff/
  openapi-spec-validator/black into a uv [dependency-groups] dev group, which
  `uv run`/`uv sync` install for local dev + CI but never ships to consumers.

PyGitHub stays a core dependency: issue-test definitions live in GitHub
issues, so every consumer needs it to fetch them.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Packaging-focused change to make src/babel_validation install as the canonical import package babel_validation (dropping the src. import prefix), while separating runtime dependencies from development/testing dependencies.

Changes:

  • Renames imports across tests and library code from src.babel_validation.* to babel_validation.*, and updates doc regeneration commands accordingly.
  • Adjusts wheel packaging to ship only src/babel_validation as the top-level wheel package and repoints the csv-to-babeltests console script.
  • Splits runtime vs dev dependencies using uv dependency groups and updates uv.lock to reflect the split.

Reviewed changes

Copilot reviewed 20 out of 22 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
uv.lock Moves pytest/formatting/validation tools into a dev dependency group in the lockfile metadata.
pyproject.toml Updates runtime deps vs dev dependency group, repoints console script, and changes hatch wheel packaging to ship babel_validation as the top-level package.
src/init.py Removes the now-dead src package marker to prevent import src... after install.
src/babel_validation/tools/csv_to_babeltests.py Updates internal imports to use the new babel_validation.* package path.
src/babel_validation/sources/google_sheets/google_sheet_test_cases.py Updates TestRow import to the new babel_validation.* path.
src/babel_validation/sources/github/github_issues_test_cases.py Updates service/assertion imports to the new babel_validation.* path.
src/babel_validation/assertions/init.py Updates internal imports and regeneration instructions to babel_validation.*.
src/babel_validation/assertions/common.py Updates base-class import to babel_validation.assertions.
src/babel_validation/assertions/gen_docs.py Updates module invocation instructions and imports to babel_validation.*.
src/babel_validation/assertions/nodenorm.py Updates imports to babel_validation.*.
src/babel_validation/assertions/nameres.py Updates imports to babel_validation.*.
src/babel_validation/assertions/README.md Updates auto-generated regeneration commands to babel_validation.*.
tests/tools/test_csv_to_babeltests.py Updates imports to babel_validation.* (including handler registry import).
tests/test_environment/test_env.py Updates imports to babel_validation.*.
tests/test_environment/test_assertions_docs.py Updates imports and regeneration instruction string to babel_validation.*.
tests/nodenorm/test_nodenorm_from_gsheet.py Updates imports to babel_validation.*.
tests/nameres/test_nameres_from_gsheet.py Updates imports to babel_validation.*.
tests/nameres/test_blocklist.py Updates imports to babel_validation.*.
tests/github_issues/test_system.py Updates imports to babel_validation.*.
tests/github_issues/test_github_issues.py Updates imports to babel_validation.*.
tests/github_issues/conftest.py Updates imports to babel_validation.*.
CLAUDE.md Updates contributor guidance examples to use babel_validation.* imports.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pyproject.toml
Comment on lines 12 to 16
dependencies = [
"black>=25.9.0",
"click>=8.1",
"pyyaml>=6.0",
"requests>=2.32.5",
"tqdm>=4.67.1",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants