diff --git a/{{cookiecutter.project_slug}}/CLAUDE.md b/{{cookiecutter.project_slug}}/CLAUDE.md index 8e82838..e5e58bf 100644 --- a/{{cookiecutter.project_slug}}/CLAUDE.md +++ b/{{cookiecutter.project_slug}}/CLAUDE.md @@ -16,7 +16,7 @@ uv sync ### Code Quality - **Linting and formatting**: `uv run ruff check --fix` and `uv run ruff format` - **Type checking**: `uv run mypy .` -- **Combined linting**: `uv run invoke lint` (runs ruff check, ruff format --check, and mypy) +- **Combined linting**: `uv run invoke lint` ### Testing - **Run tests**: `uv run pytest` @@ -26,18 +26,7 @@ uv sync - **Clean untracked files**: `uv run invoke clean` (interactive) - **Version bumping**: `uv run bump-my-version bump [patch|minor|major]` -## Code Architecture - -### Core Components (`src/{{ cookiecutter.package_name }}/core.py`) - -The library implements the main functionality in the core module. Update this section with: - -1. **Key Classes**: Describe main classes and their responsibilities -2. **Core Functions**: Document important functions and their purpose -3. **Data Flow**: Explain how data flows through the system -4. **Dependencies**: List and explain key dependencies - -### Project Structure +## Project Structure ``` src/{{ cookiecutter.package_name }}/ @@ -54,16 +43,7 @@ tests/ ## Development Notes -- Uses Python {{ cookiecutter.python_version }}+ with modern type hints (PEP 604) +- Uses Python {{ cookiecutter.python_version }}+ with modern type hints - Configured with ruff for linting/formatting and mypy for type checking - Built with uv for dependency management -- Includes invoke tasks for common operations -- Version {{ cookiecutter.version }} ({{ cookiecutter.year }}) - -## Implementation Guidelines - -- Follow test-driven development practices -- Use descriptive function names and one-liner docstrings for non-trivial functions -- Keep files between 300–500 lines where possible -- Don't duplicate code; build upon existing implementations -- Always use type hints as supported by Python {{ cookiecutter.python_version }}+ \ No newline at end of file +- Includes invoke tasks for common operations \ No newline at end of file diff --git a/{{cookiecutter.project_slug}}/README.md b/{{cookiecutter.project_slug}}/README.md index 7d4dfd5..19c034b 100644 --- a/{{cookiecutter.project_slug}}/README.md +++ b/{{cookiecutter.project_slug}}/README.md @@ -45,9 +45,10 @@ uv run pytest ## Usage ```python -from {{ cookiecutter.package_name }} import hello +from {{ cookiecutter.package_name }}.core import say_hello -print(hello()) +say_hello() # prints: Hello, World! +say_hello("Alice") # prints: Hello, Alice! ``` ## License diff --git a/{{cookiecutter.project_slug}}/examples/basic_usage.py b/{{cookiecutter.project_slug}}/examples/basic_usage.py index d111476..260e91a 100644 --- a/{{cookiecutter.project_slug}}/examples/basic_usage.py +++ b/{{cookiecutter.project_slug}}/examples/basic_usage.py @@ -1,21 +1,15 @@ """Basic usage example for {{ cookiecutter.project_name }}.""" -from {{ cookiecutter.package_name }} import hello -from {{ cookiecutter.package_name }}.core import process_data, {{ cookiecutter.project_name.replace(' ', '').replace('-', '') }} +from {{ cookiecutter.package_name }}.core import say_hello def main(): """Demonstrate basic usage.""" # Basic hello - print(hello()) - - # Process some data - result = process_data("example data") - print(result) - - # Use main class - instance = {{ cookiecutter.project_name.replace(' ', '').replace('-', '') }}("example") - print(instance.run()) + say_hello() + + # Hello with a name + say_hello("{{ cookiecutter.project_name }}") if __name__ == "__main__": diff --git a/{{cookiecutter.project_slug}}/src/{{cookiecutter.package_name}}/__init__.py b/{{cookiecutter.project_slug}}/src/{{cookiecutter.package_name}}/__init__.py index edc0ab2..a37e042 100644 --- a/{{cookiecutter.project_slug}}/src/{{cookiecutter.package_name}}/__init__.py +++ b/{{cookiecutter.project_slug}}/src/{{cookiecutter.package_name}}/__init__.py @@ -1,8 +1,3 @@ """{{ cookiecutter.project_name }} - {{ cookiecutter.description }}""" -__version__ = "{{ cookiecutter.version }}" - - -def hello() -> str: - """Return a hello message.""" - return "Hello from {{ cookiecutter.project_name }}!" \ No newline at end of file +__version__ = "{{ cookiecutter.version }}" \ No newline at end of file diff --git a/{{cookiecutter.project_slug}}/src/{{cookiecutter.package_name}}/core.py b/{{cookiecutter.project_slug}}/src/{{cookiecutter.package_name}}/core.py index 4b2aeea..12bf740 100644 --- a/{{cookiecutter.project_slug}}/src/{{cookiecutter.package_name}}/core.py +++ b/{{cookiecutter.project_slug}}/src/{{cookiecutter.package_name}}/core.py @@ -1,17 +1,6 @@ """Core functionality for {{ cookiecutter.project_name }}.""" -def process_data(data: str) -> str: - """Process input data and return result.""" - return f"Processed: {data}" - - -class {{ cookiecutter.project_name.replace(' ', '').replace('-', '') }}: - """Main class for {{ cookiecutter.project_name }}.""" - - def __init__(self, name: str = "default") -> None: - self.name = name - - def run(self) -> str: - """Run the main functionality.""" - return f"Running {{ cookiecutter.project_name }} with {self.name}" \ No newline at end of file +def say_hello(name: str = "World") -> None: + """Print a hello message.""" + print(f"Hello, {name}!") \ No newline at end of file diff --git a/{{cookiecutter.project_slug}}/tests/test_{{cookiecutter.package_name}}.py b/{{cookiecutter.project_slug}}/tests/test_{{cookiecutter.package_name}}.py index 0d302e5..3499afb 100644 --- a/{{cookiecutter.project_slug}}/tests/test_{{cookiecutter.package_name}}.py +++ b/{{cookiecutter.project_slug}}/tests/test_{{cookiecutter.package_name}}.py @@ -1,25 +1,24 @@ """Tests for {{ cookiecutter.package_name }}.""" -import pytest +from io import StringIO +import sys -from {{ cookiecutter.package_name }} import hello -from {{ cookiecutter.package_name }}.core import process_data, {{ cookiecutter.project_name.replace(' ', '').replace('-', '') }} +from {{ cookiecutter.package_name }}.core import say_hello -def test_hello(): - """Test hello function.""" - result = hello() - assert "Hello from {{ cookiecutter.project_name }}" in result +def test_say_hello(): + """Test say_hello function.""" + captured_output = StringIO() + sys.stdout = captured_output + say_hello() + sys.stdout = sys.__stdout__ + assert captured_output.getvalue() == "Hello, World!\n" -def test_process_data(): - """Test process_data function.""" - result = process_data("test") - assert result == "Processed: test" - - -def test_main_class(): - """Test main class.""" - instance = {{ cookiecutter.project_name.replace(' ', '').replace('-', '') }}("test") - result = instance.run() - assert "Running {{ cookiecutter.project_name }} with test" in result \ No newline at end of file +def test_say_hello_with_name(): + """Test say_hello function with custom name.""" + captured_output = StringIO() + sys.stdout = captured_output + say_hello("Alice") + sys.stdout = sys.__stdout__ + assert captured_output.getvalue() == "Hello, Alice!\n" \ No newline at end of file