From 99231970b658e2123859d28f694dfcccd8851655 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yannik=20Sch=C3=A4lte?= <31767307+yannikschaelte@users.noreply.github.com> Date: Fri, 12 Mar 2021 14:45:53 +0100 Subject: [PATCH] Fix pydocstyle was not called; update swig (#120) * update swig * add pydocstyle, min versions of flake8 * fix pydocstyle --- .github/workflows/install_deps.sh | 4 ++-- tests/__init__.py | 1 + tox.ini | 36 +++++++++++++++---------------- yaml2sbml/YamlModel.py | 4 ++++ yaml2sbml/version.py | 2 ++ yaml2sbml/yaml2sbml.py | 1 - 6 files changed, 27 insertions(+), 21 deletions(-) diff --git a/.github/workflows/install_deps.sh b/.github/workflows/install_deps.sh index c475457..60bcc4f 100755 --- a/.github/workflows/install_deps.sh +++ b/.github/workflows/install_deps.sh @@ -3,7 +3,7 @@ # Install tox pip install tox -# Update aptitude +# Update apt package lists sudo apt-get update # iterate over optional dependencies @@ -12,7 +12,7 @@ for par in "$@"; do amici) # for amici sudo apt-get install \ - swig3.0 libatlas-base-dev libhdf5-serial-dev + swig libatlas-base-dev libhdf5-serial-dev ;; doc) diff --git a/tests/__init__.py b/tests/__init__.py index e69de29..232940a 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -0,0 +1 @@ +"""yaml2sbml tests.""" diff --git a/tox.ini b/tox.ini index 127a7c8..0541ab1 100644 --- a/tox.ini +++ b/tox.ini @@ -20,10 +20,10 @@ envlist = [testenv] # Dependencies deps = - coverage - pytest - pytest-cov - pytest-console-scripts + coverage >= 5.5 + pytest >= 6.2.2 + pytest-cov >= 2.11.1 + pytest-console-scripts >= 1.1.0 # Sub-environments # inherit settings defined in the base @@ -32,8 +32,7 @@ deps = # No installation of yaml2sbml required skip_install = true deps = - pygments - pyroma + pyroma >= 3.1 commands = pyroma --min=10 . description = Run pyroma to check the package friendliness @@ -41,20 +40,21 @@ description = [testenv:flake8] skip_install = true deps = - flake8 - flake8-bandit - flake8-bugbear - flake8-colors - flake8-commas - flake8-comprehensions - flake8-print - flake8-use-fstring - pep8-naming - pydocstyle + flake8 >= 3.8.3 + flake8-bandit >= 2.1.2 + flake8-bugbear >= 20.1.4 + flake8-colors >= 0.1.6 + flake8-commas >= 2.0.0 + flake8-comprehensions >= 3.2.3 + flake8-print >= 3.1.4 + flake8-use-fstring >= 1.1 + pep8-naming >= 0.11.1 + pydocstyle >= 5.1.1 commands = flake8 yaml2sbml tests setup.py + pydocstyle yaml2sbml tests setup.py description = - Run flake8 with various plugins + Run flake8 with various plugins, and pydocstyle [testenv:unittests] commands = @@ -67,7 +67,7 @@ description = [testenv:notebooks] deps = - nbmake + nbmake >= 0.4 # Extras required from yaml2sbml extras = examples commands = diff --git a/yaml2sbml/YamlModel.py b/yaml2sbml/YamlModel.py index 37fa606..f68630b 100644 --- a/yaml2sbml/YamlModel.py +++ b/yaml2sbml/YamlModel.py @@ -181,16 +181,20 @@ def _get_reduced_model_dict(self) -> dict: # functionalities regarding the time def is_set_time(self): + """Check whether there is a time variable.""" return 'variable' in self._yaml_model['time'].keys() def set_time(self, time_variable: str): + """Set time variable.""" self._yaml_model['time'] = {'variable': time_variable} def delete_time(self): + """Delete time variable.""" self._yaml_model['time'] = {} def get_time(self): + """Get time variable.""" if self.is_set_time(): return self._yaml_model['time']['variable'] else: diff --git a/yaml2sbml/version.py b/yaml2sbml/version.py index fc79d63..0f1ea38 100644 --- a/yaml2sbml/version.py +++ b/yaml2sbml/version.py @@ -1 +1,3 @@ +"""yaml2sbml version.""" + __version__ = '0.2.1' diff --git a/yaml2sbml/yaml2sbml.py b/yaml2sbml/yaml2sbml.py index 90c7467..1e007c1 100644 --- a/yaml2sbml/yaml2sbml.py +++ b/yaml2sbml/yaml2sbml.py @@ -224,7 +224,6 @@ def _create_time(model: sbml.Model, time_var: str): model: the SBML model to which the species will be added. time_var: str, the time variable """ - if time_var == 'time': return