Skip to content

Commit

Permalink
typing: check on 3.8 and 3.14
Browse files Browse the repository at this point in the history
  • Loading branch information
ebonnal committed Jan 25, 2025
1 parent 0911b6b commit 128f9f9
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 43 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,9 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: '3.14.0-alpha.3'

- name: unittest
run: |
python -m pip install -r requirements-dev.txt
coverage run -m unittest

- name: Generate coverage report
run: coverage report -m --fail-under=100
run: make venv tests-requirements coverage-requirements coverage

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ jobs:
python-version: 3.9

- name: checks
run: make venv lint
run: make venv lint-requirements lint
16 changes: 10 additions & 6 deletions .github/workflows/typing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@ on:

jobs:
mypy:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04

strategy:
matrix:
python-version: ['3.8.18', '3.14.0-alpha.3']

steps:
- uses: actions/checkout@v1
- name: Set up Python 3.9
uses: actions/setup-python@v1
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: ${{ matrix.python-version }}

- name: mypy
run: make venv type-check
run: make venv typing-requirements typing tests-requirements tests-typing
4 changes: 1 addition & 3 deletions .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,4 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: unittest
run: |
python -m pip install -r tests/requirements.txt
python -m unittest
run: make venv tests-requirements coverage-requirements tests
6 changes: 4 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
`make all` or a specific target:
```bash
make venv
make test
make type-check
make requirements
make tests
make typing
make tests-typing
make lint
```

Expand Down
53 changes: 40 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,27 +1,54 @@
VENV_DIR := .venv

all: venv test type-check lint
requirements: venv tests-requirements coverage-requirements typing-requirements lint-requirements
all: venv requirements tests typing tests-typing lint

help:
@echo "Available commands:"
@echo " make all - Run all tasks: venv, test, type-check, lint"
@echo " make venv - Create a virtual environment and install dependencies"
@echo " make test - Run unittests and check coverage"
@echo " make type-check - Check typing with mypy"
@echo " make lint - Lint the codebase"
@echo " make clean - Clean up the environment"
@echo " make all - Run all tasks: venv, requirements, tests, typing, tests-typing, lint"
@echo " make venv - Create a virtual environment and install dependencies"
@echo " make requirements - Install dependencies"
@echo " make tests-requirements - Install tests dependencies"
@echo " make coverage-requirements - Install tests dependencies"
@echo " make typing-requirements - Install typing dependencies"
@echo " make lint-requirements - Install dev dependencies"
@echo " make tests - Run unittests and show coverage"
@echo " make coverage - Check coverage"
@echo " make typing - Check typing with mypy"
@echo " make typing - Check typing with mypy"
@echo " make tests-typing - Check typing of tests directory with mypy"
@echo " make lint - Lint the codebase"

venv:
python3 -m venv $(VENV_DIR)
$(VENV_DIR)/bin/pip install -r requirements-dev.txt
python3 -m venv $(VENV_DIR) --clear

test:
$(VENV_DIR)/bin/python -m coverage run -m unittest --failfast
lint-requirements:
$(VENV_DIR)/bin/pip install autoflake==2.2.1 black==24.3.0 isort==5.12.0

typing-requirements:
$(VENV_DIR)/bin/pip install mypy==1.7.1 mypy-extensions==1.0.0

tests-requirements:
$(VENV_DIR)/bin/pip install parameterized==0.9.0 httpx==0.28.1 requests==2.32.3

coverage-requirements:
$(VENV_DIR)/bin/pip install coverage==7.4.1

tests:
$(VENV_DIR)/bin/coverage run -m unittest --failfast
$(VENV_DIR)/bin/coverage report -m
$(VENV_DIR)/bin/coverage html
.PHONY: tests

coverage:
$(VENV_DIR)/bin/coverage run -m unittest --failfast
$(VENV_DIR)/bin/coverage report -m --fail-under=100

typing:
$(VENV_DIR)/bin/python -m mypy --install-types --non-interactive streamable

type-check:
$(VENV_DIR)/bin/python -m mypy --install-types --non-interactive streamable tests
tests-typing:
$(VENV_DIR)/bin/python -m mypy --install-types --non-interactive tests

lint:
$(VENV_DIR)/bin/python -m autoflake --in-place --remove-all-unused-imports --remove-unused-variables --ignore-init-module -r streamable tests
Expand Down
9 changes: 0 additions & 9 deletions requirements-dev.txt

This file was deleted.

3 changes: 0 additions & 3 deletions tests/requirements.txt

This file was deleted.

0 comments on commit 128f9f9

Please sign in to comment.