Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ dumps/
__pycache__
.env
.venv/
.python-version

.pipenv-sync-date
.cache/
.ruff_cache/
.coverage
.pytest_cache
.hypothesis/
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.13
56 changes: 17 additions & 39 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,44 +1,22 @@
PIPENV = PIPENV_IGNORE_VIRTUALENVS=1 pipenv
PIPENV_SAFE_RUN = PIPENV_DONT_LOAD_ENV=1 $(PIPENV) run
.DEFAULT_GOAL := help
.PHONY: setup tests lint clean

.PHONY: help
help: ## Show this help
@grep -E '^\S+:.*?## .*$$' $(firstword $(MAKEFILE_LIST)) | \
awk 'BEGIN {FS = ":.*?## "}; {printf "%-30s %s\n", $$1, $$2}'
setup:
uv sync
Comment on lines +1 to +4

.PHONY: setup
setup: .venv/lib ## Install virtualenv dependencies
@echo "✅ Setup it's done"
tests:
uv run pytest --verbose
Comment on lines +6 to +7

.PHONY: tests
tests: ## Locally run tests
$(PIPENV) clean
$(PIPENV_SAFE_RUN) pytest --verbose
lint:
uv run ruff check ./src
uv run ruff format --check ./src
uv run mypy
Comment on lines +9 to +12

.PHONY: lint
lint: ## Lint the project files
@echo "🌑 Formatting with black"
@$(PIPENV) run black ./src
@echo "🕵 Check for errors with flake8"
@$(PIPENV) run flake8 ./
@echo "😋 Running isort"
@$(PIPENV) run isort --atomic .
format:
uv run ruff format ./src
Comment on lines +14 to +15

.PHONY: clean
clean: ## Removed venv files
rm -rf .venv
$(PIPENV) --rm || true
$(PIPENV) --rm || true # two virtualenvs may exists, the local at .venv and the one at ~/.virtualenvs/

.ONESHELL:
.venv/lib: Pipfile.lock
pip install -U pipenv==v2022.9.24
$(PIPENV) clean
mkdir -p .venv
$(PIPENV) install --dev --no-site-packages
test -d .venv/lib && touch .venv/lib

.ONESHELL:
Pipfile.lock: Pipfile
$(PIPENV) lock
clean:
find . -type f -name "*.pyc" -delete
find . -type d -name "__pycache__" -delete
find . -type d -name ".pytest_cache" -exec rm -rf {} +
find . -type d -name ".mypy_cache" -exec rm -rf {} +
find . -type d -name ".hypothesis" -exec rm -rf {} +
Comment on lines +17 to +22
19 changes: 0 additions & 19 deletions Pipfile

This file was deleted.

300 changes: 0 additions & 300 deletions Pipfile.lock

This file was deleted.

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@
After `pyenv` installation, run this in this directory:

```bash
pyenv install 3.10.9
pyenv install 3.13
```

Set default Python version for current directory:

```bash
pyenv local 3.10.9
pyenv local 3.13
```

Basic setup to use pipenv.
Basic setup to use uv.

```bash
python -m pip install -U pip && pip install pipenv
python -m pip install -U pip && pip install uv
```

This project includes make commands to make your life easier.
Expand Down
48 changes: 48 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
[project]
name = "python-boilerplate"
version = "1.0.0"
requires-python = ">=3.13"
description = "Basic boilerplate project with Python for Katas"

[dependency-groups]
dev = [
"assertpy>=1.1",
"hypothesis>=6.130.0",
"mypy>=1.15.0",
"pytest>=8.3.0",
"pytest-cov>=6.1.0",
"ruff>=0.11.0",
]

[tool.pytest.ini_options]
testpaths = ["tests"]

[tool.ruff]
src = ["src"]
line-length = 88

[tool.ruff.lint]
select = ["E", "F", "I", "B", "C", "W", "T4"]
ignore = ["E203", "E266", "E501", "W503"]

[tool.ruff.format]
indent-style = "space"
quote-style = "double"

[tool.mypy]
files = "src,tests"
ignore_missing_imports = true

[tool.coverage.run]
source = ["src"]

[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"if self.debug",
"raise AssertionError",
"raise NotImplementedError",
"if 0:",
"if __name__ == .__main__.:",
]
51 changes: 0 additions & 51 deletions setup.cfg

This file was deleted.