From: Daniele Varrazzo Date: Thu, 21 May 2020 04:49:07 +0000 (+1200) Subject: Added hacking info to readme X-Git-Tag: 3.0.dev0~511 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4777ff2185925a1535d707e3469cdfaf70c18bf0;p=thirdparty%2Fpsycopg.git Added hacking info to readme tox definitions and tools configurations tweaked to work out of the box. Close #3 --- diff --git a/.gitignore b/.gitignore index 093befee0..ce69c0448 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,8 @@ -env /psycopg3.egg-info /.tox /.eggs /build /dist *.pstats +/.mypy_cache +__pycache__/ diff --git a/README.rst b/README.rst index 9549a20b9..197b9a9d5 100644 --- a/README.rst +++ b/README.rst @@ -11,3 +11,24 @@ The library is still in early development stage. If you want to try it out you can install it from source using:: pip install -e git+https://github.com/psycopg/psycopg3.git#egg=psycopg3 + + +Hacking +------- + +We assume you have built your virtualenv and ``pip`` just works and ``python`` +refers to Python 3. You can set up a dev environment with:: + + python setup.py develop + +All the available tests and dev support are defined in ``tox.ini``: please +refer to `tox documentation`__ for its usage. You can run all the tests with:: + + psql -c 'create database psycopg3_test' + tox -s + +You can use the ``PSYCOPG3_TEST_DSN`` env var to select a different database +to run the tests. You can install the test dependencies in your virtualenv to +run the tests faster: please look at the ``tox.ini`` comments for instructions. + +.. __: https://tox.readthedocs.io/ diff --git a/tox.ini b/tox.ini index 6239af810..aca0c5587 100644 --- a/tox.ini +++ b/tox.ini @@ -1,3 +1,17 @@ +# Tox is nice, but rebuilding the environment every time is kinda slow. +# If you want to install the test environments defined here into your current +# virtualenv you can use: +# +# pip install tox tox-current-env +# tox --print-deps-to-file /tmp/requirements.txt +# pip install -r /tmp/requirements.txt +# +# After which you can run the tests with: +# +# tox --current-env -e ENV +# +# or just run manually the ``commands`` defined here. + [tox] envlist = py{36,37,38}, black, flake8, mypy @@ -18,7 +32,7 @@ deps = black [testenv:flake8] commands = flake8 -deps = flake8 >= 3.7 +deps = flake8 >= 3.8, < 3.9 [testenv:mypy] commands = mypy --config-file tox.ini @@ -26,8 +40,8 @@ deps = mypy >= 0.770 [flake8] max-line-length = 85 -exclude = env, .tox, .eggs ignore = W503, E203 +extend-exclude = .venv [mypy] files = psycopg3