Skip to content

dimanu-py/python-code-katas

Repository files navigation

🐍 Python Code Katas 🐍

Note

All the code katas are solved using Python. Most of the katas are configured in a similar way, using uv as package manager and python 3.12. Those katas that need extra or different configurations will have its specific instructions in the README file.

Python

Standard Configuration

The project can be configured either by using pip or pyenv. Both ways will be explained.

Using pip
  1. Create a virtual environment:
    python -m venv .venv
  2. Activate the virtual environment:
    source .venv/bin/activate # Linux / Mac
    .venv\Scripts\activate # Windows
  3. Install the dependencies:
    pip install -r requirements.txt
Using pyenv and uv

These instructions are extracted from pyenv documentation. You can find everything here

  1. Install pyenv:

    curl https://pyenv.run | bash
  2. Set you bash profile to load pyenv. In my case I use fish:

    set -Ux PYENV_ROOT $HOME/.pyenv
    fish_add_path $PYENV_ROOT/bin
    
    echo pyenv init - | source >> ~/.config/fish/config.fish
  3. Select the python version you want to use:

    pyenv install 3.12
    pyenv local 3.12
  4. Install the dependencies:

    pip install uv
    uv sync --all-groups

Running the tests

To run the tests, execute one of the following commands:

pytest

or

uv run pytest kata_name/tests

Note

I tend to use a Makefile to store the most common commands. You can check the Makefile in the root of the project.

Katas

Visit my GitHub profile for more projects 🚀

Web

About

Definition and solution for Python Katas

Topics

Resources

Stars

Watchers

Forks