Skip to content

Commit 65c0caa

Browse files
committed
Modernize and improve setup.py
The current setup/CI configuration has rotted a bit, especially with respect to the control of requirements. This is a modernization pass to fix that and make some improvements: 1) Various requirements are now specified directly in setup.py through "extras_require", so to install the dev dependencies it's sufficient to run `$ pip install -e .[dev]` 2) When building or installing unreleased versions of asyncpg, the dev version is generated automatically with setuptools_scm. 3) When cythonization is necessary, the correct version of Cython is now used automatically through the use of setup_requires.
1 parent 0ddfa46 commit 65c0caa

14 files changed

+174
-52
lines changed

.ci/appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,9 @@ branches:
2626

2727
install:
2828
- "%PYTHON% -m pip install --upgrade pip wheel setuptools"
29-
- "%PYTHON% -m pip install --upgrade -r .ci/requirements-win.txt"
3029

3130
build_script:
32-
- "%PYTHON% setup.py build_ext --inplace"
31+
- "%PYTHON% setup.py build_ext --inplace --cython-always"
3332

3433
test_script:
3534
- "%PYTHON% setup.py test"
@@ -41,6 +40,7 @@ artifacts:
4140
- path: dist\*
4241

4342
deploy_script:
43+
- "%PYTHON% -m pip install --upgrade -r .ci/requirements-publish.txt"
4444
- ps: |
4545
if ($env:appveyor_repo_branch -eq 'releases') {
4646
$PACKAGE_VERSION = & "$env:PYTHON" ".ci/package-version.py"

.ci/requirements-publish.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
tinys3
2+
twine

.ci/requirements-win.txt

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

.ci/requirements.txt

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

.ci/travis-build-docs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ if [[ "${BUILD}" != *docs* ]]; then
77
exit 0
88
fi
99

10-
pip install -r docs/requirements.txt
10+
pip install -U .[dev]
1111
make htmldocs SPHINXOPTS="-q -W -j4"

.ci/travis-install.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@ if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
88
eval "$(pyenv init -)"
99
fi
1010

11-
pip install --upgrade pip wheel
12-
pip install --upgrade setuptools
13-
pip install --upgrade -r .ci/requirements.txt
11+
pip install --upgrade setuptools pip wheel
12+
pip install --upgrade -e .[dev]

.ci/travis-publish-docs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then
1313
exit 0
1414
fi
1515

16-
pip install -r docs/requirements.txt
16+
pip install -U .[dev]
1717
make htmldocs
1818

1919
git config --global user.email "[email protected]"

.ci/travis-release.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ if [ -z "${TRAVIS_TAG}" ]; then
77
exit 0
88
fi
99

10+
pip install -U ".ci/requirements-publish.txt"
1011

1112
PACKAGE_VERSION=$(python ".ci/package-version.py")
1213
PYPI_VERSION=$(python ".ci/pypi-check.py" "${PYMODULE}")

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ docs/_build
3131
*,cover
3232
.coverage
3333
/.pytest_cache/
34+
/.eggs

Makefile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,7 @@ compile:
2020

2121

2222
debug:
23-
$(PYTHON) setup.py build_ext --inplace --debug \
24-
--cython-always \
25-
--cython-annotate \
26-
--cython-directives="linetrace=True" \
27-
--define ASYNCPG_DEBUG,CYTHON_TRACE,CYTHON_TRACE_NOGIL
23+
ASYNCPG_DEBUG=1 $(PYTHON) setup.py build_ext --inplace
2824

2925

3026
test:

0 commit comments

Comments
 (0)