Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script cleanups #67

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions httpcore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,7 @@
"ReadError",
"WriteError",
"CloseError",
"ProtocolError",
"ProxyError",
]
__version__ = "0.8.4"
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ twine
wheel

# Tests & Linting
flake8
pytest
pytest-asyncio
pytest-trio
pytest-cov
black
autoflake
mypy
isort
mitmproxy
Expand Down
2 changes: 0 additions & 2 deletions scripts/build
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/bin/sh -e

PYTHONPATH=.

if [ -d 'venv' ] ; then
PREFIX="venv/bin/"
else
Expand Down
12 changes: 8 additions & 4 deletions scripts/check
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
#!/bin/sh -e

export PREFIX=""
PACKAGE="httpcore"

if [ -d 'venv' ] ; then
export PREFIX="venv/bin/"
PREFIX="venv/bin/"
else
PREFIX=""
fi
export SOURCE_FILES="httpcore tests"

set -x

${PREFIX}mypy --ignore-missing-imports httpcore
${PREFIX}mypy --ignore-missing-imports ${PACKAGE}
${PREFIX}flake8 --max-line-length 88 ${PACKAGE}
${PREFIX}black --check --exclude '(httpcore/_sync|tests/sync_tests)/.*' --target-version=py37 ${PACKAGE} tests
scripts/unasync --check
21 changes: 9 additions & 12 deletions scripts/clean
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
#!/bin/sh -e

if [ -d 'dist' ] ; then
rm -r dist
fi
if [ -d 'site' ] ; then
rm -r site
fi
if [ -d 'htmlcov' ] ; then
rm -r htmlcov
fi
if [ -d 'httpcore.egg-info' ] ; then
rm -r httpcore.egg-info
fi
PACKAGE=httpcore

rm -rf dist
rm -rf site
rm -rf htmlcov
rm -rf *.egg-info

find ${PACKAGE} -type f -name "*.py[co]" -delete
find ${PACKAGE} -type f -name __pycache__ -delete
6 changes: 2 additions & 4 deletions scripts/install
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@
[ "$1" = "-p" ] && PYTHON=$2 || PYTHON="python3"

REQUIREMENTS="requirements.txt"
VENV="venv"

set -x

if [ -z "$GITHUB_ACTIONS" ]; then
"$PYTHON" -m venv "$VENV"
PIP="$VENV/bin/pip"
"$PYTHON" -m venv venv
PIP="venv/bin/pip"
else
PIP="pip"
fi

"$PIP" install -r "$REQUIREMENTS"
"$PIP" install -e .
12 changes: 6 additions & 6 deletions scripts/lint
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/bin/sh -e

export PREFIX=""
PACKAGE="httpcore"

if [ -d 'venv' ] ; then
export PREFIX="venv/bin/"
PREFIX="venv/bin/"
else
PREFIX=""
fi
export SOURCE_FILES="httpcore tests"

set -x

${PREFIX}autoflake --in-place --recursive $SOURCE_FILES
${PREFIX}isort --project=httpcore --recursive --apply $SOURCE_FILES
yeraydiazdiaz marked this conversation as resolved.
Show resolved Hide resolved
${PREFIX}black --exclude 'httpcore/_sync/.*' --exclude 'tests/sync_tests/.*' --target-version=py36 $SOURCE_FILES
${PREFIX}black --exclude '(httpcore/_sync|tests/sync_tests)/.*' --target-version=py37 ${PACKAGE} tests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoughts on keeping autoflake? If we're adding flake8 to check it's definitely nice to have a quick way to fix things when they're broken.

scripts/unasync
1 change: 0 additions & 1 deletion scripts/publish
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/sh -e

VERSION_FILE="httpcore/__init__.py"
PYTHONPATH=.

if [ -d 'venv' ] ; then
PREFIX="venv/bin/"
Expand Down
5 changes: 3 additions & 2 deletions scripts/test
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/bin/sh

export PREFIX=""
if [ -d 'venv' ] ; then
export PREFIX="venv/bin/"
PREFIX="venv/bin/"
else
PREFIX=""
fi

if [ -z $GITHUB_ACTIONS ]; then
Expand Down
5 changes: 3 additions & 2 deletions scripts/unasync
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/bin/sh -e

export PREFIX=""
if [ -d 'venv' ] ; then
export PREFIX="venv/bin/"
PREFIX="venv/bin/"
else
PREFIX=""
fi

${PREFIX}python unasync.py ${@}
22 changes: 0 additions & 22 deletions setup.cfg

This file was deleted.