Notes for developers
Make sure to work in a suitable virtual environment. See Using a Python virtual environment for more information.
Running tests
ViPErLEED comes with a suite of tests and uses
pytest for testing.
The TensErLEED source code should be available on the testing machine
(repository viperleed-tensorleed
) and the VIPERLEED_TENSORLEED
environment variable should be set. See also Tensor-LEED source code.
Also make sure to have compiled the EEASiSSS source code.
Tests are not distributed with the viperleed
package on
pypi. To run the tests, clone the
ViPErLEED GitHub repository, then install the test-related dependencies via
python -m pip install --upgrade -r requirements/tests.txt
To execute tests, navigate to your local copy of the ViPErLEED GitHub repository, then run
python -m pytest .
Important
Notice that this will execute the tests against the version of viperleed
that you have currently installed on your system. If you are working on
developing the code, and would like to test the most recent changes, make
sure to first install viperleed
in editable mode in your environment.
See editable_install.
If you also would like to produce coverage reports, install coverage via
python -m pip install coverage
then, in your local copy of the viperleed
repository, run
python -m coverage run -m pytest .
python -m coverage html
Using editable installations
ViPErLEED is installed from source using the code in the ViPErLEED GitHub repository. It
uses the pyproject.toml
file. To install an
editable version,
navigate to your copy of the viperleed
repository, and use
python -m pip install -e .[<options>]
Editable installations from pyproject.toml
files
require pip>=21.3
. Update your pip
with
python -m pip install --upgrade pip
Building this documentation
The source for this documentation is not distributed with the viperleed
package on pypi. The sources of
the documentation are available in the ViPErLEED GitHub repository. To build the documentation,
you will need to install additional dependencies. You can install them by
running
python -m pip install --upgrade -r requirements/tests.txt
in your local copy of the ViPErLEED GitHub repository.
Note that the documentation can only be built with Python ≥3.9 because of dependency-resolution issues.
Navigate to the doc
subfolder of viperleed
, then
make html
or
make latexpdf
Producing the PDF documentation requires a working LaTeX installation on your system.
Building viperleed
for distribution
Install the distribution dependencies by running
python -m pip install --upgrade -r requirements/dist.txt
in your local copy of the ViPErLEED GitHub repository.
PyPi
Follow the instructions under https://packaging.python.org/en/latest/tutorials/packaging-projects/.
Installing all development dependencies
Development of ViPErLEED requires a few more dependencies than those in the distribution version of the package. You can install all of them at once by running
python -m pip install --upgrade -r requirements/dev.txt
in your local copy of the ViPErLEED GitHub repository.