File tree 3 files changed +49
-13
lines changed
3 files changed +49
-13
lines changed Original file line number Diff line number Diff line change 38
38
restore-keys : |
39
39
${{ runner.os }}-pip-py${{ matrix.python }}-
40
40
- name : Install dev dependencies
41
- run : pip install --requirement requirements-dev.txt
42
-
43
- # Install library
44
- - name : Install result
45
- run : pip install --editable .
41
+ # There's no virtual env in CI environment, just bypass it with a dummy
42
+ # env var value
43
+ run : VIRTUAL_ENV=none make install
46
44
47
45
# Tests
48
46
- name : Run tests
@@ -60,13 +58,13 @@ jobs:
60
58
61
59
# Linters
62
60
- name : Run flake8 (Python >= 3.10)
63
- run : flake8
61
+ run : make lint-flake
64
62
if : matrix.python != '3.9' && matrix.python != '3.8'
65
63
- name : Run flake8 (Python < 3.10)
66
- run : flake8 --extend-exclude tests/test_pattern_matching.py
64
+ run : make lint-flake-pre310
67
65
if : matrix.python == '3.9' || matrix.python == '3.8'
68
66
- name : Run mypy
69
- run : mypy
67
+ run : make lint- mypy
70
68
71
69
# Packaging
72
70
- name : Build packages
Original file line number Diff line number Diff line change
1
+ # phony trick from https://keleshev.com/my-book-writing-setup/
2
+ .PHONY : phony
3
+
4
+ install : phony
5
+ ifndef VIRTUAL_ENV
6
+ $(error install can only be run inside a Python virtual environment)
7
+ endif
8
+ @echo Installing dependencies...
9
+ pip install -r requirements-dev.txt
10
+ pip install -e .
11
+
12
+ lint : phony lint-flake lint-mypy
13
+
14
+ lint-flake : phony
15
+ flake8
16
+
17
+ lint-flake-pre310 : phony
18
+ # Python <3.10 doesn't support pattern matching.
19
+ flake8 --extend-exclude tests/test_pattern_matching.py
20
+
21
+ lint-mypy : phony
22
+ mypy
23
+
24
+ test : phony
25
+ pytest
Original file line number Diff line number Diff line change @@ -419,11 +419,24 @@ Sometimes regular `do()` can handle async values, but this error means
419
419
you have hit a case where it does not. You should use ` do_async() ` here
420
420
instead.
421
421
422
- ## Development
423
-
424
- - Set up: ` pip install -e . `
425
- - Test your changes: ` flake8 src tests; mypy; pytest `
426
- - Remember to test in Python 3.8 - 3.12.
422
+ ## Contributing
423
+
424
+ These steps should work on any Unix-based system (Linux, macOS, etc) with Python
425
+ and ` make ` installed. On Windows, you will need to refer to the Python
426
+ documentation (linked below) and reference the ` Makefile ` for commands to run
427
+ from the non-unix shell you're using on Windows.
428
+
429
+ 1 . Setup and activate a virtual environment. See [ Python docs] [ pydocs-venv ] for more
430
+ information about virtual environments and setup.
431
+ 2 . Run ` make install ` to install dependencies
432
+ 3 . Switch to a new git branch and make your changes
433
+ 4 . Test your changes:
434
+ - ` make test `
435
+ - ` make lint `
436
+ - You can also start a Python REPL and import ` result `
437
+ 5 . Git commit and create a new PR.
438
+
439
+ [ pydocs-venv ] : https://docs.python.org/3/library/venv.html
427
440
428
441
## FAQ
429
442
You can’t perform that action at this time.
0 commit comments