Skip to content

Commit

Permalink
upgraded pypi-template
Browse files Browse the repository at this point in the history
  • Loading branch information
christophevg committed Oct 30, 2024
1 parent a4e63ac commit 1ce77f3
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
![Build Status](https://github.com/christophevg/baseweb/actions/workflows/test.yaml/badge.svg)
[![Documentation Status](https://readthedocs.org/projects/baseweb/badge/?version=latest)](https://baseweb.readthedocs.io/en/latest/?badge=latest)
[![Coverage Status](https://coveralls.io/repos/github/christophevg/baseweb/badge.svg?branch=master)](https://coveralls.io/github/christophevg/baseweb?branch=master)
[![Built with PyPi Template](https://img.shields.io/badge/PyPi_Template-v0.5.0-blue.svg)](https://github.com/christophevg/pypi-template)
[![Built with PyPi Template](https://img.shields.io/badge/PyPi_Template-v0.6.1-blue.svg)](https://github.com/christophevg/pypi-template)



Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -24,12 +24,13 @@ jobs:
- name: Lint with ruff
run: |
# stop the build if there are Python syntax errors or undefined names
ruff --output-format=github --select=E9,F63,F7,F82 --target-version=py38 .
ruff check --output-format=github --select=E9,F63,F7,F82 --target-version=py38 .
# default set of ruff rules with GitHub Annotations
ruff --output-format=github --target-version=py38 .
ruff check --output-format=github --target-version=py38 .
- name: Test with PyTest and generate coverage report
run: |
coverage run -m --omit="*/.tox/*,*/distutils/*,tests/*" pytest
coverage run -m pytest
coverage lcov
coverage report
- name: Coveralls
uses: coverallsapp/github-action@v2
29 changes: 20 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ PYTHON_VERSIONS ?= 3.8.12 3.9.18 3.10.13 3.11.5
RUFF_PYTHON_VERSION ?= py38

PROJECT=$(shell basename $(CURDIR))
PACKAGE_NAME=`cat .pypi-template | grep "^package_module_name" | cut -d":" -f2`
PACKAGE_NAME=`cat .pypi-template | grep "^package_module_name" | cut -d":" -f2 | xargs`

RUN_CMD?=python -m $(PACKAGE_NAME)
LOG_LEVEL?=ERROR
SILENT?=yes

RUN_CMD?=LOG_LEVEL=$(LOG_LEVEL) python -m $(PACKAGE_NAME)
RUN_ARGS?=

TEST_ENVS=$(addprefix $(PROJECT)-test-,$(PYTHON_VERSIONS))
Expand Down Expand Up @@ -49,7 +52,7 @@ $(PROJECT)-test-%:
-pyenv virtualenv $* $@ > /dev/null
pyenv local $@
pip install -U pip > /dev/null
pip install -U ruff tox > /dev/null
pip install -U ruff tox coverage > /dev/null

uninstall: uninstall-envs

Expand All @@ -71,28 +74,36 @@ upgrade:
# env switching

env-%:
pyenv local $(PROJECT)-$*
@echo "👷‍♂️ $(BLUE)activating $* environment$(NC)"
@pyenv local $(PROJECT)-$*

env:
pyenv local $(PROJECT)
@echo "👷‍♂️ $(BLUE)activating project environment$(NC)"
@pyenv local $(PROJECT)

env-test:
pyenv local $(TEST_ENVS)
@echo "👷‍♂️ $(BLUE)activating test environments$(NC)"
@pyenv local $(TEST_ENVS)

# functional targets

run: env-run
$(RUN_CMD) $(RUN_ARGS)
@echo "👷‍♂️ $(BLUE)running$(GREEN) $(RUN_CMD) $(RUN_ARGS)$(NC)"
@$(RUN_CMD) $(RUN_ARGS)

test: env-test lint
ifeq ($(SILENT),yes)
tox -q
else
tox
endif

coverage: test
coverage report
coverage lcov

lint: env-test
ruff --select=E9,F63,F7,F82 --target-version=$(RUFF_PYTHON_VERSION) .
ruff --target-version=$(RUFF_PYTHON_VERSION) .
ruff check --target-version=$(RUFF_PYTHON_VERSION) .

docs: env-docs
cd docs; make html
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ deps =
pytest
coverage
commands =
coverage run -m --omit="*/.tox/*,*/distutils/*,tests/*" pytest {posargs}
coverage run -m pytest {posargs}

0 comments on commit 1ce77f3

Please sign in to comment.