Skip to content

Fixing CI and adding sorted_terms to PreparedData #141

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[flake8]
max-line-length = 100
exclude = mypy-stubs
ignore = W,E731,F403
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pip-log.txt
.tox
nosetests.xml
htmlcov
test/data/*.json

# Translations
*.mo
Expand Down
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
language: python

python:
# - "3.4"
# - "3.3"
- "3.6"
- "3.5"
- "2.7"

env:
- DEPS="pandas jinja2=2.7.2 scipy joblib=0.8.4 numexpr pytest"
- DEPS="pandas<0.24.0a jinja2>=2.7.2 scipy joblib>=0.8.4 numexpr pytest"

before_install:
# conda instructions from http://conda.pydata.org/docs/travis.html
Expand All @@ -27,6 +27,7 @@ before_install:
- conda update -q conda
# Useful for debugging any issues with conda
- conda info -a
- export BOTO_CONFIG=/dev/null
install:
- conda create -n testenv --yes python=$TRAVIS_PYTHON_VERSION
- source activate testenv
Expand Down
17 changes: 17 additions & 0 deletions environment-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: test-env
channels:
- conda-forge/channel/main
- defaults
dependencies:
- wheel>=0.23.0
- numpy>=1.9.2
- scipy>=0.18.0
- pandas>=0.17.0,<0.24.0a
- joblib>=0.8.4
- jinja2>=2.7.2
- numexpr
- pytest
- future
- funcy
- gensim
- numpydoc>=0.4
7 changes: 4 additions & 3 deletions pyLDAvis/_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
import random
import json
import jinja2
import numpy
import re
import os
from ._server import serve
from .utils import get_id, write_ipynb_local_js, NumPyEncoder
from ._prepare import PreparedData
Expand Down Expand Up @@ -112,6 +110,7 @@
"notebook": REQUIREJS_HTML,
"general": GENERAL_HTML}


def prepared_data_to_html(data, d3_url=None, ldavis_url=None, ldavis_css_url=None,
template_type="general", visid=None, use_http=False):
"""Output HTML with embedded visualization
Expand Down Expand Up @@ -178,6 +177,7 @@ def prepared_data_to_html(data, d3_url=None, ldavis_url=None, ldavis_css_url=Non
vis_json=data.to_json(),
ldavis_css_url=ldavis_css_url)


def display(data, local=False, **kwargs):
"""Display visualization in IPython notebook via the HTML display hook

Expand Down Expand Up @@ -221,6 +221,7 @@ def display(data, local=False, **kwargs):

return HTML(prepared_data_to_html(data, **kwargs))


def show(data, ip='127.0.0.1', port=8888, n_retries=50,
local=True, open_browser=True, http_server=None, **kwargs):
"""Starts a local webserver and opens the visualization in a browser.
Expand Down Expand Up @@ -257,7 +258,7 @@ def show(data, ip='127.0.0.1', port=8888, n_retries=50,
kwargs['d3_url'] = '/d3.js'
kwargs['ldavis_css_url'] = '/LDAvis.css'
files = {'/LDAvis.js': ["text/javascript",
open(urls.LDAVIS_LOCAL, 'r').read()],
open(urls.LDAVIS_LOCAL, 'r').read()],
'/LDAvis.css': ["text/css",
open(urls.LDAVIS_CSS_LOCAL, 'r').read()],
'/d3.js': ["text/javascript",
Expand Down
Loading