Merge pull request #148 from jazzband/project-releaess

Add Tox config and prepare for project releases.
This commit is contained in:
Jannis Leidel 2019-11-24 20:30:00 +01:00 committed by GitHub
commit 87c6c2bdab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 72 additions and 52 deletions

View file

@ -2,30 +2,27 @@ language: python
dist: xenial
cache: pip
python:
- "2.7"
- "3.5"
- "3.6"
- "3.7"
- "3.8"
- "pypy3"
env:
- DJANGO=1.11
- DJANGO=2.1
- DJANGO=2.2
- '2.7'
- '3.5'
- '3.6'
- '3.7'
- '3.8'
- pypy3
services:
- redis-server
install:
- pip install coveralls mockredispy django-redis-cache "celery<5"
- pip install -q django~=$DJANGO
- python setup.py develop
script:
- PYTHONPATH=$PYTHONPATH:$PWD coverage run --source=defender $(which django-admin.py) test defender --settings=defender.travis_settings
- coverage report -m
matrix:
exclude:
- python: "2.7"
env: DJANGO=2.1
- python: "2.7"
env: DJANGO=2.2
- redis-server
install: pip install tox-travis codecov
script: tox
after_success:
- coveralls --verbose
- codecov
deploy:
provider: pypi
user: jazzband
server: https://jazzband.co/projects/django-defender/upload
distributions: sdist bdist_wheel
skip_existing: true
password:
secure: d/PVFgBDMpG6UvBOxXBLH4vc7+tiPsjhq4YLgXfX0iXbdNHUnnCyDLg/XUQ7x0e7kRj+lhmBzytZxu3IpOY+5MuWk4JTqwoBHGuUlmTC9XEVvioqd/nFW7qVe36YKZHKuMDlmwBNQarJZdSBUFAoCfklZKI09sXA1qc8E3BLAb8=
on:
tags: true
repo: jazzband/django-defender
python: 3.7

View file

@ -10,9 +10,9 @@ django-defender
:target: https://travis-ci.org/jazzband/django-defender
:alt: Build Status
.. image:: https://img.shields.io/coveralls/jazzband/django-defender.svg
:target: https://coveralls.io/r/jazzband/django-defender
:alt: Coverage Status
.. image:: https://codecov.io/gh/jazzband/django-defender/branch/master/graph/badge.svg
:target: https://codecov.io/gh/jazzband/django-defender
:alt: Coverage
A simple Django reusable app that blocks people from brute forcing login

View file

@ -0,0 +1,3 @@
from pkg_resources import get_distribution
__version__ = get_distribution("django-defender").version

View file

@ -21,9 +21,11 @@ project = "django-defender"
copyright = "2014, Ken Cochrane"
author = "Ken Cochrane"
# The full version, including alpha/beta/rc tags
release = "0.6.2"
# The full version, including alpha/beta/rc tags.
release = get_distribution("django-defender").version
# The short X.Y version.
version = ".".join(release.split(".")[:2])
# -- General configuration ---------------------------------------------------

6
requirements.txt Normal file
View file

@ -0,0 +1,6 @@
-e .
coverage
mockredispy
django-redis-cache
celery<5
mock; python_version < '3.0'

View file

@ -1,26 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
version = "0.6.2"
def get_packages(package):
"""
Return root package and all sub-packages.
"""
return [
dirpath
for dirpath, dirnames, filenames in os.walk(package)
if os.path.exists(os.path.join(dirpath, "__init__.py"))
]
from setuptools import setup, find_packages
def get_package_data(package):
@ -42,7 +23,8 @@ def get_package_data(package):
setup(
name="django-defender",
version=version,
use_scm_version=True,
setup_requires=["setuptools_scm"],
description="redis based Django app that locks out users after too "
"many failed login attempts.",
long_description="redis based Django app based on speed, that locks out"
@ -72,7 +54,7 @@ setup(
author_email="kencochrane@gmail.com",
license="Apache 2",
include_package_data=True,
packages=get_packages("defender"),
packages=find_packages(),
package_data=get_package_data("defender"),
install_requires=["Django>=1.8,<2.3", "redis>=2.10.3,<3.3"],
tests_require=[

30
tox.ini Normal file
View file

@ -0,0 +1,30 @@
[tox]
envlist =
# list of supported Django/Python versioons:
# https://docs.djangoproject.com/en/2.2/faq/install/#what-python-version-can-i-use-with-django
py{27,35,36,37,py3}-django111
py35-django(21,22)
py{36,37,py3}-django{21,22,master}
py38-django22
[travis]
python =
2.7: py27
3.5: py35
3.6: py36
3.7: py37
3.8: py38
pypy3: pypy3
[testenv]
deps =
-rrequirements.txt
py27: mock
django111: django>=1.11,<2.0
django21: django>=2.1,<2.2
django22: django>=2.2,<2.3
djangomaster: https://github.com/django/django/archive/master.tar.gz
usedevelop = True
commands =
{envbindir}/coverage run --source=defender {envbindir}/django-admin.py test defender --settings=defender.travis_settings
{envbindir}/coverage report -m