Developer Installation#

Install autoplex from source, by cloning the repository via github

git clone https://github.com/JaGeo/autoplex.git
cd autoplex
pip install -e .[strict,dev,tests,docs]

This will install autoplex will all dependencies for tests, pre-commit and docs building. However, note that non-python programs like buildcell and julia needed for ACE potential fitting will not be installed with above command. One needs to install these seperately.

Alternatively, one can use the devcontainer provided to have your developer environment setup automatically in your IDE. It has been tested to work in VSCode and PyCharm. Only prerequisite is one has docker installed on the system as it uses the published docker images to create this developer env. One can also simply use GitHub Codespaces to use the devcontainer. The codespaces environment will have all the required dependencies installed.

Running unit tests#

Unit tests can be run from the source folder using pytest.

pytest

This will run all the tests.

To get a detailed report of test coverage you can use following command

pytest --cov=autoplex --cov-report term-missing --cov-append

If you feel test execution takes too long locally, you can speedup the execution using pytest-xdist. Install this in library in your environment using

pip install pytest-xdist

Once installed, you can now use multiple processors to run your tests. For example, if you want to use 8 processors to run tests in parallel, run

pytest -n 8

We rely on pytest-split to run tests in parallel on github workflow, thus it is necessary to update the test-durations files in the repository, incase you add new tests. To generate this file, use

pytest --cov=autoplex --cov-append --splits 1 --group 1 --durations-path ./tests/test_data/.pytest-split-durations --store-durations

Trouble shooting stuck tests#

Incase your test execution get stuck, try adding the prefix OMP_NUM_THREADS=1 before pytest. Below is an example snippet

OMP_NUM_THREADS=1 pytest

Building the documentation locally#

The autoplex documentation can be built using the sphinx package.

The docs can be built to the _build directory:

sphinx-build -W docs _build