Skip to content

python package starter project template#1

Merged
PranavU-Coder merged 2 commits into
masterfrom
python-pkg
May 18, 2026
Merged

python package starter project template#1
PranavU-Coder merged 2 commits into
masterfrom
python-pkg

Conversation

@PranavU-Coder
Copy link
Copy Markdown
Owner

@PranavU-Coder PranavU-Coder commented May 18, 2026

Please describe the changes this PR makes and why it should be merged:
Status and versioning classification:

  • Code changes have been tested locally
  • All tests have been rightfully passed
  • This PR includes non-code changes like changes to documentation, README, etc.

Summary by CodeRabbit

  • New Features

    • Added pyplatez init CLI command to scaffold new projects with customizable names and paths.
    • Added automated GitHub Actions workflow for publishing releases.
  • Chores

    • Updated project configuration, metadata, and build tooling.
    • Updated development dependencies (pytest, ruff, twine).
    • Enhanced documentation with updated directory structure.

Review Change Stack

@PranavU-Coder PranavU-Coder self-assigned this May 18, 2026
@PranavU-Coder PranavU-Coder added the enhancement New feature or request label May 18, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 18, 2026

Warning

Rate limit exceeded

@PranavU-Coder has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 20 minutes and 39 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 28152bf6-1446-4ebe-9d87-d37b707ed982

📥 Commits

Reviewing files that changed from the base of the PR and between 0a856e6 and e6247d2.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (3)
  • hatch_build.py
  • pyproject.toml
  • src/pyplatez/cli.py
📝 Walkthrough

Walkthrough

This PR implements a complete project scaffolding system for PyPlatez. It adds a CLI command (pyplatez init <name>) that creates new projects from bundled templates, automates template packaging via a Hatch build hook, updates project metadata and dependencies, and adds CI/CD automation to build and release the tool as a GitHub Release when tags are pushed.

Changes

Project Scaffolding and Release

Layer / File(s) Summary
CLI interface and project scaffolding
src/pyplatez/cli.py
Implements main() with argparse for pyplatez init <name> [--path] and scaffold() to copy templates, rename the package, and update pyproject.toml metadata.
Build hook and packaging configuration
hatch_build.py, pyproject.toml
BuildHook forces root files into pyplatez/templates/ during wheel builds. pyproject.toml adds the CLI script entry point, updates dev dependencies to pytest, ruff, twine, and configures Hatch wheel building with the custom hook.
Release automation and documentation
.github/workflows/build.yml, .gitignore, README.md
GitHub Actions workflow builds and publishes releases on version tags. .gitignore excludes .nox/ and src/pyplatez/templates/. README.md documents the new CLI module and hatch_build.py.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Templates bundled, CLI ready to go,
Init creates projects faster, you know!
Build hooks and workflows dancing in sync,
PyPlatez scaffolds with just one link. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main changes: establishing a Python package starter template with scaffolding, CLI initialization, and release workflows.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch python-pkg

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (1)
hatch_build.py (1)

18-23: ⚡ Quick win

Make template inclusion deterministic.

Iterating root.iterdir() unsorted can produce non-reproducible wheel contents across environments. Sort by name before populating force_include.

Proposed fix
-        for item in root.iterdir():
+        for item in sorted(root.iterdir(), key=lambda p: p.name):
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@hatch_build.py` around lines 18 - 23, The template inclusion loop is
nondeterministic because it iterates root.iterdir() unsorted; change the loop
that builds force_include (the for over root.iterdir(), with checks against
EXCLUDE and creation of dest and force_include[str(item)] = dest) to iterate
items sorted by name (e.g., sort by item.name) so entries are added in a stable
order and wheel contents become reproducible.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@hatch_build.py`:
- Around line 1-25: The file fails CI due to formatting; run the project's
formatter (ruff format) or apply the same style changes to satisfy ruff so the
file is reformatted. Open the BuildHook class and its initialize method
(symbols: BuildHook, initialize, EXCLUDE, force_include) and reformat
spacing/indentation and trailing whitespace, fix the inline comment style and
alignment around assignments and control blocks to match the project's ruff
configuration, then re-run ruff format until no changes are reported and commit
the formatted hatch_build.py.

In `@src/pyplatez/cli.py`:
- Around line 1-54: The file fails CI due to formatting; run the project's
formatter (ruff format or configured formatter) on this file to reformat
imports, spacing and line breaks so it matches the repo style, then re-run
tests; focus your changes around the scaffold and main functions and any
top-level imports to ensure ruff no-longer flags "ruff format would reformat
this file".
- Around line 47-49: The code currently calls target.iterdir() which raises
NotADirectoryError if --path points to a file; update the check in
src/pyplatez/cli.py to first test target.exists() and target.is_dir() (or
!target.is_dir()) before calling target.iterdir(): if target.exists() and not
target.is_dir(), print a clear error about the path being a file and exit;
otherwise, if target.is_dir() and any(target.iterdir()), keep the existing
"already exists and is not empty" behavior. Ensure you use the same target,
is_dir(), and iterdir() symbols so the fix is easy to locate.
- Around line 40-52: Validate and/or normalize the provided project name before
using it to create the package directory: in the CLI flow handling args.command
== "init" (where args.name, target, scaffold(...) and target.mkdir(...) are
used) check that args.name is a valid Python identifier and not a reserved
keyword (use str.isidentifier() and keyword.iskeyword()) and reject with a clear
stderr message and non-zero exit if invalid; alternatively implement a
normalization step (e.g., replace hyphens with underscores, strip/replace path
separators, ensure it doesn't start with a digit) and use the normalized name
for the package directory while preserving the original project display name.
Ensure this validation/normalization occurs before constructing target and
calling scaffold.

---

Nitpick comments:
In `@hatch_build.py`:
- Around line 18-23: The template inclusion loop is nondeterministic because it
iterates root.iterdir() unsorted; change the loop that builds force_include (the
for over root.iterdir(), with checks against EXCLUDE and creation of dest and
force_include[str(item)] = dest) to iterate items sorted by name (e.g., sort by
item.name) so entries are added in a stable order and wheel contents become
reproducible.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fb3df6a2-2a97-429d-91dc-1acd10e26dc4

📥 Commits

Reviewing files that changed from the base of the PR and between ee87ee5 and 0a856e6.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (6)
  • .github/workflows/build.yml
  • .gitignore
  • README.md
  • hatch_build.py
  • pyproject.toml
  • src/pyplatez/cli.py

Comment thread hatch_build.py Outdated
Comment thread src/pyplatez/cli.py Outdated
Comment thread src/pyplatez/cli.py Outdated
Comment thread src/pyplatez/cli.py Outdated
@PranavU-Coder PranavU-Coder merged commit 0060599 into master May 18, 2026
2 checks passed
@PranavU-Coder PranavU-Coder deleted the python-pkg branch May 18, 2026 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant