Skip to content

Commit

Permalink
build: bump setuptools + drop tox (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
ohmycoffe authored Nov 22, 2024
1 parent d81fd06 commit 6c8868c
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 133 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
installer-parallel: true
- name: Run lint
run: |
poetry install
make install
make lint
test:
runs-on: ubuntu-latest
Expand All @@ -56,8 +56,9 @@ jobs:
installer-parallel: true
- name: Run test
run: |
poetry install
poetry run pytest
make install
make test
test-coverage-report:
runs-on: ubuntu-latest
name: Generate a test-coverage report
Expand All @@ -66,8 +67,6 @@ jobs:
- uses: actions/setup-python@v2
with:
python-version: "3.11"
- name: Set up PDM
uses: pdm-project/setup-pdm@v3
- name: Install Poetry Action
uses: snok/[email protected]
with:
Expand All @@ -76,7 +75,7 @@ jobs:
installer-parallel: true
- name: Run tests and collect coverage
run: |
poetry install
poetry run pytest --cov=src --cov-report=xml
make install
make test-cov
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v3
2 changes: 0 additions & 2 deletions .python-version
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
3.11
3.10
3.9
37 changes: 12 additions & 25 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
.DEFAULT_GOAL := all
.DEFAULT_GOAL := help
sources = src tests

.PHONY: .poetry # Check that poetry is installed
.poetry:
@poetry -V || echo 'Please install poetry https://python-poetry.org/'

.PHONY: .pre-commit # Check that pre-commit is installed
.pre-commit:
@pre-commit -V || echo 'Please install pre-commit: https://pre-commit.com/'

.PHONY: .install-project
.install-project: .poetry # Install the package, dependencies, and pre-commit for local development
Expand All @@ -28,42 +25,32 @@ lint: .poetry # Lint python source files
poetry run isort $(sources) --check --diff
poetry run flake8 $(sources)
poetry run mypy $(sources)

.PHONY: pre-commit
pre_commit: .poetry # Run pre-commit for all files
poetry run pre-commit run --all-files

.PHONY: test-cov
test-cov: .poetry .clean-coverage # Run tests with coverage
poetry run tox run -e testcov
test-cov: .poetry # Run tests with coverage
poetry run coverage erase
poetry run pytest --cov=src --cov-report=xml

.PHONY: test
test: .poetry # Build packages for different versions of Python and run tests for each package
poetry run tox run -e py39,py310,py311

.PHONY: .clean-coverage # Remove coverage reports and files
.clean-coverage:
@[ -f .coverage ] && rm .coverage || echo ".coverage doesn't exist"
@rm -rf htmlcov

.PHONY: .clean-build
.clean-build:
@rm -rf dist
poetry run pytest

PHONY: build
build: .poetry .clean-build # Build the package
build: .poetry # Build the package
poetry build

.PHONY: clean
clean: .clean-coverage .clean-build# Clean repository
@rm -rf .tox
clean: # Clean repository
@rm -rf .mypy_cache
@[ -f .coverage ] && rm .coverage || echo ".coverage doesn't exist"
@rm -rf htmlcov
@rm -rf dist

.PHONY: help # Show this help message (author @dwmkerr: https://dwmkerr.com/makefile-help-command/)
help: # (default) List all available commands
@grep -E '^[a-zA-Z0-9 -]+:.*#' Makefile | sort | while read -r l; do printf "\033[1;32m$$(echo $$l | cut -f 1 -d':')\033[00m:$$(echo $$l | cut -f 2- -d'#')\n"; done

.PHONY : init-local, init-remote, all
.PHONY : all install
install : .install-project .install-pre-commit # Install the package, dependencies, and pre-commit for local development
install-cicd : .install-project # Install the package, dependencies, and pre-commit for cicd
all : clean install format lint pre_commit test test-cov build# Run all commands
all : clean install format lint test test-cov build# Run all commands
91 changes: 13 additions & 78 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ pandas = "^2.0.3"
exceptiongroup = "^1.1.3"

[tool.poetry.group.dev.dependencies]
tox = "^4.11.1"
pre-commit = "^3.4.0"

[tool.poetry.group.test.dependencies]
Expand Down
20 changes: 0 additions & 20 deletions tox.ini

This file was deleted.

0 comments on commit 6c8868c

Please sign in to comment.