diff --git a/.travis.yml b/.travis.yml index 0f40fa8..d21d864 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,18 +15,20 @@ jobs: python: '3.7' dist: xenial sudo: required - - - python: '3.6' + - python: '3.6' env: TOXENV=djmaster - # readthedocs uses python 3.5 for building python: '3.5' env: TOXENV=docs - - - python: '3.6' + - python: '3.6' env: TOXENV=lint - stage: publish python: '3.6' + before_script: + # workaround for Travis' inability to build PEP517 projects; anything added to build-system.requires + # will also have to be added here until Travis implements this + - pip install setuptools-scm script: skip env: PYPI_DEPLOY=true deploy: &pypi @@ -45,13 +47,14 @@ jobs: fast_finish: true install: - - pip install -r requirements/ci.txt + - python -m pip install -U pip setuptools + - pip install -r requirements/ci.txt before_script: - - coverage erase + - coverage erase script: - - tox + - tox after_success: - | diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 0642199..57893c3 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -35,6 +35,7 @@ You want to contribute some code? Great! Here are a few steps to get you started $ virtualenv venv $ source venv/bin/activate + (venv) $ python -m pip install -U pip setuptools (venv) $ pip install -U -e .[validation] (venv) $ pip install -U -r requirements/dev.txt @@ -57,8 +58,7 @@ You want to contribute some code? Great! Here are a few steps to get you started .. code:: console - (venv) $ cd testproj - (venv) $ python manage.py generate_swagger ../tests/reference.yaml --overwrite --user admin --url http://test.local:8002/ + (venv) $ python testproj/manage.py generate_swagger ../tests/reference.yaml --overwrite --user admin --url http://test.local:8002/ After checking the git diff to verify that no unexpected changes appeared, you should commit the new ``reference.yaml`` together with your changes. @@ -67,13 +67,13 @@ You want to contribute some code? Great! Here are a few steps to get you started .. code:: console - # (optional) sort imports with isort and check flake8 linting - (venv) $ isort --apply - (venv) $ flake8 src/drf_yasg testproj tests setup.py # install test dependencies (venv) $ pip install -U -r requirements/test.txt # run tests in the current environment, faster than tox (venv) $ pytest -n auto --cov + # (optional) sort imports with isort and check flake8 linting + (venv) $ isort --apply + (venv) $ flake8 src/drf_yasg testproj tests setup.py # (optional) run tests for other python versions in separate environments (venv) $ tox diff --git a/MANIFEST.in b/MANIFEST.in index 7611cf8..05aca6e 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,5 +1,6 @@ include README.rst include LICENSE.rst +include pyproject.toml recursive-include requirements * recursive-include src/drf_yasg/static * recursive-include src/drf_yasg/templates * diff --git a/README.rst b/README.rst index f262ebc..1e7c84c 100644 --- a/README.rst +++ b/README.rst @@ -140,7 +140,7 @@ In ``urls.py``: ... ] -This exposes 4 cached, validated and publicly available endpoints: +This exposes 4 endpoints: * A JSON view of your API specification at ``/swagger.json`` * A YAML view of your API specification at ``/swagger.yaml`` @@ -294,6 +294,7 @@ For additional usage examples, you can take a look at the test project in the `` $ virtualenv venv $ source venv/bin/activate (venv) $ cd testproj + (venv) $ python -m pip install -U pip setuptools (venv) $ pip install -U -r requirements.txt (venv) $ python manage.py migrate (venv) $ python manage.py shell -c "import createsuperuser" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..f50ab2a --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools", "wheel", "setuptools-scm"] +build-backend = "setuptools.build_meta" diff --git a/requirements.txt b/requirements.txt index b7d456c..fd3b279 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ --r requirements/setup.txt +# this file is only used when deploying to heroku, because heroku insists on having a root-level requirements.txt +# for normal usage see the requirements/ directory .[validation] -r requirements/heroku.txt diff --git a/requirements/docs.txt b/requirements/docs.txt index b528a74..c5ca67a 100644 --- a/requirements/docs.txt +++ b/requirements/docs.txt @@ -2,7 +2,8 @@ Sphinx>=1.7.0 sphinx_rtd_theme>=0.2.4 Pillow>=4.3.0 -readme_renderer>=17.2 +readme_renderer[md]>=24.0 +twine>=1.12.1 Django>=2.0 djangorestframework_camel_case>=0.2.0 diff --git a/requirements/setup.txt b/requirements/setup.txt deleted file mode 100644 index bf6789e..0000000 --- a/requirements/setup.txt +++ /dev/null @@ -1,3 +0,0 @@ -# needed to build the package setup_requires in setup.py - -setuptools-scm>=3.0.6 diff --git a/requirements/tox.txt b/requirements/tox.txt index eae549b..4015c91 100644 --- a/requirements/tox.txt +++ b/requirements/tox.txt @@ -1,4 +1,2 @@ # requirements for building and running tox -tox>=3.1.2 - --r setup.txt +tox>=3.3.0 diff --git a/runtime.txt b/runtime.txt index 34b35b7..4255f73 100644 --- a/runtime.txt +++ b/runtime.txt @@ -1 +1 @@ -python-3.6.7 +python-3.7.1 diff --git a/setup.py b/setup.py index 2188995..7ab033d 100755 --- a/setup.py +++ b/setup.py @@ -17,7 +17,6 @@ with io.open('README.rst', encoding='utf-8') as readme: description = readme.read() requirements = read_req('base.txt') -requirements_setup = read_req('setup.txt') requirements_validation = read_req('validation.txt') @@ -28,7 +27,6 @@ def drf_yasg_setup(**kwargs): package_dir={'': 'src'}, include_package_data=True, install_requires=requirements, - setup_requires=requirements_setup, extras_require={ 'validation': requirements_validation, }, diff --git a/tox.ini b/tox.ini index 17f283e..f3e37e4 100644 --- a/tox.ini +++ b/tox.ini @@ -1,11 +1,18 @@ [tox] # https://docs.djangoproject.com/en/dev/faq/install/#what-python-version-can-i-use-with-django +minversion = 3.3.0 +isolated_build = true +isolated_build_env=.package envlist = py{27,34,35,36}-django111-drf{37,38,39}, py{34,35,36,37}-django20-drf{37,38,39}, py{35,36,37}-django21-drf{37,38,39}, djmaster, lint, docs +[testenv:.package] +# no additional dependencies besides PEP 517 +deps = + [testenv] deps = django111: Django>=1.11,<2.0 @@ -21,9 +28,8 @@ deps = djmaster: https://github.com/django/django/archive/master.tar.gz # other dependencies - -rrequirements/setup.txt - -rrequirements/validation.txt - -rrequirements/test.txt + -r requirements/validation.txt + -r requirements/test.txt commands = pytest -n 2 --cov --cov-config .coveragerc --cov-append --cov-report="" {posargs} @@ -31,16 +37,15 @@ commands = [testenv:lint] skip_install = true deps = - -rrequirements/lint.txt + -r requirements/lint.txt commands = flake8 src/drf_yasg testproj tests setup.py [testenv:docs] deps = - -rrequirements/setup.txt - -rrequirements/docs.txt + -r requirements/docs.txt commands = - python setup.py check --restructuredtext --metadata --strict + twine check .tox/dist/* sphinx-build -WnEa -b html docs docs/_build/html [pytest]