diff --git a/.drone.yml b/.drone.yml index f7cc74d..0c07a22 100644 --- a/.drone.yml +++ b/.drone.yml @@ -7,4 +7,5 @@ steps: - name: python-tests image: themattrix/tox commands: - - tox + # python 3.9 is not included in themattrix/tox yet + - tox -e py36,py37,py38,py36-lint,py37-lint,py38-lint diff --git a/README.md b/README.md index 7426900..32d1568 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,16 @@ # Simplex dictionary -[![Python Versions](https://img.shields.io/badge/python-3.6%20|%203.7-blue.svg)](https://img.shields.io/badge/python-3.6%20|%203.7-blue.svg) +[![Python Versions](https://img.shields.io/badge/python-3.6%20|%203.7-blue.svg)](https://img.shields.io/badge/python-3.6%20|%203.7%20|%203.8%20|%203.9-blue.svg) [![License](https://img.shields.io/badge/license-MIT-green.svg)](https://img.shields.io/badge/license-MIT-green.svg) [![Build Status](https://drone.typename.fr/api/badges/mikael.capelle/simplex/status.svg)](https://drone.typename.fr/mikael.capelle/simplex) -`simplex` is a small python module that implements a `simplex_dictionary` structure representing -a dictionary for the [Simplex algorithm](https://en.wikipedia.org/wiki/Simplex_algorithm). +`simplex` is a small python module that implements a `simplex_dictionary` structure +representing a dictionary for the +[Simplex algorithm](https://en.wikipedia.org/wiki/Simplex_algorithm). +The package is intended for educational purpose, e.g., to have students implement the +Simplex algorithm based on the structure. -# Basic usage +## Basic usage The following code creates a simplex dictionary with 5 variables: @@ -38,10 +41,15 @@ sdict.z = 0 # Coefficients of the non-basic variables in the objective function: sdict.c[x1] = 3 sdict.c[x2] = 2 + +# Trying to set the coefficients for a basic variables that should be 0 raise an +# exception: +sdict.c[x3] = 4 # raises "x_3 is not a non-basic variable." +sdict.b[x1] = 1 # raises "x_1 is not a basic variable." ``` -When using the `simplex` module within a jupyter notebook, the `display()` method outputs -a latex version of the dictionary: +When using the `simplex` module within a jupyter notebook, the `display()` method +outputs a latex version of the dictionary: ```python sdict.display(name='S_0') diff --git a/setup.cfg b/setup.cfg index 36ee50d..3e9f8d8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -9,14 +9,11 @@ extend-ignore = warn_return_any = True warn_unused_configs = True -[mypy-pytest.*] -ignore_missing_imports = True - [mypy-IPython.*] ignore_missing_imports = True [tox:tox] -envlist = py{36,37,38},py{36,37,38}-lint +envlist = py{36,37,38,39},py{36,37,38,39}-lint [testenv] deps = @@ -24,13 +21,14 @@ deps = commands = pytest tests -[testenv:py{36,37,38}-lint] +[testenv:py{36,37,38,39}-lint] deps = black flake8 flake8-black mypy isort + commands = black --check --diff setup.py simplex tests flake8 simplex tests diff --git a/setup.py b/setup.py index 4e1e7a6..066748a 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ with open("README.md", "r") as fh: test_requires = ["pytest", "mypy", "black", "flake8", "flake8-black"] setuptools.setup( - name="simplex", # Replace with your own username + name="simplex-dictionary", version="0.0.1", author="Mikaƫl Capelle", author_email="capelle.mikael@gmail.com", diff --git a/simplex/__init__.py b/simplex/__init__.py index 9fdac14..677ff21 100644 --- a/simplex/__init__.py +++ b/simplex/__init__.py @@ -1,4 +1,3 @@ # -*- encoding: utf-8 -*- - from .simplex_dictionary import simplex_dictionary # noqa: F401 diff --git a/simplex/py.typed b/simplex/py.typed new file mode 100644 index 0000000..e69de29