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

Changed project from flat layout to src layout #22

Merged
merged 2 commits into from
Nov 9, 2024

Conversation

fschuch
Copy link
Owner

@fschuch fschuch commented Nov 9, 2024

The src layout helps to prevent accidental usage of the in-development copy of the code. Please, refer to the following pages for details:

Summary by CodeRabbit

Release Notes

  • New Features

    • Updated testing commands in the README to include coverage reports for better insights.
  • Bug Fixes

    • Corrected repository naming conventions in deployment and CI workflows.
  • Chores

    • Adjusted monitored paths in workflow configurations to reflect new project directory structure.
    • Reorganized project structure to improve management of versioning and templates.

These changes enhance the overall functionality and organization of the project, ensuring a smoother user experience.

Copy link

coderabbitai bot commented Nov 9, 2024

Walkthrough

The pull request introduces several changes across multiple files, primarily focusing on updating directory structures and testing commands. The workflow configuration in .github/workflows/docs.yaml is modified to monitor changes in a new path, while the README.md file updates testing commands and version file locations. The pyproject.toml file reflects changes in paths for coverage and versioning, and the tools/rename_project_content.py script adjusts its logic to accommodate the new directory structure. Overall, these modifications enhance organization and clarity in project management.

Changes

File Change Summary
.github/workflows/docs.yaml Updated pull request trigger path from wizard_template/** to src/wizard_template/**; corrected repository name in deploy job from fschuch/wizard_template to fschuch/wizard-template.
README.md Modified test command to pytest --cov --cov-report=term and updated version file path to src/wizard_template/_version.py.
pyproject.toml Changed paths in [tool.coverage.run] and [tool.hatch.build.hooks.vcs] to reflect new structure; updated script path for _wizard and serve command.
tools/rename_project_content.py Adjusted directory renaming logic to rename src/wizard_template instead of wizard_template.
.github/workflows/ci.yaml Updated pull request trigger path from wizard_template/** to src/wizard_template/**; corrected repository name in release job from wizard_template to wizard-template.

Poem

In the land of code where bunnies play,
Paths have shifted, come what may.
From wizard_template to src we hop,
With tests and coverage, we won't stop!
So let’s celebrate this tidy change,
In our project’s home, all feels less strange! 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 955769b and 7f56be3.

📒 Files selected for processing (2)
  • .github/workflows/ci.yaml (2 hunks)
  • .github/workflows/docs.yaml (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/docs.yaml
🔇 Additional comments (2)
.github/workflows/ci.yaml (2)

90-90: LGTM: Repository name corrected in release condition.

The repository name has been correctly updated to use a hyphen instead of an underscore, matching the actual repository name 'fschuch/wizard-template'.

Let's verify this matches the repository configuration:

#!/bin/bash
# Description: Verify repository name in git config
# Expect: Should show 'fschuch/wizard-template'

git remote -v | grep origin

15-15: LGTM: Path pattern updated for src layout.

The path pattern change correctly reflects the new src layout structure, ensuring CI runs when package files are modified.

Let's verify the package location matches the new path pattern:

✅ Verification successful

Path pattern change correctly reflects package location

The package is indeed located at src/wizard_template/ with Python modules (__init__.py, core.py), which perfectly matches the updated CI trigger pattern src/wizard_template/**. This change ensures proper CI triggering when package files are modified.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the wizard_template package exists in src directory
# Expect: Package directory should exist under src/

fd -t d "wizard_template$" src/

Length of output: 262


Script:

#!/bin/bash
# Let's try a different approach to verify the package location
# First, let's check if the directory exists anywhere in the repository
fd -t d "wizard_template"

# Then, let's check the content structure to understand the layout
ls -R src/ 2>/dev/null || true

# Finally, let's look for Python package files
fd -e py . src/ 2>/dev/null || true

Length of output: 210


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@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: 3

🧹 Outside diff range and nitpick comments (1)
pyproject.toml (1)

92-92: Consider updating script directory name in documentation

The script path has been moved from ./scripts/ to ./tools/. While this change works, ensure this directory rename is documented in your changelog and any contributing guidelines.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between ad6c75b and 955769b.

📒 Files selected for processing (4)
  • .github/workflows/docs.yaml (1 hunks)
  • README.md (2 hunks)
  • pyproject.toml (4 hunks)
  • tools/rename_project_content.py (1 hunks)
🔇 Additional comments (6)
pyproject.toml (4)

47-48: LGTM: Coverage configuration correctly updated for src layout

The source and omit paths have been properly updated to reflect the new src layout structure, which aligns with Python packaging best practices.


79-79: LGTM: Version file path correctly updated

The version file path has been appropriately updated to match the new src layout.


131-131: LGTM: Documentation watch path updated correctly

The sphinx-autobuild watch path has been properly updated to monitor the new src directory structure.


Line range hint 1-131: Verify package discovery settings

The move to src layout typically requires explicit package discovery settings. Let's verify if any additional configuration is needed.

✅ Verification successful

No additional package discovery settings needed

The project is correctly set up with a src layout. Hatch (the build backend) automatically handles src-layout projects without requiring explicit package discovery configuration. The presence of src/wizard_template/__init__.py confirms the correct package structure.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if packages section exists in pyproject.toml
rg '\[tool\.hatch\.build\.targets\.wheel\]' 
rg '\[tool\.hatch\.build\.targets\.sdist\]'
# Check if there's any packages configuration in setup.py/setup.cfg if they exist
fd -e py -e cfg '^setup\.'

Length of output: 120


Script:

#!/bin/bash
# Let's verify the src layout and package structure
fd -t d 'src'
fd -t f -p 'src/**/*.py'

# Check if hatch is properly configured for src layout
rg 'packages\s*=' pyproject.toml
rg 'find\s*=' pyproject.toml
rg '\[tool\.hatch\.build\]' -A 5 pyproject.toml

# Verify if the package is importable
fd -t f '__init__.py' src/

Length of output: 220

README.md (2)

114-134: LGTM: Test output correctly reflects src layout transition

The test output demonstrates successful adaptation to the src layout:

  • Coverage report correctly shows files under src/ directory
  • Test discovery and execution paths are properly updated
  • Coverage reporting is working as expected with 100% coverage

214-214: Verify version file path consistency across project

The version file path update to src/wizard_template/_version.py correctly reflects the src layout transition.

Let's verify the version file path is consistently updated across the project:

✅ Verification successful

Version file path is consistently updated

The version file path src/wizard_template/_version.py is consistently referenced in pyproject.toml both in the coverage omit list and version-file configuration. No outdated references to the old path were found.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining references to the old version file path
# that might have been missed during the transition

# Search for old path references
echo "Checking for old version file path references..."
rg "wizard_template/_version\.py" --type-add 'config:*.{toml,yaml,yml}' -t config

# Search for new path references to confirm updates
echo "Checking for new version file path references..."
rg "src/wizard_template/_version\.py" --type-add 'config:*.{toml,yaml,yml}' -t config

Length of output: 629

.github/workflows/docs.yaml Show resolved Hide resolved
tools/rename_project_content.py Show resolved Hide resolved
@fschuch fschuch merged commit 357c6b8 into main Nov 9, 2024
24 checks passed
@fschuch fschuch deleted the fschuch/move-project-to-src-folder branch November 9, 2024 22:46
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.

1 participant