From 302617e9583363dac2379cb0a865cefd9f2681e2 Mon Sep 17 00:00:00 2001 From: SP Mohanty <spmohanty91@gmail.com> Date: Fri, 17 May 2019 19:47:58 +0200 Subject: [PATCH] Addresses #30 - Consistently use requirements_dev for specifying the dependencies of the package --- .gitignore | 1 + MANIFEST.in | 1 + flatland/envs/observations.py | 4 ++-- setup.py | 20 ++++++++++++++------ tox.ini | 6 +++++- 5 files changed, 23 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 15fb17b1..a003eda1 100644 --- a/.gitignore +++ b/.gitignore @@ -109,3 +109,4 @@ ENV/ images/test/ +test_save.dat diff --git a/MANIFEST.in b/MANIFEST.in index 965b2dda..30bf97cf 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -3,6 +3,7 @@ include CONTRIBUTING.rst include HISTORY.rst include LICENSE include README.rst +include requirements_dev.txt recursive-include tests * recursive-exclude * __pycache__ diff --git a/flatland/envs/observations.py b/flatland/envs/observations.py index 0fdec364..651d8352 100644 --- a/flatland/envs/observations.py +++ b/flatland/envs/observations.py @@ -219,8 +219,8 @@ class TreeObsForRailEnv(ObservationBuilder): if possible_transitions[branch_direction]: new_cell = self._new_position(agent.position, branch_direction) - branch_observation, branch_visited = self._explore_branch(handle, new_cell, branch_direction, root_observation, - 1) + branch_observation, branch_visited = \ + self._explore_branch(handle, new_cell, branch_direction, root_observation, 1) observation = observation + branch_observation visited = visited.union(branch_visited) else: diff --git a/setup.py b/setup.py index 96afbe85..d1407035 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- """The setup script.""" - +import os from setuptools import setup, find_packages with open('README.rst') as readme_file: @@ -11,11 +11,19 @@ with open('README.rst') as readme_file: with open('HISTORY.rst') as history_file: history = history_file.read() -requirements = ['Click>=6.0', ] - -setup_requirements = ['pytest-runner', ] - -test_requirements = ['pytest', ] +# Gather requirements from requirements_dev.txt +# TODO : We could potentially split up the test/dev dependencies later +install_reqs = [] +requirements_path = 'requirements_dev.txt' +with open(requirements_path, 'r') as f: + install_reqs += [ + s for s in [ + line.strip(' \n') for line in f + ] if not s.startswith('#') and s != '' + ] +requirements = install_reqs +setup_requirements = install_reqs +test_requirements = install_reqs setup( author="S.P. Mohanty", diff --git a/tox.ini b/tox.ini index 5a97b7e1..1c9a1707 100644 --- a/tox.ini +++ b/tox.ini @@ -23,7 +23,10 @@ commands = make docs [testenv:coverage] basepython = python whitelist_externals = make -commands = make coverage +commands = + pip install -U pip + pip install -r requirements_dev.txt + make coverage [testenv] setenv = @@ -35,6 +38,7 @@ deps = ; -r{toxinidir}/requirements.txt commands = pip install -U pip + pip install -r requirements_dev.txt py.test --basetemp={envtmpdir} -- GitLab