Skip to content

Commit

Permalink
Merge pull request #566 from GavinHuttley/develop
Browse files Browse the repository at this point in the history
Simplifications for rtd builds
  • Loading branch information
GavinHuttley committed Mar 10, 2020
2 parents e4a6da7 + 72d7bd9 commit 8995534
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 34 deletions.
13 changes: 1 addition & 12 deletions doc/rtd-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,19 @@ channels:
- conda-forge
- plotly
dependencies:
- nodejs
- python=3.7
- pandoc
- plotly
- plotly-orca
- pip
- pip:
- numpy
- numpydoc
- tqdm
- scitrack
- tinydb
- pandas
- jupyterlab
- jupyter_client
- psutil
- ipython
- ipykernel
- ipywidgets
- sphinx>=1.6
- nbsphinx
- nbformat
- jupyterlab
- nbconvert!=5.4
- jupytext
- sphinxcontrib-bibtex
- sphinx_rtd_theme
- sphinx-gallery
33 changes: 17 additions & 16 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,31 +169,32 @@ def CythonExtension(module_name, **kw):
],
packages=find_packages(where="src"),
package_dir={"": PACKAGE_DIR},
install_requires=["numpy", "pandas", "plotly", "scitrack", "tqdm", "tinydb"],
install_requires=["numpy", "plotly", "scitrack", "tqdm", "tinydb"],
extras_require={
"dev": [
"pytest-azurepipelines",
"jupyterlab",
"black",
"click",
"ipykernel",
"ipykernel",
"ipywidgets",
"click",
"sphinx",
"sphinx_rtd_theme",
"sphinx-autobuild",
"sphinxcontrib-bibtex",
"numpydoc",
"nbformat",
"nbconvert",
"isort",
"jupyter_client",
"ipykernel",
"nbsphinx",
"jupyterlab",
"jupytext",
"pytest",
"nbconvert",
"nbformat",
"nbsphinx",
"numpydoc",
"pandas",
"psutil",
"pytest-azurepipelines",
"pytest-cov",
"pytest>=4.3.0",
"sphinx",
"sphinx-autobuild",
"sphinx_rtd_theme",
"sphinxcontrib-bibtex",
"tox",
"black",
"isort",
]
},
ext_modules=cythonize(
Expand Down
19 changes: 13 additions & 6 deletions tests/test_util/test_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,20 @@
import pickle

from tempfile import TemporaryDirectory
from unittest import TestCase, main, skipIf

import numpy

from numpy.testing import assert_equal
from pandas import DataFrame

from cogent3 import load_table, make_table
from cogent3.util.table import Table, cast_to_array, formatted_array
from cogent3.util.unit_test import TestCase, main


try:
from pandas import DataFrame
except ImportError:
DataFrame = None


__author__ = "Thomas La"
Expand Down Expand Up @@ -447,12 +452,13 @@ def test_dunder_repr_eq_str(self):
r = repr(t)
self.assertTrue(r.startswith(s))

@skipIf(DataFrame is None, "pandas not installed")
def test_make_table_from_dataframe(self):
"""makes a table from a pandas data frame"""
df = DataFrame(data=[[0, 1], [3, 7]], columns=["a", "b"])
t = make_table(data_frame=df)
self.assertEqual(t.columns["a"], [0, 3])
self.assertEqual(t.columns["b"], [1, 7])
assert_equal(t.columns["a"], [0, 3])
assert_equal(t.columns["b"], [1, 7])
with self.assertRaises(TypeError):
make_table(data_frame="abcde")

Expand Down Expand Up @@ -753,10 +759,10 @@ def test_with_new_column(self):
# now using a string expression
t8 = Table(header=self.t8_header, data=self.t8_rows, row_ids="edge.name")
n = t8.with_new_column("YZ", callback="y+z")
self.assertEqual(n.columns["YZ"], [9.0, 9.0])
assert_equal(n.columns["YZ"], [9.0, 9.0])
# if the new column alreayb exists, the new table has the newest column
n2 = t8.with_new_column("YZ", callback="y*z")
self.assertEqual(n2.columns["YZ"], [18.0, 18.0])
assert_equal(n2.columns["YZ"], [18.0, 18.0])
self.assertNotEqual(id(n), id(n2))
# bu the column arrays that have not changed should be equal
for c in n.columns:
Expand Down Expand Up @@ -1031,6 +1037,7 @@ def test_tail(self):
self.assertEqual(tail.data.tolist(), self.t1_rows[-3:])
table.display = display

@skipIf(DataFrame is None, "pandas not installed")
def test_to_dataframe(self):
"""produces a dataframe"""
t = Table(header=self.t1_header, data=self.t1_rows)
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ deps = numpy
click
pytest
scitrack
pandas
doctest: nbformat
doctest: nbconvert
doctest: jupyter_client
Expand Down

0 comments on commit 8995534

Please sign in to comment.