Python API of the TREXIO library
Project description
TREXIO Python API
TREXIO provides a Python API, which enables interactive calls to the library. It facilitates the development of interfaces between different codes and can be used to convert data from one input/output file format into another.
Requirements
- python3 (>= 3.8)
- numpy (>= 1.17.3)
Installation from PyPI
In short, you can run the following command:
pip install trexio
However, it is good practice to first check for updates of the build-system packages. This can be achieved by running
python -m pip install --upgrade pip setuptools build wheel
Note: we highly recommend to use virtual environments to avoid compatibility issues and to improve reproducibility. For more details, see the corresponding part of the Python documentation.
Additional requirements (for installation from source)
- C compiler (gcc/icc/clang)
- HDF5 library (>= 1.8)
- pkgconfig (Python package)
- build (Python package)
- pytest (Python package)
Installation from source
- Download the
trexio-<version>.tar.gz
file with the latest Python API gzip -cd trexio-<version>.tar.gz | tar xvf -
cd trexio-<version>
pip install -r requirements.txt
(this installs all required python dependencies)- Export custom environment variables needed for the installation following the procedure below and replacing
/path/to/hdf5/
with your paths. The following two steps can be skipped if HDF5 is properly configured forpkg-config
(i.e. if executingpkg-config --libs hdf5
returns a list of options).export H5_CFLAGS=-I/path/to/hdf5/include
export H5_LDFLAGS=-L/path/to/hdf5/lib
On MacOS where HDF5 is installed with homebrew (i.e.brew install hdf5
), one can use the following:export H5_CFLAGS="-I$(brew --prefix hdf5)/include"
export H5_LDFLAGS="-L$(brew --prefix hdf5)/lib"
pip install .
(this installstrexio
in your environment)cd test && python -m pytest -v test_api.py
(this executes several tests that verify the installation)
You are ready to go!
Note:
installation based on pip
compiles its own C extension (shared library) called pytrexio
.
This extension is built from the TREXIO source files coupled to the wrapper code generated by SWIG.
The compiler options during this installation may differ from the ones used to compile the primary TREXIO API in C.
Furthermore, custom compiler flags provided to ./configure
or make
are not applied to the Python API.
Examples
An interactive Jupyter notebook called tutorial_benzene.ipynb
is provided in the examples
directory.
The notebook can be lauched either locally (see next section for details) or using pre-built environment on Binder.
Jupyter can be installed using pip install jupyter
. If you are not familiar with it, feel free to consult the Jupyter documentation.
Running the notebook
The example notebook can be launched using the following command:
jupyter notebook tutorial_benzene.ipynb
Additional steps needed to run a custom virtual environment in Jupyter notebooks
In some cases, it may happen that the Jupyter kernels in the activated virtual environment (e.g. myvenv
) still point to the system-wide python binaries and not to the environment ones.
This will result in ImportError
when importing trexio
in the notebook cell. In order to avoid this, the myvenv
has to be installed as an additional kernel.
This requires ipykernel
python package, which usually comes together with the Jupyter installation. If this is not the case, run pip install ipykernel
.
You can install myvenv
as a kernel by executing the following command:
python3 -m ipykernel install --user --name=myvenv
Now you can launch a Jupyter notebook. Once it is open, make sure that your virtual environment is selected as the current kernel. If this is not the case, try this:
- Press the
Kernel
button in the navigation panel - In the output list of options select
Change kernel
- Find the name of your virtual environment (e.g.
myvenv
) in the list and select it
That's it, you have activated the custom virtual environment called myvenv
in your notebook.
To uninstall the kernel named myvenv
, execute the following command:
jupyter kernelspec uninstall myvenv
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file trexio-2.5.0.tar.gz
.
File metadata
- Download URL: trexio-2.5.0.tar.gz
- Upload date:
- Size: 329.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 539c6b33c5ae620e0994d603e311dc9b35b0b33660d2dc60fdc7ddc8d2c3817f |
|
MD5 | fa4d43fd6dd9cb2b44b2904e278ab0eb |
|
BLAKE2b-256 | 542218c1672c0211cfd9b8bb08eb1b5d1d9417a9dc19e4f2c12908a12c57993f |
File details
Details for the file trexio-2.5.0-cp313-cp313-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: trexio-2.5.0-cp313-cp313-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 5.0 MB
- Tags: CPython 3.13, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a3c9db65599f063c9cd1bb08292b20d97735182c4e34ed945433119720a6e15 |
|
MD5 | 794cf8d939e7651384686657104f97b1 |
|
BLAKE2b-256 | 1ffb14e52eeed103afac70c9d4da08c3cb0d6dad74f5b93bab52cb7427ef34f2 |
File details
Details for the file trexio-2.5.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: trexio-2.5.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 5.0 MB
- Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36e031ca2b2c84fcf4974352c7c4fe0c46fc8f8607d89f417b06a400a17fde67 |
|
MD5 | 17d6ac76ffc440e2cbaee23225ba753d |
|
BLAKE2b-256 | b2a17f65ffd071c99dce2fa27c8d896c883e2629ac376656a20d3cbfa5687a11 |
File details
Details for the file trexio-2.5.0-cp312-cp312-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: trexio-2.5.0-cp312-cp312-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 5.0 MB
- Tags: CPython 3.12, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3462992cade18b0ad2fd0999982656ea95ffd06f41b8a0c1cf74395a5761bf64 |
|
MD5 | 7d2fbf424854626072256da32b90c569 |
|
BLAKE2b-256 | 05d964cb4c153e9cbc7e2ce2e1e705843cb63701601979cffa53a66b63c71c1a |
File details
Details for the file trexio-2.5.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: trexio-2.5.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 5.0 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b77f90471ca87e525dac14f5d36c6db467ffffa8bc603a4ac602c2a6d2e6bd7 |
|
MD5 | 6f07a46c4e4bc759fe29ef48b27b8904 |
|
BLAKE2b-256 | 75e3d77cba05d73297f90f6c4991839051deafa988ff9cc4267966af1f8dedb6 |
File details
Details for the file trexio-2.5.0-cp312-cp312-macosx_11_0_arm64.whl
.
File metadata
- Download URL: trexio-2.5.0-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.0 MB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 436f69a576053b7a0701806b8e880e9c8efc1323c718d1771eba2a60106e8622 |
|
MD5 | 34a946568130d2933eed4b135a704227 |
|
BLAKE2b-256 | 77d29fc5d6bf17639bc01c2429d856be8be9d860a0a26df2f7a049c67e402faa |
File details
Details for the file trexio-2.5.0-cp312-cp312-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: trexio-2.5.0-cp312-cp312-macosx_10_9_x86_64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.12, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 746493072cd92e981d74064bf96559189fe39d3c2b89c7ce66879a0693077dde |
|
MD5 | 07406cd856863d15ce4b80e71d24d035 |
|
BLAKE2b-256 | ba8772177f3be1acc80ec5ec77ad0f8f89d7f6eda28dba88f67e12a71b2f25b1 |
File details
Details for the file trexio-2.5.0-cp311-cp311-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: trexio-2.5.0-cp311-cp311-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 5.0 MB
- Tags: CPython 3.11, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44df26a0df57b20e1c34ef706628a8eb5d7eee371e0cc46c961a135e3f80e6d6 |
|
MD5 | 9834e85f39e6afcaa025d4702cf37587 |
|
BLAKE2b-256 | 7ec35e2cd6ce68cb14998441317c82566bee1bd54e285ba8149d752dcfa9cee2 |
File details
Details for the file trexio-2.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: trexio-2.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 5.0 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 32df92bfbd0958dd02f3500c2bdb0d84a951b0c40a46282efbdd922440bec389 |
|
MD5 | 257ce7e31d925b13cb2ba1d9ad46c619 |
|
BLAKE2b-256 | 3d0f2807817a4e0f5b97e1194d93d4317d39579c355a3f2898004845e354868d |
File details
Details for the file trexio-2.5.0-cp311-cp311-macosx_11_0_arm64.whl
.
File metadata
- Download URL: trexio-2.5.0-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.0 MB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 75a5e0ac72bde614664ed8650ae8355150603fa8c9231e5cfd7fc35360349371 |
|
MD5 | 6e3e1462dcfea0108280b2d9c42d6d63 |
|
BLAKE2b-256 | a445485dd24288da0f38ff570064ecec026babc80b416c4bf108d40f331b5b29 |
File details
Details for the file trexio-2.5.0-cp311-cp311-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: trexio-2.5.0-cp311-cp311-macosx_10_9_x86_64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.11, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5657d0da0fc99e889569544b6e58635bc7b94c7df28f1309d56d263cd98dfc3b |
|
MD5 | c953806ec66514c6aebb0de692376b14 |
|
BLAKE2b-256 | a19ff35ac6aef813e75cde1c791e7472fdacea810194cd945e1db47fb00a4af8 |
File details
Details for the file trexio-2.5.0-cp310-cp310-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: trexio-2.5.0-cp310-cp310-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 4.8 MB
- Tags: CPython 3.10, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b74fd7dce237d2cef6ac16298f4424862dfce350da12e8f32680a86bd1fec29 |
|
MD5 | 780ad491bb845c24966cc37c2ecae28c |
|
BLAKE2b-256 | e6f5e2df1aa5d1a9d20c05ad527f05612c0104c3c0f2cbf8f1260d33f94aae7b |
File details
Details for the file trexio-2.5.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: trexio-2.5.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 4.9 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4620e194501a015b9a162419702fd193a5e1f4adbb74b971fc5a4f833683ba98 |
|
MD5 | a7d2e19b4d6db3bc2e177be9d939a85a |
|
BLAKE2b-256 | c70703b50da574040f2ee77dc0214c68feed7b0912d5f9a8bfd5f3838667ce05 |
File details
Details for the file trexio-2.5.0-cp310-cp310-macosx_11_0_arm64.whl
.
File metadata
- Download URL: trexio-2.5.0-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.0 MB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2691bc9e28b4eb4c550d735b62a32847c8f3aa12ef9db23f69c4762becf1749 |
|
MD5 | f7c23b2373d9cb7b75533a389bbe70ef |
|
BLAKE2b-256 | b809525b2fbc5e80f904930cfcf5cc1aca72a6012df1a1c396c9a01eaf22aed0 |
File details
Details for the file trexio-2.5.0-cp310-cp310-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: trexio-2.5.0-cp310-cp310-macosx_10_9_x86_64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.10, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3885ddf4d38e246ac7cfe4c08837d45720ded6a4151663d869cd31a1501030f |
|
MD5 | f9feed699a09f5b2952cf6e2755eef51 |
|
BLAKE2b-256 | 818db554f796cfa7854abb9e611dfc374dc0fec4f5d3223dc5f0186c2d384296 |
File details
Details for the file trexio-2.5.0-cp39-cp39-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: trexio-2.5.0-cp39-cp39-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 4.9 MB
- Tags: CPython 3.9, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | da6d6bfddeed4bbb8e7995f29baf000e5391fc85bd42638aa9a6197e4b16f4b3 |
|
MD5 | fab832ab101b58ab4f0d885d099eb56a |
|
BLAKE2b-256 | 794298f726c0cf9213dffe18aa8fc715471b7473bf8b22f5c56e9c837920d911 |
File details
Details for the file trexio-2.5.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: trexio-2.5.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 4.9 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97c047ed365fb9b2c56fcb681e712fd0d6b91460c4eed292b77cdaece3f5585c |
|
MD5 | d6f4b69f6106a8d3d1fc4aa88843aae8 |
|
BLAKE2b-256 | 6cb44ca4b69d3daa350cb72248fb4f70cbdbe281375ef8fba9eb7a86b1bfbc60 |
File details
Details for the file trexio-2.5.0-cp39-cp39-macosx_11_0_arm64.whl
.
File metadata
- Download URL: trexio-2.5.0-cp39-cp39-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.0 MB
- Tags: CPython 3.9, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc26687d1be33c629be762ee7311f6c15f2c83b98c7afa593655432306d631f3 |
|
MD5 | 6f9e04bc412c35dab9fb095185eb9a0a |
|
BLAKE2b-256 | 49b0a20481897344734404e595b1f7022205258bc98b6e2ec014d7b33dd1bbc9 |
File details
Details for the file trexio-2.5.0-cp39-cp39-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: trexio-2.5.0-cp39-cp39-macosx_10_9_x86_64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.9, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e94cef375964cbfb43105d802f121ab8d72c1e943c429ea833e2a6a2915c485 |
|
MD5 | 40aaa23db199035171e549af233f8e9f |
|
BLAKE2b-256 | de93b8b670e1039c598905037d6f0771e79ee2cfc86d6bed76eb1b2095303c10 |
File details
Details for the file trexio-2.5.0-cp38-cp38-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: trexio-2.5.0-cp38-cp38-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 4.8 MB
- Tags: CPython 3.8, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4a1b7080d079988ad8488a820b4d544f8b0d6a363790083e9928479f0648e1a |
|
MD5 | 29e76b581d71dad09a2c610945b88bd9 |
|
BLAKE2b-256 | 4fb22fd4e67e2dd9e03bfe6e06112e7cb06094af5b26ba4494e68a18f242cda9 |
File details
Details for the file trexio-2.5.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: trexio-2.5.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 4.8 MB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63d1ecb6d33af129cd747c795cad07930422d7412c54d17c993db5cdc8d816e2 |
|
MD5 | 0b074a9a3321c876af801c067b6c714b |
|
BLAKE2b-256 | dc49907543c8087af5b4572dd9c2a592a1243aba6e761d7784bb88b903777887 |
File details
Details for the file trexio-2.5.0-cp38-cp38-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: trexio-2.5.0-cp38-cp38-macosx_10_9_x86_64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.8, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cebc2b047db071d15405d4bab7e08e9c79ca92ffc37731f8f832045879698c81 |
|
MD5 | 52c4de5f0457b45288a4df1342ad667f |
|
BLAKE2b-256 | b4743cedb5ae537d64819164f18c4e1ed0fdae54a1d4405840b87417c2415ab9 |