Refactor code base and add support for hydrogen isotopes -> v1.5.0#21
Merged
Refactor code base and add support for hydrogen isotopes -> v1.5.0#21
Conversation
- Add `mypy` type checking to CI pipeline (`ci.yml`) - Rename `lint` job to `code-quality` - Rename `test` job to `code-tests` - Add and configure pytest options in `pyproject.toml` - Simplify pytest call in `ci.yml` - Specify version numbers for dependencies - Improve type annotations in `chemformula.py` and `elements.py` to comply with mypy - Add `casregnum.pyi`, `elements.pyi`, and `config.pyi` type stubs for static type checking - Add `py.typed` marker file to indicate typed package - Change CI matrix to only two Python versions - Change property name for radioactivity check from `radioactive` to `is_radioactive` for clarity. Keep `radioactive` for backwards compatibility - Add support for hydrogen isotopes (Deuterium and Tritium) via a global configuration flag (`AllowHydrogenIsotopes`) - Introduce `ChemFormulaDict` for better handling of chemical formula dictionaries and simplified error handling and data validation - Add `example5.py` to demonstrate the new hydrogen isotope functionality - Enhance documentation for classes and methods, including detailed docstrings - Add tests for isotope functionality and update existing tests to reflect the property name change - Update dependencies and classifiers in `pyproject.toml` to support Python 3.10, 3.11, and 3.12 - Improve error handling and validation for CAS registry numbers - Update `README.md` accordingly - Bump to version 1.5.0
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment Thanks for integrating Codecov - We've got you covered ☂️ |
This was
linked to
issues
Sep 14, 2025
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces
ChemFormulaversion 1.5.0, adding hydrogen isotope support and bringing significant improvements to code quality, documentation, and Python compatibility. The highlights include new features for handling hydrogen isotopes, enhanced continuous integration, and improved type safety and code quality tooling. The documentation and examples have been updated to reflect these changes, and tested support for Python 3.9 has been dropped in favor of newer versions.New Features and Functionality
AllowHydrogenIsotopesflag inchemformula.config, with corresponding documentation and usage examples (README.md,examples/example5.py,src/chemformula/chemformula.py) [1] [2] [3] [4]..contains_isotopesattribute to theChemFormulaclass for detecting specific isotopes in formulas, and updated documentation and examples accordingly (README.md,examples/example5.py,src/chemformula/chemformula.py) [1] [2].Code Quality, Type Safety and CI Improvements
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.code-testsandcode-quality, addedmypytype checking, and integrated Codecov for coverage reporting (.github/workflows/ci.yml,README.md) [1] [2] [3] [4].mypyand pinned minimum versions for all dev tools; test coverage options are now set inpyproject.toml[1] [2].Python Version and Dependency Updates
requires-pythonand classifiers inpyproject.toml[1] [2] [3].casregnumdependency to>=1.1.2.Documentation and Example Enhancements
.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].Packaging and Metadata
src/chemformula/__init__.pyusingimportlib.metadata.pyproject.toml.These changes collectively modernize the codebase, improve usability for chemical isotope work, and ensure higher code quality and maintainability.