Skip to main content

Icon pyobjcryst

PyPI Forge PythonVersion PR

CI Codecov Black Tracking

Python bindings to ObjCryst++, the Object-Oriented Crystallographic Library.

For more information about the pyobjcryst library, please consult our online documentation.

pyobjcryst is an open-source software package originally developed as a part of the DiffPy-CMI complex modeling initiative which originated in the DANSE project at Columbia University. It was further developed at Brookhaven National Laboratory, and Columbia University and the European Synchrotron Radiation Source (ESRF) and is now maintained at University of California, Santa Barbara and ESRF. The pyobjcryst sources are hosted at https://github.com/diffpy/pyobjcryst.

Citation

If you use diffpy.srfit in a scientific publication, we would like you to cite this package as

P. Juhás, C. L. Farrow, X. Yang, K. R. Knox and S. J. L. Billinge, Complex modeling: a strategy and software program for combining multiple information sources to solve ill posed structure and nanostructure inverse problems, Acta Crystallogr. A 71, 562-568 (2015).

and

V. Favre-Nicolin and R. Cerný, FOX, ‘free objects for crystallography’: a modular approach to ab initio structure determination from powder diffraction, J. Appl. Cryst. 35, 734-743 (2002)

The second paper describes the c++ crystallographic objects in ObjCryst++ that are wrapped by pyobjcryst

Installation

The latest release of pyobjcryst runs in python versions 3.12, 3.13 and 3.14. You may specify an earlier release if you need it to run in an earlier version of Python.

The preferred method is to use Miniconda Python and install from the “conda-forge” channel of Conda packages.

To permanently add “conda-forge” to the conda channels (recommended), run the following in a terminal.

conda config --add channels conda-forge

We want to install our packages in a suitable conda environment. The following creates and activates a new environment named pyobjcryst-env

conda create -n pyobjcryst-env pyobjcryst
conda activate pyobjcryst-env

To confirm that the installation was successful, type

python -c "import pyobjcryst; print(pyobjcryst.__version__)"

The output should print the latest version displayed on the badges above.

pyobjcryst is also included in the diffpy.cmi collection of packages for structure analysis and so can be installed by

conda install -c conda-forge diffpy.cmi

and following the instructions in the diffpy.cmi documentation to install packs containing pyobjcryst and its libraries.

Optional graphical dependencies for jupyter notebooks

Some of the classes can produce graphical outputs, which can be displayed in a jupyter notebook:

  • a Crystal structure can be displayed in 3D: this requires the py3dmol and ipywidgets modules. See the notebook docs/examples/cystal_3d_widget.ipynb

  • a PowderPattern can be displayed (and live-updated) if matplotlib and ipympl are installed. See the notebook docs/examples/structure-solution-powder-cimetidine.ipynb

Getting Started

You may consult our online documentation for tutorials and API references.

Alternative methods of installation

These approaches are not recommended but reproduced here for advanced users. You can use pip to download and install the latest release from Python Package Index.

Pyobjcryst can be installed from pip. We recommend installing the dependencies that can be found in requirements/conda.txt from conda-forge, e.g.,

conda create -n pyobjcryst-env python=3.14
conda activate pyobjcryst-env
conda install -c conda-forge numpy libobjcryst libboost-devel libboost-python packaging ipywidgets matplotlib-base ipympl py3dmol
pip install pyobjcryst

If you prefer to install from sources, after installing the dependencies, obtain the source archive from GitHub. Once installed, cd into your pyobjcryst directory and run the following

pip install .

An alternative way of installing pyobjcryst is to use the SCons tool, which can speed up the process by compiling C++ files in several parallel jobs (-j4):

conda install scons
conda install --file requirements/conda.txt
scons -j4 dev

See scons -h for description of build targets and options.

Alternatively, on Ubuntu Linux the required software can be installed using

sudo apt-get install \
     python-setuptools python-numpy scons \
     build-essential python-dev libboost-all-dev

If this doesn’t work, please see the requirements/conda.txt file for the latest list of requirements.

The libobjcryst library can also be installed as per the instructions at https://github.com/diffpy/libobjcryst. Make sure other required software are also in place and then run from the pyobjcryst directory

pip install .

You may need to use sudo with system Python so the process is allowed to copy files to system directories, unless you are installing into a conda environment. If administrator (root) access is not available, see the usage information from python setup.py install –help for options to install to a user-writable location.

Testing your installation

The installation integrity can be verified by executing the included tests with

First install test dependencies then type pytest:

conda install --file requirements/tests.txt
pytest

Support and Contribute

If you see a bug or want to request a feature, please report it as an issue and/or submit a fix as a PR.

Feel free to fork the project and contribute. To install pyobjcryst in a development mode, with its sources being directly used by Python rather than copied to a package directory, use the following in the root directory

pip install -e .

To ensure code quality and to prevent accidental commits into the default branch, please set up the use of our pre-commit hooks.

  1. Install pre-commit in your working environment by running conda install pre-commit.

  2. Initialize pre-commit (one time only) pre-commit install.

Thereafter your code will be linted by black and isort and checked against flake8 before you can commit. If it fails by black or isort, just rerun and it should pass (black and isort will modify the files so should pass after they are modified). If the flake8 test fails please see the error messages and fix them manually before trying to commit again.

When developing it is preferable to compile the C++ files with SCons using the build=debug option, which compiles the extension module with debug information and C-assertions checks

scons -j4 build=debug dev

Improvements and fixes are always appreciated.

Before contributing, please read our Code of Conduct.

Contact

For more information on pyobjcryst please visit the project web-page or email Simon Billinge at sbillinge@ucsb.edu.

You can also contact Vincent Favre-Nicolin (favre@esrf.fr) if you are using pyobjcryst outside diffpy, e.g. to display structures in a notebook, refine powder patterns or solve structures using the global optimisation algorithms, etc..

Acknowledgements

This package bundles the following IUCr data files for bona fide research use:

pyobjcryst is built and maintained with scikit-package.

Metadata

Release files for pyobjcryst 2026.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyobjcryst 2026.1.0
File Size Uploaded
pyobjcryst-2026.1.0.tar.gz 162.1 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for pyobjcryst 2026.1.0
File
pyobjcryst-2026.1.0-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details
pyobjcryst-2026.1.0-cp314-cp314-manylinux_2_39_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.39+ x86-64 Details
pyobjcryst-2026.1.0-cp314-cp314-macosx_11_0_x86_64.whl CPython 3.14 CPython 3.14 macOS 11.0+ x86-64 Details
pyobjcryst-2026.1.0-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details
pyobjcryst-2026.1.0-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
pyobjcryst-2026.1.0-cp313-cp313-manylinux_2_39_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.39+ x86-64 Details
pyobjcryst-2026.1.0-cp313-cp313-macosx_11_0_x86_64.whl CPython 3.13 CPython 3.13 macOS 11.0+ x86-64 Details
pyobjcryst-2026.1.0-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
pyobjcryst-2026.1.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
pyobjcryst-2026.1.0-cp312-cp312-manylinux_2_39_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.39+ x86-64 Details
pyobjcryst-2026.1.0-cp312-cp312-macosx_11_0_x86_64.whl CPython 3.12 CPython 3.12 macOS 11.0+ x86-64 Details
pyobjcryst-2026.1.0-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details

Total release size: 17.9 MB

Release files / pyobjcryst-2026.1.0.tar.gz

Download URL pyobjcryst-2026.1.0.tar.gz
Size 162.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0ca642db5d534bf24efce9a9f6d7c2e45026f5b0691fecb7fe8e69118535786e
BLAKE2b-256 checksum
How to use checksums
edd1e599c132ccfa37eaea9dd1f6e68cd53f271898baf44618575fe4045ecd35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / pyobjcryst-2026.1.0-cp314-cp314-win_amd64.whl

Download URL pyobjcryst-2026.1.0-cp314-cp314-win_amd64.whl
Size 2.0 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
75b4d7ae4168c6e5737fda7cae1cd12bf528655a275f0cb3b52a2b5920a291b1
BLAKE2b-256 checksum
How to use checksums
f2b241e1fd813aa730741249a20b319f8576e88aa6a663373d31c73a8f32a0fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / pyobjcryst-2026.1.0-cp314-cp314-manylinux_2_39_x86_64.whl

Download URL pyobjcryst-2026.1.0-cp314-cp314-manylinux_2_39_x86_64.whl
Size 1.6 MB
Tags CPython 3.14 Linux glibc 2.39+ x86-64
SHA-256 checksum
How to use checksums
eeb32702cd8f431d871e17ab55bdb71d8bb111c3318df24030085c0645659126
BLAKE2b-256 checksum
How to use checksums
9ef5e98566cf5d73382c280c0b2555fbc9d98d4dbe6279fd0cd3ce634bcbf6cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / pyobjcryst-2026.1.0-cp314-cp314-macosx_11_0_x86_64.whl

Download URL pyobjcryst-2026.1.0-cp314-cp314-macosx_11_0_x86_64.whl
Size 1.2 MB
Tags CPython 3.14 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
46696a8f3337b23b527f45d229bcd3f34604ad1698fd518ad5ad3d0dda96d96a
BLAKE2b-256 checksum
How to use checksums
07b806fe8cf1efbb48af80df428871a468e9f686247fffe3880bf0ea9312f94d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / pyobjcryst-2026.1.0-cp314-cp314-macosx_11_0_arm64.whl

Download URL pyobjcryst-2026.1.0-cp314-cp314-macosx_11_0_arm64.whl
Size 1.1 MB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
782f992230819f8f99301bc8a35c3dfe75ab793d2870a194728e54623c0cb1fd
BLAKE2b-256 checksum
How to use checksums
b9dc37e33b76d009b43e10a8fbc5aa2d668d90577bea20991a61662426596d8b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / pyobjcryst-2026.1.0-cp313-cp313-win_amd64.whl

Download URL pyobjcryst-2026.1.0-cp313-cp313-win_amd64.whl
Size 2.0 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
a7c700a131fa11164f97397dc680424cdbbd597cf560b1a73ac5ccf608edeafa
BLAKE2b-256 checksum
How to use checksums
ec6a30f9b593a0282e1e7fe2347a2a431aae876a31f2b12401a239d87f6cf71a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / pyobjcryst-2026.1.0-cp313-cp313-manylinux_2_39_x86_64.whl

Download URL pyobjcryst-2026.1.0-cp313-cp313-manylinux_2_39_x86_64.whl
Size 1.6 MB
Tags CPython 3.13 Linux glibc 2.39+ x86-64
SHA-256 checksum
How to use checksums
dbb6819d63e62304ea007f5ac28fa054870e600f378f386906fbad74eba668bb
BLAKE2b-256 checksum
How to use checksums
fb9847f9ea7885953d418cb523857a5b5708f8302b39b2bd198b5094304b943d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / pyobjcryst-2026.1.0-cp313-cp313-macosx_11_0_x86_64.whl

Download URL pyobjcryst-2026.1.0-cp313-cp313-macosx_11_0_x86_64.whl
Size 1.2 MB
Tags CPython 3.13 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
c7d2e1400e3b6dd310896c681724f6fda605365b4331d46dd5a6999161c4ad73
BLAKE2b-256 checksum
How to use checksums
9651a9d366c0b512ef9d3a8626b9c7b1f8707881ca5cad619c97ce8be263a4ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / pyobjcryst-2026.1.0-cp313-cp313-macosx_11_0_arm64.whl

Download URL pyobjcryst-2026.1.0-cp313-cp313-macosx_11_0_arm64.whl
Size 1.1 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
6461edecfb39668f945af2fd73aa9214b80f1906b77726ff38f0a32014c6695e
BLAKE2b-256 checksum
How to use checksums
6884f3da25f34d7a6521b5726fb1ca64dcd91570af69ac907fa70c27b9f3923b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / pyobjcryst-2026.1.0-cp312-cp312-win_amd64.whl

Download URL pyobjcryst-2026.1.0-cp312-cp312-win_amd64.whl
Size 2.0 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
a77b6a60c74d4f2e2344c42af51a48d396bb58a501ba0851fb261406a4b2d575
BLAKE2b-256 checksum
How to use checksums
423436c231ae44f3219ca8d52c8876ad6652c637d6d2f57e1dc6c4953def8f68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / pyobjcryst-2026.1.0-cp312-cp312-manylinux_2_39_x86_64.whl

Download URL pyobjcryst-2026.1.0-cp312-cp312-manylinux_2_39_x86_64.whl
Size 1.6 MB
Tags CPython 3.12 Linux glibc 2.39+ x86-64
SHA-256 checksum
How to use checksums
b9a98076f2ca2cd5bb744f5d9187735f09064366d8b2cef5c4c93ed147f6777a
BLAKE2b-256 checksum
How to use checksums
0347ceb7ebd5ffcef40fa8250e667e9fbb93ed9cd2b955beeeae8ad97ec02a70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / pyobjcryst-2026.1.0-cp312-cp312-macosx_11_0_x86_64.whl

Download URL pyobjcryst-2026.1.0-cp312-cp312-macosx_11_0_x86_64.whl
Size 1.2 MB
Tags CPython 3.12 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
21e36452d400e8d2c1d837b5943b6f99cc0aac5051fdb0494410444cd3e6efa6
BLAKE2b-256 checksum
How to use checksums
19d26d2b876df72979c1ede396fb71ab963e94739f80af83152382b31b7331f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / pyobjcryst-2026.1.0-cp312-cp312-macosx_11_0_arm64.whl

Download URL pyobjcryst-2026.1.0-cp312-cp312-macosx_11_0_arm64.whl
Size 1.1 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c4f3717e342a429a3fa9ff525a8688f63478cce74b48bb1c93e17f2b614e5736
BLAKE2b-256 checksum
How to use checksums
9e98646b2b2e82c7317be0efdad52dba130ceb72fac78bd6b50d077f6611da32
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page