Skip to content

Commit

Permalink
Modernize
Browse files Browse the repository at this point in the history
- Test with python3.6 and 3.7
- Use direnv
- Add badges to README
- Use travis stages and tox-travis
- Use mypy
  • Loading branch information
nwolff committed Mar 4, 2019
1 parent ee4b443 commit 4f9bee3
Show file tree
Hide file tree
Showing 11 changed files with 77 additions and 38 deletions.
2 changes: 2 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# see: https://github.com/direnv/direnv/wiki/Python#venv-stdlib-module
layout python-venv python3.6
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Python
.env
.direnv/
*.pyc
__pycache__
*.egg-info
Expand Down
51 changes: 30 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
dist: xenial

sudo: false

language: python
matrix:

python:
- 3.6
- 3.7

install: pip install tox-travis

script: tox

stages:
- test
- name: deploy
if: tag IS present

jobs:
include:
- python: '3.5'
env: TOXENV=py35-django207-test
- python: '3.6'
env: TOXENV=py36-django207-test
- python: '3.5'
env: TOXENV=py35-django207-checkmigrations
- python: '3.5'
env: TOXENV=py35-django207-flake
install:
- pip install tox
script:
- tox
deploy:
provider: pypi
user: skioo
password:
secure: TLVygdPWAdjyqMpcQoNMUGfsf2OTouc2FygktGIkSH86jj4nwsHFEvELtscoNwXbDABWt6mC1k9zvTFCWrH718FQgoZmLZw59sWNNaXnYCmCgeU2lxOsg5V8D0bLVgV7bheJ9kPCa6tphaop8R+fmCQht50wWDhXS9AK51EucspffEL1OaUbShhteUkJXctadn+P3KaFWEJBGX+AJyCsCxtTYlN9EzHbil6SPpSddthiqiGSg3KBdxKeKlB+B4rP+e7PQGnEE4TPGS293DZDDo8yLzJi4YDtCpjQDuOxFMyWskzj21WlLMY5UW8rqMydMY/OTyfRdUYZXvcl9GGBFMc/ZgMsI5vcdCRbOMsBdOg1mMiuw6IWwuAAU0eNn10IE3E56AxiRDK4W8V7B5qTk60zHQbYb8K3nxXl8y+lFL0oy0EX/JwX8ECnb1Dpc+MWVawrAQAPAQuR/Y+JZhmycKwI0qxe3957HS1zeVgB3SMT62c+as1wvRu11o+DZfSn4qMq+QzjFpcQLqriSjPSzRGHO41py7leNRtyxBmnBFKzLkVCzNjRvgrrFn5i5YZnYmV826umQNh0khC7w3S5Eh46w1pfnfNlFcUUtEiapKZdXrJVaTgIYHa06acgjEFZMzXDUsFFRk4LTbIrV2zJq/td0X9F4foCnbbj6CvWSmg=
distribution: sdist bdist_wheel
on:
tags: true
- stage: deploy
install: skip
script: skip
deploy:
provider: pypi
user: skioo
password:
secure: TLVygdPWAdjyqMpcQoNMUGfsf2OTouc2FygktGIkSH86jj4nwsHFEvELtscoNwXbDABWt6mC1k9zvTFCWrH718FQgoZmLZw59sWNNaXnYCmCgeU2lxOsg5V8D0bLVgV7bheJ9kPCa6tphaop8R+fmCQht50wWDhXS9AK51EucspffEL1OaUbShhteUkJXctadn+P3KaFWEJBGX+AJyCsCxtTYlN9EzHbil6SPpSddthiqiGSg3KBdxKeKlB+B4rP+e7PQGnEE4TPGS293DZDDo8yLzJi4YDtCpjQDuOxFMyWskzj21WlLMY5UW8rqMydMY/OTyfRdUYZXvcl9GGBFMc/ZgMsI5vcdCRbOMsBdOg1mMiuw6IWwuAAU0eNn10IE3E56AxiRDK4W8V7B5qTk60zHQbYb8K3nxXl8y+lFL0oy0EX/JwX8ECnb1Dpc+MWVawrAQAPAQuR/Y+JZhmycKwI0qxe3957HS1zeVgB3SMT62c+as1wvRu11o+DZfSn4qMq+QzjFpcQLqriSjPSzRGHO41py7leNRtyxBmnBFKzLkVCzNjRvgrrFn5i5YZnYmV826umQNh0khC7w3S5Eh46w1pfnfNlFcUUtEiapKZdXrJVaTgIYHa06acgjEFZMzXDUsFFRk4LTbIrV2zJq/td0X9F4foCnbbj6CvWSmg=
distribution: sdist bdist_wheel
on:
tags: true
25 changes: 22 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
django-netaxept-gateway
=======================

Tested on python 3.5 and django 2.0.7
[![Build Status](https://travis-ci.org/skioo/django-netaxept-gateway.svg?branch=master)](https://travis-ci.org/skioo/django-netaxept-gateway)
[![PyPI version](https://badge.fury.io/py/django-netaxept-gateway.svg)](https://badge.fury.io/py/django-netaxept-gateway)
[![Requirements Status](https://requires.io/github/skioo/django-netaxept-gateway/requirements.svg?branch=master)](https://requires.io/github/skioo/django-netaxept-gateway/requirements/?branch=master)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)

Requirements
------------

* Python: 3.6 and over
* Django: 2.0 and over


Installation
Expand Down Expand Up @@ -62,8 +71,18 @@ TODO
- On prod (where debug is turned off), errors in the admin after invoking the gateway are shown as a useless grey page.


To work on this code
--------------------
Development
-----------

To install all dependencies:

pip install -e .


To run tests:

pip install pytest-django
pytest



5 changes: 5 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[mypy]
ignore_missing_imports = True

[mypy-netaxept.migrations.*]
ignore_errors = True
2 changes: 1 addition & 1 deletion netaxept/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '0.0.2'
__version__ = '0.2.0'
__copyright__ = 'Copyright (c) 2018, skioo SA'
__license__ = 'MIT'
__URL__ = 'https://github.com/skioo/django-netaxept-gateway'
8 changes: 4 additions & 4 deletions netaxept/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def link_to_payment(obj):
text)


link_to_payment.short_description = 'Payment'
link_to_payment.short_description = 'Payment' # type: ignore


@admin.register(Operation)
Expand Down Expand Up @@ -176,7 +176,7 @@ def auth_button(self, obj):
else:
return '-'

auth_button.short_description = 'Auth'
auth_button.short_description = 'Auth' # type: ignore

def capture_button(self, obj):
if obj.success:
Expand All @@ -185,7 +185,7 @@ def capture_button(self, obj):
else:
return '-'

capture_button.short_description = 'Capture'
capture_button.short_description = 'Capture' # type: ignore

def credit_button(self, obj):
if obj.success:
Expand All @@ -194,4 +194,4 @@ def credit_button(self, obj):
else:
return '-'

credit_button.short_description = 'Credit'
credit_button.short_description = 'Credit' # type: ignore
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[flake8]
exclude = .git, .tox, .env, */migrations/*
exclude = .git, .tox, .direnv, */migrations/*
max-line-length = 119

4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
url=netaxept.__URL__,
download_url='https://pypi.python.org/pypi/django-datatrans-gateway',
install_requires=[
'Django>=2.0',
'Django>=2.0,<2.2',
'structlog',
'suds2',
'requests',
Expand All @@ -36,7 +36,7 @@
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
],
)
2 changes: 2 additions & 0 deletions tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
]

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'netaxept',
'tests',
Expand Down
12 changes: 7 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
[tox]
envlist =
{py35,py36}-{django207}-test
py35-django202-{checkmigrations,flake,mypy}
{py36,py37}-{django20, django21}-test
py37-django21-{checkmigrations,flake,mypy}

[testenv]
basepython =
py35: python3.5
py36: python3.6
py37: python3.7
commands =
test: py.test tests
checkmigrations: ./manage.py makemigrations --check --dry-run
flake: flake8
mypy: mypy .
deps =
django207: Django>=2.0.7,<2.1
django20: Django>=2.0,<2.1
django21: Django>=2.1,<2.2
structlog
suds2
requests
pytest-django
flake: flake8
flake8
mypy

0 comments on commit 4f9bee3

Please sign in to comment.