Skip to main content

Interactive Python exercises with Ruff linting - Learn Python by fixing code!

Project description

Snakers 🐍

Interactive Python exercises with Ruff linting - Learn Python by fixing and completing code!

Installation

# Clone the repository
git clone <your-repo-url>
cd snakers

# Install dependencies
pip install -e .

Usage

Initialize the exercises

# Create exercises directory and files in current directory
snakers init

# Create in a specific directory
snakers init --target /path/to/directory

Run the next exercise

# If installed via pip
snakers run

# Or using the module
python -m snakers run

Run a specific exercise

snakers run 01_variables/01_basic_types

Watch mode (auto-check on file changes)

snakers watch

List all exercises

snakers list

Reset progress

snakers reset

Manage solutions

# List all saved solutions
snakers solutions list

# View a specific solution
snakers solutions show 01_basic_types

# Reset all solutions
snakers solutions reset

Get help

# General help
snakers help

# Topic-specific help
snakers help init
snakers help solutions

Exercise Structure

Exercises are organized in the exercises/ directory by topic:

  • 00_intro/ - Introduction and environment setup
  • 01_variables/ - Variables, types, basic operations
  • 02_collections/ - Lists, dictionaries, tuples, sets
  • 03_functions/ - Function definitions, parameters, returns
  • 04_control_flow/ - Conditionals, loops, flow control
  • 05_exceptions/ - Error handling and exceptions
  • 06_classes/ - Object-oriented programming
  • 07_functional/ - Functional programming concepts
  • 08_file_io/ - File operations and data formats
  • 09_modules_packages/ - Imports, packages, modules
  • 10_advanced/ - Decorators, generators, advanced concepts
  • 11_testing/ - Unit testing and test-driven development
  • 12_concurrency/ - Threading, multiprocessing, async programming
  • 13_data/ - Data processing and analysis
  • 14_web/ - HTTP clients and web programming
  • 15_stdlib/ - Standard library modules
  • 16_project_management/ - Virtual environments, packaging, project structure
  • 17_design_patterns/ - Common design patterns
  • 18_regex/ - Regular expressions

Each exercise file contains:

  • Learning objectives
  • TODO items to complete
  • Hints and tips
  • Test cases

How It Works

  1. Find TODOs: Each exercise has # TODO comments marking what you need to implement
  2. Fix the code: Replace TODOs with working Python code
  3. Pass Ruff checks: Your code must pass Ruff linting (style, formatting, basic errors)
  4. Run successfully: The exercise file must execute without runtime errors
  5. Progress tracking: Completed exercises are automatically tracked

Ruff Configuration

Snakers uses Ruff for:

  • Code formatting
  • Style checking (PEP 8)
  • Error detection
  • Import sorting
  • Modern Python practices

Contributing

  1. Fork the repository
  2. Add new exercises in the appropriate topic directory
  3. Follow the existing exercise format
  4. Test your exercises
  5. Submit a pull request

Exercise Template

"""
Exercise N: Title

Description of what the student will learn.

Tasks:
1. Task description
2. Another task

Hints:
- Helpful hint
- Another hint
"""

# TODO: Implementation task

def example_function():
    # TODO: Implement this function
    pass

if __name__ == "__main__":
    # Test code here
    pass

Happy coding! 🐍✨

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

snakers-0.1.0.tar.gz (74.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

snakers-0.1.0-py3-none-any.whl (102.5 kB view details)

Uploaded Python 3

File details

Details for the file snakers-0.1.0.tar.gz.

File metadata

  • Download URL: snakers-0.1.0.tar.gz
  • Upload date:
  • Size: 74.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for snakers-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f1c9f0e615b6491d47315d341c8f24e18e8f3fb6e0c6775b800b888b3074d92f
MD5 c2298b46e48a4296047c8091b68de5f0
BLAKE2b-256 0be1e6ca6b1002c55baf747055773b4f352f62e10a2c9e9a9d5f9235d154c593

See more details on using hashes here.

File details

Details for the file snakers-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: snakers-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 102.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for snakers-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1259460c403104e99786c158f31b1f15b26c9edd6d2e1095b400fe80d7dad5e7
MD5 004c442b08fffd07aeec83fd21fccde8
BLAKE2b-256 4f44a87bd7378e9b6360265da5299c0ffc735ce36d0e142d0f1c33d575effab6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page