mirror of
https://github.com/cdtools-developers/cdtools.git
synced 2026-09-25 19:52:10 +02:00
update readme and installation docs
This commit is contained in:
@@ -26,12 +26,57 @@ model.compare(dataset) # See how the simulated and measured patterns compare
|
||||
plt.show()
|
||||
```
|
||||
|
||||
# Installation
|
||||
|
||||
CDTools can be installed in several ways depending on your needs. For most users, installation from pypi is recommended. For developers or those who want the latest features, installation from source is available.
|
||||
|
||||
## Installation from pypi
|
||||
|
||||
CDTools can be installed via pip as the [cdtools-py](https://pypi.org/project/cdtools-py/) package on [PyPI](https://pypi.org/):
|
||||
|
||||
```bash
|
||||
$ pip install cdtools-py
|
||||
```
|
||||
|
||||
or using [uv](https://github.com/astral-sh/uv):
|
||||
|
||||
```bash
|
||||
$ uv pip install cdtools-py
|
||||
```
|
||||
|
||||
## Installation from Source
|
||||
|
||||
For development or to access the latest features, CDTools can be installed directly from source:
|
||||
|
||||
|
||||
```bash
|
||||
$ git clone https://github.com/cdtools-developers/cdtools.git
|
||||
$ cd cdtools
|
||||
$ pip install -e .
|
||||
```
|
||||
|
||||
|
||||
or using [uv](https://github.com/astral-sh/uv):
|
||||
|
||||
```bash
|
||||
$ git clone https://github.com/cdtools-developers/cdtools.git
|
||||
$ cd cdtools
|
||||
$ uv pip install -e .
|
||||
```
|
||||
|
||||
## Installing for Contributors (with tests and docs dependencies)
|
||||
|
||||
If you want to run the test suite or build the documentation, install with the extra dependencies:
|
||||
|
||||
```bash
|
||||
$ pip install -e ."[tests,docs]"
|
||||
```
|
||||
or with uv:
|
||||
```bash
|
||||
$ uv pip install -e ."[tests,docs]"
|
||||
```
|
||||
|
||||
|
||||
Further documentation is found [here](https://cdtools-developers.github.io/cdtools/).
|
||||
|
||||
|
||||
|
||||
@@ -15,6 +15,14 @@ To install from `PyPI`_, run:
|
||||
|
||||
$ pip install cdtools-py
|
||||
|
||||
or you can use `uv`_ for a faster installation:
|
||||
|
||||
.. _`uv`: https://github.com/astral-sh/uv
|
||||
|
||||
.. code:: bash
|
||||
|
||||
$ uv pip install cdtools-py
|
||||
|
||||
Pytorch, a major dependence of CDTools, often needs to be installed with a specific CUDA version for machine compatability. If you run into issues with pytorch, consider first installing pytorch into your environment using the instructions on `the pytorch site`_.
|
||||
|
||||
.. _`the pytorch site`: https://pytorch.org/get-started/locally/
|
||||
@@ -31,18 +39,51 @@ The source code for CDTools is hosted on `Github`_.
|
||||
.. _`Github`: https://github.com/cdtools-developers/cdtools
|
||||
|
||||
|
||||
Step 2: Install Dependencies
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The major dependency for CDTools is pytorch version 2.3.0 or greater. Because the details of the pytorch installation can vary depending on platform and GPU availability, it is recommended that you first install pytorch using the instructions on `the pytorch site`_. The remaining dependencies can be installed by running the following command from the top level directory of the git repository:
|
||||
To download the source code, you can either clone the repository using git:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
$ pip install -r requirements.txt
|
||||
|
||||
Note that several optional dependencies used for testing and documentation will also be installed. The full set of dependencies and minimum requirements are listed below. CDTools is reguarly tested with the latest versions of these packages and with python 3.8 through 3.12.
|
||||
$ git clone https://github.com/cdtools-developers/cdtools.git
|
||||
|
||||
Required dependencies:
|
||||
or you can download a zip file of the repository from the `releases page`_.
|
||||
|
||||
.. _`releases page`: https://github.com/cdtools-developers/cdtools/releases
|
||||
|
||||
|
||||
Step 2: Install
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
Move to the directory where you downloaded the source code. It is recommended that you create a new python virtual environment to install CDTools into.
|
||||
|
||||
Installation using pip and uv. Editable mode is recommended for development purposes and is added with the `-e` flag.
|
||||
|
||||
.. code:: bash
|
||||
|
||||
$ pip install -e .
|
||||
|
||||
or using uv:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
$ uv pip install -e .
|
||||
|
||||
|
||||
To install the required test and documentation dependencies as well, use:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
$ pip install -e ."[tests,docs]"
|
||||
|
||||
or using uv:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
$ uv pip install -e ."[tests,docs]"
|
||||
|
||||
CDTools is reguarly tested with the latest versions of these packages and with python 3.8 through 3.12.
|
||||
|
||||
|
||||
Required dependencies (see pyproject.toml for all details):
|
||||
|
||||
* `numpy <http://www.numpy.org>`_ >= 1.0
|
||||
* `scipy <http://www.scipy.org>`_ >= 1.0
|
||||
@@ -63,30 +104,13 @@ Optional dependencies for building docs:
|
||||
* `sphinx_rtd_theme <https://sphinx-rtd-theme.readthedocs.io/en/stable/>`_ >= 0.5.1
|
||||
|
||||
|
||||
Step 3: Install
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
To install CDTools, run the following command from the top level directory of the git repository:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
$ pip install -e . --no-deps
|
||||
|
||||
|
||||
This will install CDTools in developer mode, so that changes to the code will propagate to the installed version immediately. This is best if you plan to actively develop CDTools. If you simply need a custom environment, you can also install CDTools in standard mode using:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
$ pip install . --no-deps
|
||||
|
||||
|
||||
Step 4: Run The Tests
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
Optional step 4: Run The Tests
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
To ensure that the installation has worked correctly, it is recommended that you run the unit tests. Execute the following command from the top level directory of the git repository:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
$ pytest
|
||||
$ python -m pytest
|
||||
|
||||
If any tests fail, make sure that you have all the noted dependencies properly installed. If you do, and things still aren't working, `open an issue on the github page <https://github.com/cdtools-developers/cdtools/issues>`_ and we'll get to the bottom of it.
|
||||
|
||||
Reference in New Issue
Block a user