Releases: molshape/ChemFormula
Update 1.5.1
Release Notes for Version 1.5.1
Version 1.5.1 introduces arithmetic operations for the ChemFormula class, enabling addition, subtraction, and multiplication of chemical formulas. These features enhance the library's capabilities for chemical computations and improve usability with updated documentation, examples, and tests.
New Features
Formula Addition
+Operator: Combine twoChemFormulainstances by summing their element counts and charges. This feature supports operations like adding reaction products or combining formulas.
Formula Subtraction
-Operator: Subtract element counts and charges between twoChemFormulainstances. Includes validation for negative frequencies and empty results.
Formula Multiplication
*Operator: Multiply aChemFormulaby a positive integer, scaling element counts and charges. Supports both left and right multiplication.
Specialized Dictionary Classes
ChemFormulaDict: A dictionary for element frequencies, enforcing non-negative integer values.ChemFormulaDictFloat: A dictionary for element fractions, supporting floats and integers.
Documentation and Examples
- Expanded
README.md: Added detailed sections on formula arithmetic, including examples for addition, subtraction, and multiplication. - New Example Script:
examples/example6.pydemonstrates practical use cases for formula arithmetic.
Testing and Type Safety
- Comprehensive tests for all arithmetic operations, including validation of edge cases and error handling.
- Updated type stubs (
chemformula.pyi) to reflect new features and ensure type safety.
Project Configuration
- Changed CI matrix to include Python 3.14.
- Bump version to
1.5.1.
What's Changed
- Feature/adding formulas by @molshape in #22
- Feature/subtracting formulas by @molshape in #23
- Feature/multiply formulas by @molshape in #24
- Feature/formula arithmetics by @molshape in #25
Full Changelog: v1.5.0...v1.5.1 or CHANGELOG.md
Update 1.5.0
What's Changed
Full Changelog: v1.4.1...v1.5.0
This release adds hydrogen isotope support and brings significant improvements to code quality, documentation, and Python compatibility.
New Features and Functionality
- Adds support for hydrogen isotopes (deuterium "D" and tritium "T") via a global
AllowHydrogenIsotopesflag inchemformula.config, with corresponding documentation and usage examples (README.md,examples/example5.py,src/chemformula/chemformula.py) [1] [2] [3] [4]. - This new feature closes the feature requests #14 and #20.
- Introduces
.contains_isotopesattribute to theChemFormulaclass for detecting specific isotopes in formulas, and updates documentation and examples accordingly (README.md,examples/example5.py,src/chemformula/chemformula.py) [1] [2].
Code Quality and Type Safety
- Adds type stub files
chemformula.pyi,elements.pyi, andconfig.pyithat provide explicit type signatures for all public methods and properties of theChemFormulaclass, enhancing static type checking and editor support. - Updates development dependencies to include
mypyand pins minimum versions for all dev tools; test coverage options are now set inpyproject.toml[1] [2].
Documentation and Example Enhancements
- Improved
README.md: clarified installation instructions, added isotope usage section, fixed typos, updated attribute names (e.g.,.radioactive→.is_radioactive), and improved output examples for consistency (README.md,examples/example1.py,examples/example2.py,examples/example_general.py) [1] [2] [3] [4] [5] [6] [7] [8]. - Added docstrings to all attributes and methods for better documentation.
Update v1.4.1
Add workflow for trusted publishing by @HLinde (#16)
- Create
pyproject.tomlbased on the PyPI package - Restructure folders
- Utilizing
uvfor build and tests withpytest - Add
__all__to__init__.pysoimport ChemFormula from chemformulaworks
Feature/CI Pipeline by @molshape (#17)
- Add CI pipeline with
pytestandruffwith multi-OS and multi-Python testing - Update release workflow with pre-release validation
- Modify python files to comply with ruff format test
Update/atomic weights by @molshape (#18)
- Update atomic weights for F, Ar, Sc, Y, Zr, Gd, Ho, Tm, and Lu in
elements.py - Update
README.mdaccordingly - Update literature references
- Bump version to 1.4.1
Update v1.3.1
Bugfix:
- tailing whitespace removed from string outputs of uncharged formulas
Update v1.3.0
- outsourcing CAS Registry Number management to the casregnum package using
CASclass - optimizing code
- creating internal parent class
ChemFormulaString - complying to PEP 8 naming conventions
- updating documentation
Update v1.2.5
Update v1.2.5 - adding compare and sort functionality to ChemFormula objects
Update v1.2.4
adding functionality to use the HTML/LaTeX/Unicode property on SumFormula and HillFormula
Update v1.2.3
This update adds a ".Unicode" property to the ChemFormula class that outputs a chemical formula with unicode subscript and superscript numbers.