Installation
This guide provides detailed instructions for installing NeoPDF
and its APIs for Rust, Python,
Fortran, and C/C++, as well as the command line interface (CLI).
Development with Pixi
For developers who want to contribute to NeoPDF or work with the source code and want a proper
environment manager, a pixi.toml
configuration is provided to work with the Pixi
environment and package manager. See the comprehensive Development with Pixi
guide for detailed instructions on setting up a reproducible development environment.
Where to store PDF sets?
By default, NeoPDF
stores PDF sets in ${HOME}/.local/share/neopdf
, however this can be
overwritten via the environment variable NEOPDF_DATA_PATH
to point to the LHAPDF path for
example.
Rust Crate
To use neopdf
in your Rust project, simply add the following to your Cargo.toml
:
Cargo will automatically fetch and compile the dependencies the next time you build your project with:
Python API
NeoPDF
is available on the Python Packaged Index (PyPI) as neopdf-hep
and therefore can be
installed easily with any of the Python's package managers. For example, using
pipx:
Development Option
Alternatively, to build the Python API from source, make sure that maturin
is installed, go into the neopdf_pyapi
directory, and then simply run:
This will build and install the NeoPDF
Python extension in your current environment.
C/C++ API
The simplest way to install the C API and the C++ OOP header is to download the pre-built libraries:
curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/Radonirinaunimi/neopdf/refs/heads/master/install-capi.sh | sh
To pass the installation directory for where to put the files, change the arguments of the shell as follows:
By default, the script will download the latest stable release. If you would like a specific version,
pass the version along with --version
:
Development Option
Alternatively, to build the C-API from source, first install cargo-c
:
Then go into the neopdf_capi
directory and run the following command:
export CARGO_C_INSTALL_PREFIX=${prefix} # Required for the OOP C++ header
cargo cinstall --release --prefix=${prefix}
This will install the library in the ${prefix}
path. This path can then be added to the PKG_CONFIG_PATH
and LD_LIBRARY_PATH
environment variables by running:
export LD_LIBRARY_PATH=${prefix}/lib:$LD_LIBRARY_PATH
export PKG_CONFIG_PATH=${prefix}/lib/pkgconfig:$PKG_CONFIG_PATH
Remember to source your shell configuration or restart your terminal for the changes to take effect.
Fortran API
In order to use the Fortran API, you have to install first the C/C++ API. Then, simply copy the
neopdf_fapi/neopdf.f90
in your working directory and generate the Fortran module:
If everything went fine, this will generate a neopdf.mod
file. You can now the module in your
fortran program by including the following:
CLI Tool
The Command Line Interface (CLI) to the NeoPDF
APIs is also available on the Python Packaged
Index (PyPI) as neopdf-cli
and therefore can be installed easily with any of the Python's
package managers. For example, using pipx:
Development Option
To build and install the NeoPDF command-line interface (CLI) from source, simply run:
This will compile the CLI in debug mode and make the neopdf
command available in your
cargo bin directory (usually ~/.cargo/bin
). You can then run neopdf --help
to see
the available commands.