Commit 59a13847 authored by schmittu's avatar schmittu
Browse files

initial setup

parents
Pipeline #42919 passed with stages
in 1 minute and 57 seconds
# local venvs from tox
.tox
# created during packaging
workship_demo.egg-info
# virtual environments
venv*
# vim backup files
**/.*.sw?
# byte compiled files
**/*.pyc
**/__pycache__
image: python:3.7-stretch
stages:
- style
- tests
before_script:
- pip install -U pip setuptools
- pip install tox
tests:
script:
- tox -r -vv -e py37
stage: tests
style:
script:
- tox -r -vv -e flake8
allow_failure: true
stage: style
pytest
tox
flake8
[flake8]
max-line-length = 88
select = C,E,F,W,B,B950
ignore = E501,W503,E203
#! /usr/bin/env python
# Copyright © 2019 Uwe Schitt <uwe.schmitt@id.ethz.ch>
from setuptools import setup
setup(
name="workship_demo",
version="0.1",
description="this is a demo for python packaging and ci testing",
author="Uwe Schmitt",
author_email="uwe.schmitt@id.ethz.ch",
license="MIT",
packages=["workship_demo"],
zip_safe=False,
)
#! /usr/bin/env python
# encoding: utf-8
# Copyright © 2019 Uwe Schitt <uwe.schmitt@id.ethz.ch>
from workship_demo.compute import add
def test_add():
assert add(1, 1) == 2
assert add(-1, 1) == 0
assert add("a", "b") == "ab"
[tox]
envlist = py27, py37, flake8
[testenv]
commands = py.test tests/
deps = pytest
[testenv:flake8]
commands = flake8 workship_demo tests
deps = flake8
skip_install = True
skipsdist = True
#! /usr/bin/env python
# Copyright © 2019 Uwe Schitt <uwe.schmitt@id.ethz.ch>
import sys
from .compute import add
if __name__ == "__main__":
assert len(sys.argv) == 3, "need two arguments"
arg_0, arg_1 = sys.argv[1:]
result = add(arg_0, arg_1)
print("{} + {} = {}".format(arg_0, arg_1, result))
#! /usr/bin/env python
# Copyright © 2019 Uwe Schitt <uwe.schmitt@id.ethz.ch>
def add(x, y):
return x + y
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment