Skip to content

Releases: molshape/ChemFormula

Update 1.5.1

01 Nov 14:44
a4fc868

Choose a tag to compare

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 two ChemFormula instances 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 two ChemFormula instances. Includes validation for negative frequencies and empty results.

Formula Multiplication

  • * Operator: Multiply a ChemFormula by 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.py demonstrates 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

Full Changelog: v1.5.0...v1.5.1 or CHANGELOG.md

Update 1.5.0

14 Sep 13:56
8129256

Choose a tag to compare

What's Changed

  • Refactor code base and add support for hydrogen isotopes -> v1.5.0 by @molshape in #21

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 AllowHydrogenIsotopes flag in chemformula.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_isotopes attribute to the ChemFormula class 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, and config.pyi that provide explicit type signatures for all public methods and properties of the ChemFormula class, enhancing static type checking and editor support.
  • Updates development dependencies to include mypy and pins minimum versions for all dev tools; test coverage options are now set in pyproject.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

02 Aug 12:32
c53bffb

Choose a tag to compare

Add workflow for trusted publishing by @HLinde (#16)

  • Create pyproject.toml based on the PyPI package
  • Restructure folders
  • Utilizing uv for build and tests with pytest
  • Add __all__ to __init__.py so import ChemFormula from chemformula works

Feature/CI Pipeline by @molshape (#17)

  • Add CI pipeline with pytest and ruff with 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.md accordingly
  • Update literature references
  • Bump version to 1.4.1

Update v1.3.1

28 Sep 05:03
fe26905

Choose a tag to compare

Bugfix:

  • tailing whitespace removed from string outputs of uncharged formulas

Update v1.3.0

12 Sep 19:29
e7a0cba

Choose a tag to compare

Update v1.2.5

02 Sep 23:41
892a517

Choose a tag to compare

Update v1.2.5 - adding compare and sort functionality to ChemFormula objects

Update v1.2.4

30 Aug 14:28
49a4921

Choose a tag to compare

adding functionality to use the HTML/LaTeX/Unicode property on SumFormula and HillFormula

Update v1.2.3

29 Aug 17:56
36be731

Choose a tag to compare

This update adds a ".Unicode" property to the ChemFormula class that outputs a chemical formula with unicode subscript and superscript numbers.