nispo 0.1.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. nispo-0.1.6/LICENSE +28 -0
  2. nispo-0.1.6/MANIFEST.in +30 -0
  3. nispo-0.1.6/PKG-INFO +90 -0
  4. nispo-0.1.6/README.md +70 -0
  5. nispo-0.1.6/THIRD_PARTY_NOTICES.md +35 -0
  6. nispo-0.1.6/nispo/__init__.py +5 -0
  7. nispo-0.1.6/nispo/acyclic/__init__.py +5 -0
  8. nispo-0.1.6/nispo/acyclic/rules.py +2426 -0
  9. nispo-0.1.6/nispo/acyclic_rules.py +5 -0
  10. nispo-0.1.6/nispo/api.py +129 -0
  11. nispo-0.1.6/nispo/benzimidazole_orientation.py +24 -0
  12. nispo-0.1.6/nispo/branch/__init__.py +5 -0
  13. nispo-0.1.6/nispo/branch/carbon.py +2475 -0
  14. nispo-0.1.6/nispo/branch/functional_groups.py +2146 -0
  15. nispo-0.1.6/nispo/branch/functional_suffixes.py +40 -0
  16. nispo-0.1.6/nispo/branch/graph_facts.py +140 -0
  17. nispo-0.1.6/nispo/branch/hetero_atoms.py +1328 -0
  18. nispo-0.1.6/nispo/branch/registry.py +35 -0
  19. nispo-0.1.6/nispo/branch/ring_substituents.py +2211 -0
  20. nispo-0.1.6/nispo/branch_rendering.py +2727 -0
  21. nispo-0.1.6/nispo/branch_rules.py +444 -0
  22. nispo-0.1.6/nispo/candidate_fact_ranker_model.py +17005 -0
  23. nispo-0.1.6/nispo/candidate_fact_switch_gate_model.py +1444 -0
  24. nispo-0.1.6/nispo/candidate_facts.py +94 -0
  25. nispo-0.1.6/nispo/constants.py +197 -0
  26. nispo-0.1.6/nispo/cycle_utils.py +50 -0
  27. nispo-0.1.6/nispo/engine_flags.py +48 -0
  28. nispo-0.1.6/nispo/formatting.py +459 -0
  29. nispo-0.1.6/nispo/fragment_rules.py +2826 -0
  30. nispo-0.1.6/nispo/fused_rules.py +497 -0
  31. nispo-0.1.6/nispo/fused_template_families.py +582 -0
  32. nispo-0.1.6/nispo/graph_model.py +101 -0
  33. nispo-0.1.6/nispo/molecule_cache.py +44 -0
  34. nispo-0.1.6/nispo/molecule_facts.py +227 -0
  35. nispo-0.1.6/nispo/name_parts.py +45 -0
  36. nispo-0.1.6/nispo/naming_context.py +477 -0
  37. nispo-0.1.6/nispo/opsin_resource_utils.py +78 -0
  38. nispo-0.1.6/nispo/parent/__init__.py +1 -0
  39. nispo-0.1.6/nispo/parent/partial_hydro.py +56 -0
  40. nispo-0.1.6/nispo/parent/rule_helpers.py +4464 -0
  41. nispo-0.1.6/nispo/parent_rules.py +22203 -0
  42. nispo-0.1.6/nispo/polycyclic_rules.py +2398 -0
  43. nispo-0.1.6/nispo/resource_io.py +16 -0
  44. nispo-0.1.6/nispo/resource_manifest.py +90 -0
  45. nispo-0.1.6/nispo/resource_operations.py +178 -0
  46. nispo-0.1.6/nispo/resource_templates.py +2555 -0
  47. nispo-0.1.6/nispo/resources/generated_fused_template_element_graph_index.json +1 -0
  48. nispo-0.1.6/nispo/resources/generated_fused_template_graph_index.json +1 -0
  49. nispo-0.1.6/nispo/resources/generated_fused_template_index.json +1 -0
  50. nispo-0.1.6/nispo/resources/generated_fused_template_index_records.json.gz +0 -0
  51. nispo-0.1.6/nispo/resources/generated_fused_templates.json +1 -0
  52. nispo-0.1.6/nispo/resources/generated_spiro_scaffold_templates.json +36677 -0
  53. nispo-0.1.6/nispo/resources/high_impact_fused_parent_templates.json +582 -0
  54. nispo-0.1.6/nispo/resources/opsin_polyacene_helicene_templates.json +573 -0
  55. nispo-0.1.6/nispo/resources/opsin_polycyclic_arene_templates.json +521 -0
  56. nispo-0.1.6/nispo/resources/opsin_retained_mono_fused_ring_smiles.csv +1606 -0
  57. nispo-0.1.6/nispo/resources/opsin_retained_mono_fused_ring_templates.json +35626 -0
  58. nispo-0.1.6/nispo/resources/opsin_test_scaffold_templates.json +1667 -0
  59. nispo-0.1.6/nispo/resources/opsin_tokens/alkanes.xml +71 -0
  60. nispo-0.1.6/nispo/resources/opsin_tokens/aminoAcids.xml +284 -0
  61. nispo-0.1.6/nispo/resources/opsin_tokens/arylGroups.xml +419 -0
  62. nispo-0.1.6/nispo/resources/opsin_tokens/arylSubstituents.xml +133 -0
  63. nispo-0.1.6/nispo/resources/opsin_tokens/atomHydrides.xml +41 -0
  64. nispo-0.1.6/nispo/resources/opsin_tokens/carbohydrateSuffixes.xml +90 -0
  65. nispo-0.1.6/nispo/resources/opsin_tokens/carbohydrates.xml +205 -0
  66. nispo-0.1.6/nispo/resources/opsin_tokens/carboxylicAcids.xml +328 -0
  67. nispo-0.1.6/nispo/resources/opsin_tokens/chargeAndOxidationNumberSpecifiers.xml +53 -0
  68. nispo-0.1.6/nispo/resources/opsin_tokens/cyclicUnsaturableHydrocarbon.xml +23 -0
  69. nispo-0.1.6/nispo/resources/opsin_tokens/elementaryAtoms.xml +210 -0
  70. nispo-0.1.6/nispo/resources/opsin_tokens/functionalTerms.xml +180 -0
  71. nispo-0.1.6/nispo/resources/opsin_tokens/fusionComponents.xml +158 -0
  72. nispo-0.1.6/nispo/resources/opsin_tokens/germanTokens.xml +18 -0
  73. nispo-0.1.6/nispo/resources/opsin_tokens/groupStemsAllowingAllSuffixes.xml +9 -0
  74. nispo-0.1.6/nispo/resources/opsin_tokens/groupStemsAllowingInlineSuffixes.xml +63 -0
  75. nispo-0.1.6/nispo/resources/opsin_tokens/heteroAtoms.xml +302 -0
  76. nispo-0.1.6/nispo/resources/opsin_tokens/hwHeteroAtoms.xml +136 -0
  77. nispo-0.1.6/nispo/resources/opsin_tokens/hwSuffixes.xml +71 -0
  78. nispo-0.1.6/nispo/resources/opsin_tokens/index.xml +41 -0
  79. nispo-0.1.6/nispo/resources/opsin_tokens/infixes.xml +43 -0
  80. nispo-0.1.6/nispo/resources/opsin_tokens/inlineChargeSuffixes.xml +15 -0
  81. nispo-0.1.6/nispo/resources/opsin_tokens/inlineSuffixes.xml +71 -0
  82. nispo-0.1.6/nispo/resources/opsin_tokens/miscTokens.xml +215 -0
  83. nispo-0.1.6/nispo/resources/opsin_tokens/multiRadicalSubstituents.xml +138 -0
  84. nispo-0.1.6/nispo/resources/opsin_tokens/multipliers.xml +144 -0
  85. nispo-0.1.6/nispo/resources/opsin_tokens/naturalProducts.xml +154 -0
  86. nispo-0.1.6/nispo/resources/opsin_tokens/nonCarboxylicAcids.xml +266 -0
  87. nispo-0.1.6/nispo/resources/opsin_tokens/regexTokens.xml +80 -0
  88. nispo-0.1.6/nispo/resources/opsin_tokens/regexes.xml +375 -0
  89. nispo-0.1.6/nispo/resources/opsin_tokens/simpleCyclicGroups.xml +169 -0
  90. nispo-0.1.6/nispo/resources/opsin_tokens/simpleGroups.xml +517 -0
  91. nispo-0.1.6/nispo/resources/opsin_tokens/simpleSubstituents.xml +557 -0
  92. nispo-0.1.6/nispo/resources/opsin_tokens/substituents.xml +16 -0
  93. nispo-0.1.6/nispo/resources/opsin_tokens/suffixApplicability.xml +309 -0
  94. nispo-0.1.6/nispo/resources/opsin_tokens/suffixPrefix.xml +23 -0
  95. nispo-0.1.6/nispo/resources/opsin_tokens/suffixRules.xml +506 -0
  96. nispo-0.1.6/nispo/resources/opsin_tokens/suffixes.xml +142 -0
  97. nispo-0.1.6/nispo/resources/opsin_tokens/unsaturators.xml +13 -0
  98. nispo-0.1.6/nispo/resources/opsin_tokens/wordRules.xml +387 -0
  99. nispo-0.1.6/nispo/ring/__init__.py +5 -0
  100. nispo-0.1.6/nispo/ring/hydrogen.py +19 -0
  101. nispo-0.1.6/nispo/ring_resource_rules.py +70 -0
  102. nispo-0.1.6/nispo/ring_rules.py +2145 -0
  103. nispo-0.1.6/nispo/ring_topology.py +63 -0
  104. nispo-0.1.6/nispo/route_plan.py +90 -0
  105. nispo-0.1.6/nispo/rule_dispatch.py +563 -0
  106. nispo-0.1.6/nispo/rule_engine.py +18220 -0
  107. nispo-0.1.6/nispo/rule_priority.py +279 -0
  108. nispo-0.1.6/nispo/scaffold_catalog.py +15 -0
  109. nispo-0.1.6/nispo/simple_prefixes.py +1721 -0
  110. nispo-0.1.6/nispo/spiro_component_rules.py +1591 -0
  111. nispo-0.1.6/nispo/stereochemistry.py +473 -0
  112. nispo-0.1.6/nispo/structural_profile.py +499 -0
  113. nispo-0.1.6/nispo/substituent_resource_rules.py +369 -0
  114. nispo-0.1.6/nispo/suffix_store.py +104 -0
  115. nispo-0.1.6/nispo/sulfur_oxo_rules.py +442 -0
  116. nispo-0.1.6/nispo/telemetry.py +299 -0
  117. nispo-0.1.6/nispo/template_access.py +13 -0
  118. nispo-0.1.6/nispo/template_index.py +504 -0
  119. nispo-0.1.6/nispo/template_match_utils.py +28 -0
  120. nispo-0.1.6/nispo/template_store.py +582 -0
  121. nispo-0.1.6/nispo.egg-info/PKG-INFO +90 -0
  122. nispo-0.1.6/nispo.egg-info/SOURCES.txt +125 -0
  123. nispo-0.1.6/nispo.egg-info/dependency_links.txt +1 -0
  124. nispo-0.1.6/nispo.egg-info/requires.txt +1 -0
  125. nispo-0.1.6/nispo.egg-info/top_level.txt +1 -0
  126. nispo-0.1.6/pyproject.toml +87 -0
  127. nispo-0.1.6/setup.cfg +4 -0
nispo-0.1.6/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2026, Oxford Protein Informatics Group
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,30 @@
1
+ include LICENSE
2
+ include THIRD_PARTY_NOTICES.md
3
+ include README.md
4
+ include pyproject.toml
5
+
6
+ recursive-include nispo *.py
7
+ recursive-include nispo/resources/opsin_tokens *.xml
8
+ include nispo/resources/generated_fused_template_element_graph_index.json
9
+ include nispo/resources/generated_fused_template_graph_index.json
10
+ include nispo/resources/generated_fused_template_index.json
11
+ include nispo/resources/generated_fused_template_index_records.json.gz
12
+ include nispo/resources/generated_fused_templates.json
13
+ include nispo/resources/generated_spiro_scaffold_templates.json
14
+ include nispo/resources/high_impact_fused_parent_templates.json
15
+ include nispo/resources/opsin_polyacene_helicene_templates.json
16
+ include nispo/resources/opsin_polycyclic_arene_templates.json
17
+ include nispo/resources/opsin_retained_mono_fused_ring_smiles.csv
18
+ include nispo/resources/opsin_retained_mono_fused_ring_templates.json
19
+ include nispo/resources/opsin_test_scaffold_templates.json
20
+
21
+ prune build
22
+ prune dist
23
+ prune tests
24
+ prune tools
25
+ prune graphify-out
26
+ prune nispo/graphify-out
27
+ global-exclude *.py[cod]
28
+ global-exclude __pycache__
29
+ global-exclude .DS_Store
30
+ exclude nispo/resources/generated_fused_template_index_records.json
nispo-0.1.6/PKG-INFO ADDED
@@ -0,0 +1,90 @@
1
+ Metadata-Version: 2.4
2
+ Name: nispo
3
+ Version: 0.1.6
4
+ Summary: SMILES to IUPAC naming tool optimized by OPSIN roundtrip benchmarks.
5
+ Author: Nicholas T. Runcie
6
+ Maintainer: Oxford Protein Informatics Group
7
+ License-Expression: BSD-3-Clause
8
+ Project-URL: Repository, https://github.com/oxpig/nispo
9
+ Project-URL: Issues, https://github.com/oxpig/nispo/issues
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Topic :: Scientific/Engineering :: Chemistry
14
+ Requires-Python: >=3.10
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ License-File: THIRD_PARTY_NOTICES.md
18
+ Requires-Dist: rdkit>=2023.9
19
+ Dynamic: license-file
20
+
21
+ # NISPO
22
+
23
+ NISPO is an open-source, RDKit-based Python package for generating IUPAC names
24
+ of molecules. Generated names are designed to pass an OPSIN round-trip test, in
25
+ which [OPSIN](https://doi.org/10.1021/ci100384d) parses the name back to the same
26
+ molecular structure. The entire NISPO codebase was generated by OpenAI Codex
27
+ using GPT-5.5.
28
+
29
+ ## Installation
30
+
31
+ ```bash
32
+ pip install nispo
33
+ ```
34
+
35
+ NISPO requires Python 3.10 or newer.
36
+
37
+ ## Quick start
38
+
39
+ Use `smiles_to_iupac` to convert a single SMILES string, or
40
+ `smiles_to_iupac_batch` to convert multiple SMILES strings at once:
41
+
42
+ ```python
43
+ from nispo import smiles_to_iupac, smiles_to_iupac_batch
44
+
45
+ smiles_to_iupac("CCO")
46
+ # 'ethanol'
47
+
48
+ smiles_to_iupac_batch(["CCO", "not-a-smiles"])
49
+ # ['ethanol', '']
50
+ ```
51
+
52
+ Unsuccessful conversions return an empty string (`""`). Batch conversion
53
+ preserves the number and order of the inputs.
54
+
55
+ ## Performance
56
+
57
+ NISPO achieved 98.1% OPSIN round-trip accuracy on a held-out benchmark of 103
58
+ million PubChem compounds. It is optimized for OPSIN round-trip validity rather
59
+ than preferred IUPAC nomenclature, so generated names may differ from names
60
+ listed in databases.
61
+
62
+ ## Citation
63
+
64
+ If you use NISPO in your work, please cite:
65
+
66
+ ```bibtex
67
+ @article{runcie2026nispo,
68
+ title = {NISPO: Open-source IUPAC name generation tool},
69
+ author = {Runcie, Nicholas T. and Imrie, Fergus and Deane, Charlotte M.},
70
+ journal = {},
71
+ year = {},
72
+ doi = {}
73
+ }
74
+ ```
75
+
76
+ OPSIN is described in Lowe, D. M.; Corbett, P. T.; Murray-Rust, P.; Glen, R. C.
77
+ *Chemical Name to Structure: OPSIN, an Open Source Solution.* **Journal of
78
+ Chemical Information and Modeling** 2011, 51 (3), 739–753.
79
+ [https://doi.org/10.1021/ci100384d](https://doi.org/10.1021/ci100384d).
80
+
81
+ ## License
82
+
83
+ NISPO is released under the BSD 3-Clause License. See [LICENSE](LICENSE).
84
+
85
+ ## AI disclosure
86
+
87
+ This repository was developed using OpenAI Codex. The codebase is AI-generated
88
+ and was created through an autonomous self-iteration process: Codex repeatedly
89
+ ran the benchmark, inspected failures, updated the implementation, and reran
90
+ the benchmark until high OPSIN round-trip accuracy was achieved.
nispo-0.1.6/README.md ADDED
@@ -0,0 +1,70 @@
1
+ # NISPO
2
+
3
+ NISPO is an open-source, RDKit-based Python package for generating IUPAC names
4
+ of molecules. Generated names are designed to pass an OPSIN round-trip test, in
5
+ which [OPSIN](https://doi.org/10.1021/ci100384d) parses the name back to the same
6
+ molecular structure. The entire NISPO codebase was generated by OpenAI Codex
7
+ using GPT-5.5.
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ pip install nispo
13
+ ```
14
+
15
+ NISPO requires Python 3.10 or newer.
16
+
17
+ ## Quick start
18
+
19
+ Use `smiles_to_iupac` to convert a single SMILES string, or
20
+ `smiles_to_iupac_batch` to convert multiple SMILES strings at once:
21
+
22
+ ```python
23
+ from nispo import smiles_to_iupac, smiles_to_iupac_batch
24
+
25
+ smiles_to_iupac("CCO")
26
+ # 'ethanol'
27
+
28
+ smiles_to_iupac_batch(["CCO", "not-a-smiles"])
29
+ # ['ethanol', '']
30
+ ```
31
+
32
+ Unsuccessful conversions return an empty string (`""`). Batch conversion
33
+ preserves the number and order of the inputs.
34
+
35
+ ## Performance
36
+
37
+ NISPO achieved 98.1% OPSIN round-trip accuracy on a held-out benchmark of 103
38
+ million PubChem compounds. It is optimized for OPSIN round-trip validity rather
39
+ than preferred IUPAC nomenclature, so generated names may differ from names
40
+ listed in databases.
41
+
42
+ ## Citation
43
+
44
+ If you use NISPO in your work, please cite:
45
+
46
+ ```bibtex
47
+ @article{runcie2026nispo,
48
+ title = {NISPO: Open-source IUPAC name generation tool},
49
+ author = {Runcie, Nicholas T. and Imrie, Fergus and Deane, Charlotte M.},
50
+ journal = {},
51
+ year = {},
52
+ doi = {}
53
+ }
54
+ ```
55
+
56
+ OPSIN is described in Lowe, D. M.; Corbett, P. T.; Murray-Rust, P.; Glen, R. C.
57
+ *Chemical Name to Structure: OPSIN, an Open Source Solution.* **Journal of
58
+ Chemical Information and Modeling** 2011, 51 (3), 739–753.
59
+ [https://doi.org/10.1021/ci100384d](https://doi.org/10.1021/ci100384d).
60
+
61
+ ## License
62
+
63
+ NISPO is released under the BSD 3-Clause License. See [LICENSE](LICENSE).
64
+
65
+ ## AI disclosure
66
+
67
+ This repository was developed using OpenAI Codex. The codebase is AI-generated
68
+ and was created through an autonomous self-iteration process: Codex repeatedly
69
+ ran the benchmark, inspected failures, updated the implementation, and reran
70
+ the benchmark until high OPSIN round-trip accuracy was achieved.
@@ -0,0 +1,35 @@
1
+ # Third-Party Notices
2
+
3
+ NISPO was developed using OPSIN as the primary validation oracle and behavioral
4
+ reference. The package includes OPSIN-derived token resources under:
5
+
6
+ ```text
7
+ nispo/resources/opsin_tokens/
8
+ ```
9
+
10
+ Generated fused-template JSON resources in `nispo/resources/` were produced from
11
+ NISPO tooling that used OPSIN-accepted nomenclature/resource information during
12
+ development.
13
+
14
+ ## OPSIN
15
+
16
+ OPSIN is distributed under the MIT License.
17
+
18
+ Copyright 2017 Daniel Lowe
19
+
20
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
21
+ this software and associated documentation files (the "Software"), to deal in the
22
+ Software without restriction, including without limitation the rights to use,
23
+ copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
24
+ Software, and to permit persons to whom the Software is furnished to do so,
25
+ subject to the following conditions:
26
+
27
+ The above copyright notice and this permission notice shall be included in all
28
+ copies or substantial portions of the Software.
29
+
30
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
32
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
33
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
34
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
35
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,5 @@
1
+ from .api import smiles_to_iupac, smiles_to_iupac_batch
2
+
3
+ __version__ = "0.1.6"
4
+
5
+ __all__ = ["__version__", "smiles_to_iupac", "smiles_to_iupac_batch"]
@@ -0,0 +1,5 @@
1
+ from __future__ import annotations
2
+
3
+ from .rules import AcyclicNameRecord, name_acyclic, name_acyclic_record
4
+
5
+ __all__ = ["AcyclicNameRecord", "name_acyclic", "name_acyclic_record"]