Skip to content

Commit e77e596

Browse files
authored
Align most of scripts of httpx here (#739)
* WIP switch to same layout as httpx * Align scripts on httpx layout * Added scripts, they were ignre by my global gitignore * Mimic httpx workflow better * version is in init file * Added twine and wheel for new scripts * Added mkdocs for win build * Putting the failing overage level to 80 to please windows CI, once this lands we're gonna grind coverage ! * Removed mypy from check * Removed useless marker * Removed check script
1 parent 52e1bf4 commit e77e596

File tree

22 files changed

+158
-52
lines changed

22 files changed

+158
-52
lines changed

.codecov.yml

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

.github/workflows/publish.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ jobs:
1616
- uses: "actions/setup-python@v1"
1717
with:
1818
python-version: 3.7
19-
- name: "Publish"
19+
- name: "Install dependencies"
20+
run: "scripts/install"
21+
- name: "Build package & docs"
22+
run: "scripts/build"
23+
- name: "Publish to PyPI & deploy docs"
2024
run: "scripts/publish"
2125
env:
2226
TWINE_USERNAME: __token__

.github/workflows/test-suite.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ jobs:
2323
- name: "Install dependencies"
2424
run: "scripts/install"
2525
shell: bash
26+
- name: "Run linting checks"
27+
run: "scripts/check"
28+
shell: bash
29+
- name: "Build package & docs"
30+
run: "scripts/build"
31+
shell: bash
2632
- name: "Run tests"
2733
run: "scripts/test"
2834
shell: bash
35+
- name: "Enforce coverage"
36+
run: "scripts/coverage"
37+
shell: bash

requirements.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ uvloop>=0.14.0
77
websockets==8.*
88
wsproto==0.13.*
99

10+
# Packaging
11+
twine
12+
wheel
13+
1014
# Testing
1115
autoflake
1216
black
@@ -16,6 +20,7 @@ isort
1620
pytest
1721
pytest-cov
1822
requests
23+
seed-isort-config
1924

2025
# Documentation
2126
mkdocs

requirements_windows.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ h11
55
websockets==8.*
66
wsproto==0.13.*
77

8+
# Packaging
9+
twine
10+
wheel
11+
812
# Testing
913
autoflake
1014
black
@@ -14,6 +18,11 @@ isort
1418
pytest
1519
pytest-cov
1620
requests
21+
seed-isort-config
22+
23+
# Documentation
24+
mkdocs
25+
mkdocs-material
1726

1827
# Efficient debug reload
1928
watchgod>=0.6,<0.7

scripts/build

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh -e
2+
3+
if [ -d 'venv' ] ; then
4+
PREFIX="venv/bin/"
5+
else
6+
PREFIX=""
7+
fi
8+
9+
set -x
10+
11+
${PREFIX}python setup.py sdist bdist_wheel
12+
${PREFIX}twine check dist/*
13+
${PREFIX}mkdocs build

scripts/check

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh -e
2+
3+
export PREFIX=""
4+
if [ -d 'venv' ] ; then
5+
export PREFIX="venv/bin/"
6+
fi
7+
export SOURCE_FILES="uvicorn tests"
8+
9+
set -x
10+
11+
${PREFIX}black --check --diff --target-version=py36 $SOURCE_FILES
12+
${PREFIX}flake8 $SOURCE_FILES
13+
${PREFIX}isort --check --diff --project=uvicorn $SOURCE_FILES

scripts/coverage

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh -e
2+
3+
export PREFIX=""
4+
if [ -d 'venv' ] ; then
5+
export PREFIX="venv/bin/"
6+
fi
7+
export SOURCE_FILES="uvicorn tests"
8+
9+
set -x
10+
11+
${PREFIX}coverage report --show-missing --skip-covered --fail-under=80

scripts/lint

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ export PREFIX=""
44
if [ -d 'venv' ] ; then
55
export PREFIX="venv/bin/"
66
fi
7+
export SOURCE_FILES="uvicorn tests"
78

89
set -x
910

10-
${PREFIX}autoflake --in-place --recursive uvicorn tests
11-
${PREFIX}black uvicorn tests
12-
${PREFIX}isort --multi-line=3 --trailing-comma --force-grid-wrap=0 --combine-as --line-width 88 --recursive --apply uvicorn tests
11+
${PREFIX}autoflake --in-place --recursive $SOURCE_FILES
12+
${PREFIX}seed-isort-config --application-directories=uvicorn
13+
${PREFIX}isort --project=uvicorn $SOURCE_FILES
14+
${PREFIX}black --target-version=py36 $SOURCE_FILES

scripts/publish

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/sh -e
22

3+
VERSION_FILE="uvicorn/__init__.py"
4+
35
if [ -d 'venv' ] ; then
46
PREFIX="venv/bin/"
57
else
@@ -10,7 +12,7 @@ if [ ! -z "$GITHUB_ACTIONS" ]; then
1012
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
1113
git config --local user.name "GitHub Action"
1214

13-
VERSION=`grep __version__ ./uvicorn/__init__.py | grep -o '[0-9][^"]*'`
15+
VERSION=`grep __version__ ${VERSION_FILE} | grep -o '[0-9][^"]*'`
1416

1517
if [ "refs/tags/${VERSION}" != "${GITHUB_REF}" ] ; then
1618
echo "GitHub Ref '${GITHUB_REF}' did not match package version '${VERSION}'"
@@ -20,10 +22,5 @@ fi
2022

2123
set -x
2224

23-
find uvicorn -type f -name "*.py[co]" -delete
24-
find uvicorn -type d -name __pycache__ -delete
25-
26-
${PREFIX}pip install twine wheel mkdocs mkdocs-material mkautodoc
27-
${PREFIX}python setup.py sdist bdist_wheel
2825
${PREFIX}twine upload dist/*
2926
${PREFIX}mkdocs gh-deploy --force

0 commit comments

Comments
 (0)