{"id":24201,"library":"parsnip-cif","title":"parsnip-cif","description":"Minimal library for parsing CIF and mmCIF files in Python. Version 0.5.0, released January 2026. Maintained by the Glotzer Lab. Active development with frequent minor releases.","status":"active","version":"0.5.0","language":"python","source_language":"en","source_url":"https://github.com/glotzerlab/parsnip","tags":["CIF","mmCIF","crystallography","file-format","parsing"],"install":[{"cmd":"pip install parsnip-cif","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"The package installs as 'parsnip-cif', but import uses 'parsnip' as the module name.","wrong":"from parsnip_cif import CifFile","symbol":"CifFile","correct":"from parsnip import CifFile"}],"quickstart":{"code":"from parsnip import CifFile\n\n# Parse from a string\ncif_text = \"\"\"\ndata_test\n_cell_length_a 10.0\n_cell_length_b 10.0\n_cell_length_c 10.0\n\"\"\"\ncif = CifFile(cif_text, source='string')\nprint(cif.keys())  # ['_cell_length_a', '_cell_length_b', '_cell_length_c']\nprint(cif.get('_cell_length_a'))  # '10.0'\n\n# Parse a file (using context manager)\n# with open('structure.cif', 'r') as f:\n#     cif = CifFile(f)\n","lang":"python","description":"Basic parsing of CIF data using CifFile."},"warnings":[{"fix":"Migrate to use CifFile class. See release notes for API changes.","message":"In version 0.2.0, the primary interface changed to CifFile object. Old code using lower-level parsers may break.","severity":"breaking","affected_versions":"<0.2.0"},{"fix":"Use 'import parsnip' or 'from parsnip import CifFile'.","message":"Import module name is 'parsnip', not 'parsnip_cif'. The PyPI package is 'parsnip-cif' but Python import uses 'parsnip'.","severity":"gotcha","affected_versions":"all"},{"fix":"Always provide source parameter when parsing from a string: CifFile(cif_text, source='string').","message":"When passing a string to CifFile, you must specify source='string' (or another valid source). Otherwise, it may try to open the string as a file path.","severity":"gotcha","affected_versions":">=0.4.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Replace 'import parsnip_cif' with 'import parsnip' or 'from parsnip import CifFile'.","cause":"Attempting to import the module using the package name 'parsnip_cif' instead of the correct module name 'parsnip'.","error":"ModuleNotFoundError: No module named 'parsnip_cif'"},{"fix":"Use CifFile(your_string, source='string') instead.","cause":"Passing a raw CIF string directly to CifFile without specifying source='string' causes it to treat the string as a file path.","error":"FileNotFoundError: [Errno 2] No such file or directory: 'data_test\\n_cell_length_a 10.0...'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}