parsnip is a minimal Python library for parsing CIF files. While its primary focus is on simplicity and portability, performance-oriented design choices are made where possible.
Importing parsnip allows users to read CIF 1.1 files, as well as many features from the CIF 2.0 and mmCIF formats.
Creating a CifFile object provides easy access to name-value pairs, as well
as loop_-delimited loops. Data entries can be extracted as python primitives or
numpy arrays for further use.
Setup¶
parsnip may be installed with pip or from conda-forge.
Installation via pip¶
python -m pip install parsnip-cif
Installation via conda-forge¶
conda install -c conda-forge parsnip-cif
Installation from source¶
First, clone the repository:
git clone https://github.com/glotzerlab/parsnip.git
cd parsnip
Then, choose one of the following. While parsnip is only dependent on Numpy, additional dependencies are required to run the tests and build the docs.
pip install . # Install with no additional dependencies
pip install .[tests] # Install with dependencies required to run tests
pip install .[tests,doc] # Install with dependencies required to run tests and make docs
To obtain a correct set of locked dependencies, we recommend the use of the uv
package manager to install from uv.lock:
uv sync --extra tests # Or --all-extras to build the documentation
Dependencies¶
numpy>=1.19
more-itertools
Support and Contribution¶
Please visit our repository on GitHub for the library source code. Any issues or bugs may be reported at our issue tracker, and tips and best practices for contributing to the project are included in the development guide. All contributions to parsnip are welcomed via pull requests!
Getting Started
Reference