You should be able to install Empress as described in the README. However,
instead of running pip install .
, please run pip install -e .[all]
. This
will install some various dependencies needed to test Empress' python code. In
addition, make sure to periodically update to the latest development version of
Emperor using pip install git+https://github.com/biocore/emperor.git
.
You will also need to install a few Node.js packages in order to test Empress' JavaScript code.
npm install -g qunit-puppeteer jshint [email protected]
If you don't have npm
installed, you will need to install that first.
Note: if you can't install puppeteer, the (JavaScript) test suite can be
run using a web browser by opening the page in tests/index.html
.
The Makefile contained in the root of the Empress repository is the easiest way to run Empress' tests.
You can run both the Python and JavaScript tests by running
make test
If you just want to run the Python or JavaScript tests, you can run
make pytest
or make jstest
respectively.
If you add HTML elements to EMPress' HTML code that the JavaScript code relies
on, you will also need to add these elements to the tests/index.html
file.
Ideally this would not be necessary, but for now it is. (Failing to do this can
cause obscure error messages from the JS tests.)
Also, loading the test index.html
fails on Firefox for some of the Legend
tests: see #435. To circumvent this,
if you need to load the tests in the browser (rather than using puppeteer),
we recommend using a different browser for the time being.
For convenience, a utility script ./tests/python/make-dev-page.py
is bundled
in the test suite. This script works best if you install the package in
"editable mode" i.e. by running pip install -e .
from the base directory.
After installing the package, the script can be run without any arguments. This
will load the moving pictures dataset and create a page
development-page.html
. Using this page developers can modify CSS and JS files
and simply reload the page on the browser to see their changes take effect.
Alternatively, you can set the input data for development using the various
options and arguments in the script. For a full list of options and arguments,
you can run ./tests/python/make-dev-page.py --help
.
Note, modifications to the Python code, or the template code require that you
re-generate development-page.html
.
Empress' python code is linted/style-checked using flake8
.
Empress' JavaScript code is linted using jshint
and style-checked using
prettier
.
Assuming you have these dependencies installed (see above for instructions), you can just run
make stylecheck
to see if your code passes these checks.
make stylecheck
will be run on GitHub Actions, so it's useful to run this
periodically while developing to make sure that your code looks good (and so
you can address any issues as they come up, rather than all at once when trying
to submit a pull request).
If you'd like to ensure that make stylecheck
is run automatically before you
can commit something locally -- thus ensuring that the stuff you do commit
is well-formatted -- then you can run
make githook
to add on a pre-commit hook to your Empress git
repository that just runs make stylecheck
.
Although some code issues (e.g. many things identified by jshint) will require
manual resolution, you can use prettier
to automatically format your
JavaScript code. This can be done by just running
make jsstyle