Skip to content

Commit 175d47c

Browse files
committed
dev: upgrade to new dev setup
1 parent f4bde63 commit 175d47c

File tree

20 files changed

+330
-45
lines changed

20 files changed

+330
-45
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ jobs:
1010
strategy:
1111
fail-fast: false
1212
matrix:
13-
os: [ubuntu-latest, macos-latest] # TODO: make this pass on github hosted windows: , windows-latest]
13+
os: [ubuntu-latest, macos-latest, windows-latest]
1414
python-version: [3.7, 3.8, 3.9, "3.10"]
1515
steps:
16-
- uses: actions/checkout@v2
16+
- uses: actions/checkout@v3
1717
- name: Set up Python
18-
uses: actions/setup-python@v2
18+
uses: actions/setup-python@v4
1919
with:
2020
python-version: ${{ matrix.python-version }}
2121

@@ -24,10 +24,18 @@ jobs:
2424

2525
- name: Install deps
2626
shell: bash
27+
env:
28+
VENVSTARTER_ONLY_MAKE_VENV: "1"
2729
run: |
28-
set -e
29-
python -m pip install --user --upgrade pip
30-
python -m pip install -e ".[tests]"
30+
if [ "$RUNNER_OS" == "Windows" ]; then
31+
if ! python -c 'import sys; sys.exit(1) if sys.version_info < (3, 9) else None'; then
32+
# Need for python 3.7 and 3.8 on windows
33+
python -m venv tools/.python
34+
./tools/.python/Scripts/python -m pip install setuptools pip -U
35+
fi
36+
fi
37+
38+
python ./tools/venv
3139
3240
- name: Run tests
3341
shell: bash

.github/workflows/lint.yml

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,37 @@ jobs:
88
lint:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v2
11+
- uses: actions/checkout@v3
1212

1313
- name: Set up Python
14-
uses: actions/setup-python@v2
14+
uses: actions/setup-python@v4
1515
with:
16-
python-version: 3.9
16+
python-version: "3.10"
1717

18-
- run: python -m pip install pip venvstarter -U
19-
20-
- run: ./tools/pylama --help
18+
- name: Install deps
19+
shell: bash
20+
env:
21+
VENVSTARTER_ONLY_MAKE_VENV: "1"
22+
run: python ./tools/venv
2123

2224
- name: Ensure linter is happy
2325
run: ./lint
2426

2527
format:
2628
runs-on: ubuntu-latest
2729
steps:
28-
- uses: actions/checkout@v2
30+
- uses: actions/checkout@v3
2931

3032
- name: Set up Python
31-
uses: actions/setup-python@v2
33+
uses: actions/setup-python@v4
3234
with:
33-
python-version: 3.9
34-
35-
- run: python -m pip install pip venvstarter -U
35+
python-version: "3.10"
3636

37-
- run: ./tools/black
37+
- name: Install deps
38+
shell: bash
39+
env:
40+
VENVSTARTER_ONLY_MAKE_VENV: "1"
41+
run: python ./tools/venv
3842

3943
- name: Ensure code is formatted
4044
run: |

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2019 Stephen Moore
3+
Copyright (c) 2023 Stephen Moore
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

find

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
# Helper for searching code base without searching through external code
4+
5+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
6+
7+
(
8+
cd $DIR
9+
exec ack "$@" \
10+
--ignore-directory .tox \
11+
--ignore-directory .mypy_cache \
12+
--ignore-directory dist \
13+
--ignore-directory build \
14+
--ignore-directory alt_pytest_asyncio.egg-info \
15+
--ignore-directory tools \
16+
)

format

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ set -e
44

55
cd "$(git rev-parse --show-toplevel)"
66

7-
./tools/black black alt_pytest_asyncio
8-
./tools/black noy_black $(find tests -name '*.py')
7+
./tools/venv format "$@"

lint

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
set -e
44

5-
cd $(git rev-parse --show-toplevel)
5+
cd "$(git rev-parse --show-toplevel)"
66

7-
./tools/pylama alt_pytest_asyncio tests "$@"
7+
exec ./tools/venv lint "$@"

pylama.ini

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
[pylama]
2-
skip = */setup.py
3-
4-
[pylama:tests/*]
5-
ignore = E225,E202,E211,E231,E226,W292,W291,E251,E122,E501,E701,E227,E305,E128,W391,C901
2+
skip = setup.py,tools/.python/**
3+
ignore = E225,E202,E211,E231,E226,W292,W291,E251,E122,E501,E701,E227,E305,E128,W391
64

75
[pylama:pyflakes]
86
builtins = _

pyproject.toml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@ exclude = '''
66
\.git
77
| \.tox
88
| dist
9-
| tools
10-
| docs
9+
| tools/\.python
1110
)/
1211
'''
12+
13+
[tool.isort]
14+
profile = "black"
15+
skip_glob = [
16+
".git/*",
17+
".tox/*",
18+
"dist/*",
19+
"tools/.*",
20+
]

run.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/bash
2+
3+
cwd="$(pwd)"
4+
5+
# Bash does not make it easy to find where this file is
6+
# Here I'm making it so it doesn't matter what directory you are in
7+
# when you execute this script. And it doesn't matter whether you're
8+
# executing a symlink to this script
9+
# Note the `-h` in the while loop asks if this path is a symlink
10+
pushd . >'/dev/null'
11+
SCRIPT_PATH="${BASH_SOURCE[0]:-$0}"
12+
while [ -h "$SCRIPT_PATH" ]; do
13+
cd "$(dirname -- "$SCRIPT_PATH")"
14+
SCRIPT_PATH="$(readlink -f -- "$SCRIPT_PATH")"
15+
done
16+
cd "$(dirname -- "$SCRIPT_PATH")" >'/dev/null'
17+
18+
# We use noseOfYeti here, so let's make black compatible with it
19+
export NOSE_OF_YETI_BLACK_COMPAT=true
20+
export NOSE_OF_YETI_IT_RETURN_TYPE=false
21+
export MYPYPATH=$(pwd)/modules/tests/stubs:$MYPYPATH
22+
23+
HANDLED=0
24+
25+
# Special case activate to make the virtualenv active in this session
26+
if [[ "$0" != "$BASH_SOURCE" ]]; then
27+
HANDLED=1
28+
if [[ "activate" == "$1" ]]; then
29+
VENVSTARTER_ONLY_MAKE_VENV=1 ./tools/venv
30+
source ./tools/.python/bin/activate
31+
cd "$cwd"
32+
else
33+
echo "only say \`source run.sh activate\`"
34+
fi
35+
fi
36+
37+
if [[ $HANDLED != 1 ]]; then
38+
if [[ "$#" == "1" && "$1" == "activate" ]]; then
39+
if [[ "$0" = "$BASH_SOURCE" ]]; then
40+
echo "You need to run as 'source ./run.sh $1'"
41+
exit 1
42+
fi
43+
fi
44+
45+
exec ./tools/venv "$@"
46+
fi

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
from setuptools import setup, find_packages
2-
1+
from setuptools import find_packages, setup
32
import runpy
43
import os
54

5+
66
VERSION = runpy.run_path(
77
os.path.join(os.path.dirname(__file__), "alt_pytest_asyncio", "version.py")
88
)["VERSION"]
@@ -23,7 +23,7 @@
2323
, extras_require =
2424
{ 'tests':
2525
[ 'pytest==6.2.4'
26-
, 'noseOfYeti==2.0.2'
26+
, 'noseOfYeti[black]==2.4.1'
2727
, "nest-asyncio==1.0.0"
2828
]
2929
}

0 commit comments

Comments
 (0)