Skip to content

Commit 50b9e73

Browse files
authored
Merge pull request #233 from valkey-io/mkmkme/makefile
Replace pyinvoke with Makefile
2 parents b0d9b12 + ad10a3b commit 50b9e73

File tree

7 files changed

+103
-113
lines changed

7 files changed

+103
-113
lines changed

.github/workflows/docs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
run: |
4141
pip install --group dev --group docs
4242
pip install .
43-
invoke build-docs
43+
make build-docs
4444
4545
- name: upload docs
4646
uses: actions/upload-artifact@v4

.github/workflows/install_and_test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ python -m venv ${DESTENV}
2121
source ${DESTENV}/bin/activate
2222
pip install --upgrade --quiet pip
2323
pip install --quiet --group dev
24-
invoke devenv
25-
invoke package
24+
make devenv
25+
make package
2626

2727
# find packages
2828
PKG=`ls ${ROOT}/dist/*.${SUFFIX}`

.github/workflows/integration.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
- name: run code linters
4949
run: |
5050
pip install --group dev
51-
invoke linters
51+
make linters
5252
5353
get-date:
5454
name: Get current date for cache
@@ -120,17 +120,17 @@ jobs:
120120
if [ "${{matrix.connection-type}}" == "libvalkey" ]; then
121121
pip install "libvalkey>=4.0.1"
122122
fi
123-
invoke devenv
123+
make devenv
124124
if [[ "${{matrix.test-type}}" == "standalone" ]]; then
125125
./util/wait-for-it.sh localhost:6379
126126
else
127127
./util/wait-for-it.sh localhost:16379
128128
fi
129-
invoke ${{matrix.test-type}}-tests --protocol=${{ matrix.protocol-version }}
129+
make ${{matrix.test-type}}-tests PROTOCOL=${{ matrix.protocol-version }}
130130
# TODO: remove check for 3.14 once it's fixed
131131
# https://github.com/MagicStack/uvloop/issues/637
132132
if [[ "${{matrix.python-version}}" != pypy-* && "${{matrix.python-version}}" != "3.14-dev" ]]; then
133-
invoke ${{matrix.test-type}}-tests --uvloop --protocol=${{ matrix.protocol-version }}
133+
make ${{matrix.test-type}}-tests USE_UVLOOP=1 PROTOCOL=${{ matrix.protocol-version }}
134134
fi
135135
136136
- uses: actions/upload-artifact@v4

CONTRIBUTING.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -95,18 +95,18 @@ Here's how to get started with your code contribution:
9595
b. source .venv/bin/activate
9696
c. pip install --group dev
9797

98-
4. If you need a development environment, run `invoke devenv`. Note: this relies on docker compose to build environments, and assumes that you have a version supporting [docker profiles](https://docs.docker.com/compose/profiles/).
99-
5. While developing, make sure the tests pass by running `invoke tests`
98+
4. If you need a development environment, run `make devenv`. Note: this relies on docker compose to build environments, and assumes that you have a version supporting [docker profiles](https://docs.docker.com/compose/profiles/).
99+
5. While developing, make sure the tests pass by running `make tests`
100100
6. If you like the change and think the project could use it, send a
101101
pull request
102102

103-
To see what else is part of the automation, run `invoke -l`
103+
To see what else is part of the automation, run `make help`
104104

105105
## The Development Environment
106106

107-
Running `invoke devenv` starts all of the dockers used by this
107+
Running `make devenv` starts all of the dockers used by this
108108
project, and leaves them running. These can be easily cleaned up with
109-
`invoke clean`. NOTE: it is assumed that the user running these tests,
109+
`make clean`. NOTE: it is assumed that the user running these tests,
110110
can execute docker and its various commands.
111111

112112
- A master Valkey node
@@ -124,22 +124,22 @@ configuration](https://redis.io/topics/sentinel).
124124

125125
## Testing
126126

127-
Call `invoke tests` to run all tests, or `invoke all-tests` to run linters
127+
Call `make tests` to run all tests, or `make all-tests` to run linters
128128
tests as well. With the 'tests' and 'all-tests' targets, all Valkey and
129129
ValkeyCluster tests will be run.
130130

131131
It is possible to run only Valkey client tests (with cluster mode disabled) by
132-
using `invoke standalone-tests`; similarly, ValkeyCluster tests can be run by using
133-
`invoke cluster-tests`.
132+
using `make standalone-tests`; similarly, ValkeyCluster tests can be run by using
133+
`make cluster-tests`.
134134

135135
Each run of tests starts and stops the various dockers required. Sometimes
136-
things get stuck, an `invoke clean` can help.
136+
things get stuck, an `make clean` can help.
137137

138138
## Documentation
139139

140140
If relevant, update the code documentation, via docstrings, or in `/docs`.
141141

142-
You can check how the documentation looks locally by running `invoke build-docs`
142+
You can check how the documentation looks locally by running `make build-docs`
143143
and loading the generated HTML files in a browser.
144144

145145
Historically there is a mix of styles in the docstrings, but the preferred way

Makefile

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
USE_UVLOOP ?= 0
2+
PROTOCOL ?= 2
3+
CLUSTER_URL ?= valkey://localhost:16379/0
4+
ADDITIONAL_PYTEST_ARGS ?=
5+
6+
ifeq ($(USE_UVLOOP), 1)
7+
UVLOOP_ARG := --uvloop
8+
UVLOOP_REPORT_INFIX := -uvloop
9+
else
10+
UVLOOP_ARG := --no-uvloop
11+
endif
12+
13+
.PHONY: devenv stop-devenv build-docs linters standalone-tests cluster-tests all-tests clean package
14+
15+
all: help
16+
17+
help:
18+
@echo "Please use \"make <target>\" where <target> is one of"
19+
@echo " clean to clean the project and stop development environment"
20+
@echo " devenv to start development environment (requires docker-compose)"
21+
@echo " stop-devenv to stop development environment"
22+
@echo " build-docs to build the sphinx documentation"
23+
@echo " docs is an alias for build-docs"
24+
@echo " linters to run code linters"
25+
@echo " standalone-tests to run standalone tests"
26+
@echo " cluster-tests to run cluster tests"
27+
@echo " tests to run standalone and cluster tests"
28+
@echo " all-tests to run all linters and tests"
29+
@echo " package to build the package"
30+
31+
.check-virtualenv:
32+
ifndef VIRTUAL_ENV
33+
@echo "**************************************************************"
34+
@echo "*** WARNING: it is highliy recommended to use a virtualenv ***"
35+
@echo "**************************************************************"
36+
endif
37+
38+
clean: stop-devenv
39+
rm -rf build
40+
rm -rf dist
41+
docker compose --profile all rm -s -f
42+
43+
devenv: clean
44+
docker compose --profile all up -d
45+
46+
stop-devenv:
47+
docker compose --profile all down
48+
49+
build-docs docs: .check-virtualenv
50+
pip install --group docs
51+
make -C docs html
52+
53+
linters: .check-virtualenv
54+
flake8 tests valkey
55+
black --target-version py37 --check --diff tests valkey
56+
isort --check-only --diff tests valkey
57+
vulture valkey whitelist.py --min-confidence 80
58+
flynt --fail-on-change --dry-run tests valkey
59+
60+
standalone-tests: .check-virtualenv
61+
pytest \
62+
--protocol=$(PROTOCOL) \
63+
--cov=./ \
64+
--cov-report=xml:coverage_valkey.xml \
65+
-W always \
66+
-m 'not onlycluster' \
67+
--junit-xml=standalone$(UVLOOP_REPORT_INFIX)-results.xml \
68+
$(UVLOOP_ARG) $(ADDITIONAL_PYTEST_ARGS)
69+
70+
cluster-tests: .check-virtualenv
71+
pytest \
72+
--protocol=$(PROTOCOL) \
73+
--cov=./ \
74+
--cov-report=xml:coverage_cluster.xml \
75+
-W always \
76+
-m 'not onlynoncluster and not valkeymod' \
77+
--valkey-url=$(CLUSTER_URL) \
78+
--junit-xml=cluster$(UVLOOP_REPORT_INFIX)-results.xml \
79+
$(UVLOOP_ARG) $(ADDITIONAL_PYTEST_ARGS)
80+
81+
package: .check-virtualenv
82+
hatchling build
83+
84+
tests: standalone-tests cluster-tests
85+
86+
all-tests: linters tests

pyproject.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,10 @@ dependencies = [
4242
dev = [
4343
'black',
4444
'cachetools',
45-
'click',
4645
'flake8-isort',
4746
'flake8',
4847
'flynt',
4948
'hatchling',
50-
'invoke',
5149
'mock',
5250
'packaging>=20.4',
5351
'pytest',

tasks.py

Lines changed: 0 additions & 94 deletions
This file was deleted.

0 commit comments

Comments
 (0)