pypac-multiply
pypac-multiply is a small, dependency-free Python library that converts an
integer into a basic or complex IUPAC numerical multiplier prefix.
from pypac_multiply import multiplier
multiplier(1) # "mono"
multiplier(21) # "henicosa"
multiplier(32) # "dotriaconta"
multiplier(241) # "hentetracontadicta"
multiplier(4, complex=True) # "tetrakis"
multiplier(231, complex=True) # "hentriacontadictakis"
The package generates terms algorithmically for the complete range covered by the IUPAC rules, 1 through 9999. It has no runtime dependencies.
Installation
python -m pip install pypac-multiply
Usage
The public API consists of one function:
def multiplier(number: int, *, complex: bool = False) -> str: ...
number must be a built-in integer from 1 through 9999. Values outside that
range raise ValueError; other types and integer subclasses, including
bool, raise TypeError.
multiplier(0) # ValueError
multiplier(4.2) # TypeError
multiplier(True) # TypeError
Set complex=True for compound or complex features, such as substituted
substituents:
multiplier(2, complex=True) # "bis"
multiplier(3, complex=True) # "tris"
multiplier(4, complex=True) # "tetrakis"
multiplier(12, complex=True) # "dodecakis"
The complex form supports 2 through 9999. IUPAC defines no complex counterpart
to mono, so multiplier(1, complex=True) raises ValueError. The complex
option is keyword-only and must be a bool.
The implementation follows sections P-14.2.1 and P-14.2.2 of the 2013 IUPAC
Nomenclature of Organic Chemistry (the Blue Book). Composite terms cite
units before tens, hundreds, and thousands. It also implements the prescribed
exceptional forms for 1, 2, and 11, the bis and tris complex forms, and the
elision of the initial i of icosa after a vowel.
One source inconsistency is resolved in favor of the construction rule: Blue
Book Table 1.4 prints henkilla for 1001, while the same table defines 1000 as
kilia and P-14.2.1.2 requires direct joining. This package therefore returns
henkilia for 1001.
Development
Clone the repository and install the development dependencies using a tool that supports the standardized dependency-groups table, for example:
python -m pip install --group dev --editable .
Then run the checks:
pytest
ruff check .
ruff format --check .
mypy
python -m build
python -m twine check dist/*
References
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pypac_multiply-0.2.0.tar.gz.
File metadata
- Download URL: pypac_multiply-0.2.0.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32b29547044e267e07f260e44c1a43609629cafaadee0c3eba36b7e6736cbacf
|
|
| MD5 |
eb45af85fc1aeac766130d8768e2eda9
|
|
| BLAKE2b-256 |
d345a71af326eb1993f580f2eb30e6db93e45ba8cae575077a51d241aa545fb7
|
Provenance
The following attestation bundles were made for pypac_multiply-0.2.0.tar.gz:
Publisher:
python-publish.yml on adunavolgyi/pypac-multiply
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pypac_multiply-0.2.0.tar.gz -
Subject digest:
32b29547044e267e07f260e44c1a43609629cafaadee0c3eba36b7e6736cbacf - Sigstore transparency entry: 2385690850
- Sigstore integration time:
-
Permalink:
adunavolgyi/pypac-multiply@25fec47ee8b9565d6e1a146b1ad657968d57f320 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/adunavolgyi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@25fec47ee8b9565d6e1a146b1ad657968d57f320 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pypac_multiply-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pypac_multiply-0.2.0-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5eabb83922d1411b3a9d09481620694f1bcc8e1844228b60a4cf3a5e147892a0
|
|
| MD5 |
909fe8ee884c2fff3edac09a24118308
|
|
| BLAKE2b-256 |
0b3dfa123a328f051f82280bddb22d1825f61b147c4f3895dbb9e5c97d469335
|
Provenance
The following attestation bundles were made for pypac_multiply-0.2.0-py3-none-any.whl:
Publisher:
python-publish.yml on adunavolgyi/pypac-multiply
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pypac_multiply-0.2.0-py3-none-any.whl -
Subject digest:
5eabb83922d1411b3a9d09481620694f1bcc8e1844228b60a4cf3a5e147892a0 - Sigstore transparency entry: 2385691671
- Sigstore integration time:
-
Permalink:
adunavolgyi/pypac-multiply@25fec47ee8b9565d6e1a146b1ad657968d57f320 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/adunavolgyi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@25fec47ee8b9565d6e1a146b1ad657968d57f320 -
Trigger Event:
push
-
Statement type: