chemparse
Authors: Grayson Boyer and Victor Ignatenko
A lightweight package for parsing chemical formula strings into python dictionaries.
Features
- Convert a chemical formula string into a python dictionary.
- example:
"CH4"returns{"C":1.0, "H":4.0}
- example:
- Handles fractional stoichiometry.
- example:
"C1.5O3"returns{"C":1.5, "O":3.0} - example:
"H2e-1O1e-1"returns{"H":0.2, "O":0.1}
- example:
- Handles groups with parentheses.
- example:
"(CH3)2(CH2)4"returns{"C":6.0, "H":14.0}
- example:
- New in 2024: Chemparse now handles nested paretheses!
- example:
"((CH3)2)3"returns{'C': 6, 'H': 18}
- example:
- New in 2024: Chemparse now handles square brackets
- example:
"K4[Fe(SCN)6]"returns{'Fe': 1.0, 'K': 4.0, 'N': 6.0, 'S': 6.0, 'C': 6.0}
- example:
Installation
Install chemparse with pip:
$ pip install chemparse
Usage
Import chemparse in python and use the parse_formula function:
import chemparse
print(chemparse.parse_formula("C6H12O6"))
Contribute
Install python
Clone chemparse using git:
git clone https://github.com/gmboyer/chemparse.git
Go to the chemparse directory:
cd chemparse
Install requirements:
pip install -r requirements.txt
Now you are ready to contribute!
Metadata
Release files for chemparse 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| chemparse-0.3.2.tar.gz | 5.5 kB | Without provenance | Details for chemparse-0.3.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| chemparse-0.3.2-py3-none-any.whl | Python 3 | none | any | Details for chemparse-0.3.2-py3-none-any.whl |
Total release size: 11.4 kB
Release files / chemparse-0.3.2.tar.gz
| Download URL | chemparse-0.3.2.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f46e24081f69c3bddd03447a1ab0370c286607c6b6c146b1647f6d57beb26c3d
|
|
BLAKE2b-256 checksum How to use checksums |
1f8281118c32a309408fcbcd5fc561d8f0ba0ab6f977dc4c87fb6b62e25e1d64
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|
Release files / chemparse-0.3.2-py3-none-any.whl
| Download URL | chemparse-0.3.2-py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
67169faa673f804a518fac32e3b2072ef8c0d8c9df557b2d4f385424a750d819
|
|
BLAKE2b-256 checksum How to use checksums |
28ccf0a932c8a9cd00ebdadd177c4dd312dd11771ea1856b2b86f57995e6e249
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|
Security for chemparse 0.3.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.