rxnmapper 0.4.2__tar.gz → 0.5.0__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 (31) hide show
  1. {rxnmapper-0.4.2/rxnmapper.egg-info → rxnmapper-0.5.0}/PKG-INFO +24 -35
  2. {rxnmapper-0.4.2 → rxnmapper-0.5.0}/README.md +18 -26
  3. {rxnmapper-0.4.2 → rxnmapper-0.5.0}/pyproject.toml +0 -4
  4. {rxnmapper-0.4.2 → rxnmapper-0.5.0}/rxnmapper/__init__.py +1 -1
  5. {rxnmapper-0.4.2 → rxnmapper-0.5.0}/rxnmapper/batched_mapper.py +2 -5
  6. {rxnmapper-0.4.2 → rxnmapper-0.5.0}/rxnmapper/core.py +23 -18
  7. {rxnmapper-0.4.2 → rxnmapper-0.5.0}/rxnmapper/smiles_utils.py +1 -1
  8. {rxnmapper-0.4.2 → rxnmapper-0.5.0}/rxnmapper/tokenization_smiles.py +70 -19
  9. {rxnmapper-0.4.2 → rxnmapper-0.5.0/rxnmapper.egg-info}/PKG-INFO +24 -35
  10. {rxnmapper-0.4.2 → rxnmapper-0.5.0}/rxnmapper.egg-info/requires.txt +0 -5
  11. {rxnmapper-0.4.2 → rxnmapper-0.5.0}/setup.cfg +5 -8
  12. {rxnmapper-0.4.2 → rxnmapper-0.5.0}/LICENSE +0 -0
  13. {rxnmapper-0.4.2 → rxnmapper-0.5.0}/MANIFEST.in +0 -0
  14. {rxnmapper-0.4.2 → rxnmapper-0.5.0}/rxnmapper/attention.py +0 -0
  15. {rxnmapper-0.4.2 → rxnmapper-0.5.0}/rxnmapper/models/transformers/albert_heads_8_uspto_all_1310k/config.json +0 -0
  16. {rxnmapper-0.4.2 → rxnmapper-0.5.0}/rxnmapper/models/transformers/albert_heads_8_uspto_all_1310k/pytorch_model.bin +0 -0
  17. {rxnmapper-0.4.2 → rxnmapper-0.5.0}/rxnmapper/models/transformers/albert_heads_8_uspto_all_1310k/special_tokens_map.json +0 -0
  18. {rxnmapper-0.4.2 → rxnmapper-0.5.0}/rxnmapper/models/transformers/albert_heads_8_uspto_all_1310k/tokenizer_config.json +0 -0
  19. {rxnmapper-0.4.2 → rxnmapper-0.5.0}/rxnmapper/models/transformers/albert_heads_8_uspto_all_1310k/training_args.bin +0 -0
  20. {rxnmapper-0.4.2 → rxnmapper-0.5.0}/rxnmapper/models/transformers/albert_heads_8_uspto_all_1310k/vocab.txt +0 -0
  21. {rxnmapper-0.4.2 → rxnmapper-0.5.0}/rxnmapper/py.typed +0 -0
  22. {rxnmapper-0.4.2 → rxnmapper-0.5.0}/rxnmapper.egg-info/SOURCES.txt +0 -0
  23. {rxnmapper-0.4.2 → rxnmapper-0.5.0}/rxnmapper.egg-info/dependency_links.txt +0 -0
  24. {rxnmapper-0.4.2 → rxnmapper-0.5.0}/rxnmapper.egg-info/not-zip-safe +0 -0
  25. {rxnmapper-0.4.2 → rxnmapper-0.5.0}/rxnmapper.egg-info/top_level.txt +0 -0
  26. {rxnmapper-0.4.2 → rxnmapper-0.5.0}/setup.py +0 -0
  27. {rxnmapper-0.4.2 → rxnmapper-0.5.0}/tests/__init__.py +0 -0
  28. {rxnmapper-0.4.2 → rxnmapper-0.5.0}/tests/test_batched_mapper.py +0 -0
  29. {rxnmapper-0.4.2 → rxnmapper-0.5.0}/tests/test_mapper.py +0 -0
  30. {rxnmapper-0.4.2 → rxnmapper-0.5.0}/tests/test_smiles_utils.py +0 -0
  31. {rxnmapper-0.4.2 → rxnmapper-0.5.0}/tests/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rxnmapper
3
- Version: 0.4.2
3
+ Version: 0.5.0
4
4
  Summary: Reaction atom-mapping from transformers
5
5
  Home-page: https://github.com/rxn4chemistry/rxnmapper
6
6
  Author: IBM RXN team
@@ -9,16 +9,14 @@ License: MIT
9
9
  Classifier: Operating System :: OS Independent
10
10
  Classifier: Intended Audience :: Developers
11
11
  Classifier: Intended Audience :: Science/Research
12
- Classifier: License :: OSI Approved :: MIT License
13
12
  Classifier: Programming Language :: Python :: 3
14
- Classifier: Programming Language :: Python :: 3.6
15
- Classifier: Programming Language :: Python :: 3.7
16
- Classifier: Programming Language :: Python :: 3.8
17
- Classifier: Programming Language :: Python :: 3.9
18
13
  Classifier: Programming Language :: Python :: 3.10
19
14
  Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
20
18
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
- Requires-Python: >=3.6
19
+ Requires-Python: >=3.10
22
20
  Description-Content-Type: text/markdown
23
21
  License-File: LICENSE
24
22
  Requires-Dist: pandas>=1.0.3
@@ -38,8 +36,7 @@ Requires-Dist: sphinx==2.2.1; extra == "dev"
38
36
  Requires-Dist: twine==3.1.1; extra == "dev"
39
37
  Requires-Dist: types-setuptools>=62.6.0; extra == "dev"
40
38
  Provides-Extra: rdkit
41
- Requires-Dist: rdkit-pypi>=2021.3.2; python_version < "3.7" and extra == "rdkit"
42
- Requires-Dist: rdkit>=2022.3.4; python_version >= "3.7" and extra == "rdkit"
39
+ Requires-Dist: rdkit>=2022.3.4; extra == "rdkit"
43
40
  Dynamic: license-file
44
41
 
45
42
  # Extraction of organic chemistry grammar from unsupervised learning of chemical reactions
@@ -51,37 +48,27 @@ Enable robust atom mapping on valid reaction SMILES. The atom-mapping informatio
51
48
 
52
49
  ## Installation
53
50
 
54
- ### From pip
55
- ```console
56
- conda create -n rxnmapper python=3.6 -y
57
- conda activate rxnmapper
58
- pip install rxnmapper
51
+ ### Create virtual environment (optional)
52
+
53
+ ```bash
54
+ python3 -m venv .venv
55
+ source .venv/bin/activate
59
56
  ```
60
57
 
61
- ### From github
62
- You can install the package and setup the environment directly from github using:
58
+ ### Install from pip
63
59
 
64
- ```console
65
- git clone https://github.com/rxn4chemistry/rxnmapper.git
66
- cd rxnmapper
67
- conda create -n rxnmapper python=3.6 -y
68
- conda activate rxnmapper
69
- pip install -e .
60
+ ```bash
61
+ pip install "rxnmapper[rdkit]"
70
62
  ```
71
63
 
72
- ### RDkit
64
+ You can leave out `[rdkit]` if RDKit is already available in your Python environment.
73
65
 
74
- In both installation settings above, the `RDKit` dependency is not installed automatically, unless you include the extra when installing: `pip install "rxmapper[rdkit]"`.
75
- It can also be installed via Conda or Pypi:
66
+ ### From source
76
67
 
77
68
  ```bash
78
- # Install RDKit from Conda
79
- conda install -c conda-forge rdkit
80
-
81
- # Install RDKit from Pypi
82
- pip install rdkit
83
- # for Python<3.7
84
- # pip install rdkit-pypi
69
+ git clone https://github.com/rxn4chemistry/rxnmapper.git
70
+ cd rxnmapper
71
+ pip install -e ".[rdkit]"
85
72
  ```
86
73
 
87
74
  ## Usage
@@ -118,10 +105,12 @@ results = list(rxn_mapper.map_reactions_with_info(rxns)) # results as dictionar
118
105
 
119
106
  ### Testing
120
107
 
121
- You can run the examples above with the test suite as well:
108
+ You can run the test suite with:
122
109
 
123
- 1. In your Conda environment: `pip install -e .[dev]`
124
- 2. `pytest tests` from the root
110
+ ```bash
111
+ pip install -e .[dev,rdkit]
112
+ pytest tests
113
+ ```
125
114
 
126
115
  ## Examples
127
116
 
@@ -7,37 +7,27 @@ Enable robust atom mapping on valid reaction SMILES. The atom-mapping informatio
7
7
 
8
8
  ## Installation
9
9
 
10
- ### From pip
11
- ```console
12
- conda create -n rxnmapper python=3.6 -y
13
- conda activate rxnmapper
14
- pip install rxnmapper
10
+ ### Create virtual environment (optional)
11
+
12
+ ```bash
13
+ python3 -m venv .venv
14
+ source .venv/bin/activate
15
15
  ```
16
16
 
17
- ### From github
18
- You can install the package and setup the environment directly from github using:
17
+ ### Install from pip
19
18
 
20
- ```console
21
- git clone https://github.com/rxn4chemistry/rxnmapper.git
22
- cd rxnmapper
23
- conda create -n rxnmapper python=3.6 -y
24
- conda activate rxnmapper
25
- pip install -e .
19
+ ```bash
20
+ pip install "rxnmapper[rdkit]"
26
21
  ```
27
22
 
28
- ### RDkit
23
+ You can leave out `[rdkit]` if RDKit is already available in your Python environment.
29
24
 
30
- In both installation settings above, the `RDKit` dependency is not installed automatically, unless you include the extra when installing: `pip install "rxmapper[rdkit]"`.
31
- It can also be installed via Conda or Pypi:
25
+ ### From source
32
26
 
33
27
  ```bash
34
- # Install RDKit from Conda
35
- conda install -c conda-forge rdkit
36
-
37
- # Install RDKit from Pypi
38
- pip install rdkit
39
- # for Python<3.7
40
- # pip install rdkit-pypi
28
+ git clone https://github.com/rxn4chemistry/rxnmapper.git
29
+ cd rxnmapper
30
+ pip install -e ".[rdkit]"
41
31
  ```
42
32
 
43
33
  ## Usage
@@ -74,10 +64,12 @@ results = list(rxn_mapper.map_reactions_with_info(rxns)) # results as dictionar
74
64
 
75
65
  ### Testing
76
66
 
77
- You can run the examples above with the test suite as well:
67
+ You can run the test suite with:
78
68
 
79
- 1. In your Conda environment: `pip install -e .[dev]`
80
- 2. `pytest tests` from the root
69
+ ```bash
70
+ pip install -e .[dev,rdkit]
71
+ pytest tests
72
+ ```
81
73
 
82
74
  ## Examples
83
75
 
@@ -4,14 +4,10 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [tool.mypy]
6
6
  check_untyped_defs = true
7
- plugins = [
8
- "numpy.typing.mypy_plugin",
9
- ]
10
7
 
11
8
  [[tool.mypy.overrides]]
12
9
  module = [
13
10
  "pandas.*",
14
- "pkg_resources.*",
15
11
  "rdkit.*",
16
12
  "scipy.*",
17
13
  "tqdm.*",
@@ -1,7 +1,7 @@
1
1
  """rxnmapper initialization."""
2
2
 
3
3
  __name__ = "rxnmapper"
4
- __version__ = "0.4.2" # managed by bump2version
4
+ __version__ = "0.5.0" # managed by bump2version
5
5
 
6
6
 
7
7
  from .batched_mapper import BatchedMapper
@@ -1,11 +1,10 @@
1
1
  import logging
2
2
  from typing import Any, Dict, Iterable, Iterator, List, Optional
3
3
 
4
- import pkg_resources
5
4
  from rxn.utilities.containers import chunker
6
5
  from rxn.utilities.files import PathLike
7
6
 
8
- from .core import RXNMapper
7
+ from .core import DEFAULT_MODEL_PATH, RXNMapper
9
8
 
10
9
  logger = logging.getLogger(__name__)
11
10
  logger.addHandler(logging.NullHandler())
@@ -45,9 +44,7 @@ class BatchedMapper:
45
44
  is an issue in the prediction (number of tokens, invalid SMILES, ...).
46
45
  """
47
46
  if model_path is None:
48
- model_path = pkg_resources.resource_filename(
49
- "rxnmapper", "models/transformers/albert_heads_8_uspto_all_1310k"
50
- )
47
+ model_path = DEFAULT_MODEL_PATH
51
48
  self.mapper = RXNMapper(
52
49
  config=dict(
53
50
  model_path=str(model_path),
@@ -8,7 +8,6 @@ from contextlib import contextmanager
8
8
  from typing import Any, Dict, Iterator, List, Optional, Tuple
9
9
 
10
10
  import numpy as np
11
- import pkg_resources
12
11
  import torch
13
12
  from rxn.chemutils.reaction_equation import ReactionEquation
14
13
  from rxn.chemutils.reaction_smiles import (
@@ -23,7 +22,17 @@ from .attention import AttentionScorer
23
22
  from .smiles_utils import generate_atom_mapped_reaction_atoms, process_reaction
24
23
  from .tokenization_smiles import SmilesTokenizer
25
24
 
26
- MODEL_TYPE_DICT = {"bert": BertModel, "albert": AlbertModel, "roberta": RobertaModel}
25
+ MODEL_TYPE_DICT: Dict[str, Any] = {
26
+ "bert": BertModel,
27
+ "albert": AlbertModel,
28
+ "roberta": RobertaModel,
29
+ }
30
+ DEFAULT_MODEL_PATH = os.path.join(
31
+ os.path.dirname(__file__),
32
+ "models",
33
+ "transformers",
34
+ "albert_heads_8_uspto_all_1310k",
35
+ )
27
36
 
28
37
  _logger = logging.getLogger(__name__)
29
38
  _logger.addHandler(logging.NullHandler())
@@ -70,12 +79,7 @@ class RXNMapper:
70
79
  config = {}
71
80
 
72
81
  # Config takes "model_path", "model_type", "attention_multiplier", "head", "layers"
73
- self.model_path = config.get(
74
- "model_path",
75
- pkg_resources.resource_filename(
76
- "rxnmapper", "models/transformers/albert_heads_8_uspto_all_1310k"
77
- ),
78
- )
82
+ self.model_path = config.get("model_path", DEFAULT_MODEL_PATH)
79
83
  self.model_type = config.get("model_type", "albert")
80
84
  self.attention_multiplier = config.get("attention_multiplier", 90.0)
81
85
  self.head = config.get("head", 5)
@@ -94,12 +98,15 @@ class RXNMapper:
94
98
  Tuple: containing model and tokenizer
95
99
  """
96
100
  model_class = MODEL_TYPE_DICT[self.model_type]
97
- model = model_class.from_pretrained(
98
- self.model_path,
99
- output_attentions=True,
100
- output_past=False,
101
- output_hidden_states=False,
102
- )
101
+ model_kwargs: Dict[str, Any] = {
102
+ "output_attentions": True,
103
+ "output_past": False,
104
+ "output_hidden_states": False,
105
+ }
106
+ if getattr(model_class, "_supports_sdpa", False):
107
+ model_kwargs["attn_implementation"] = "eager"
108
+
109
+ model = model_class.from_pretrained(self.model_path, **model_kwargs)
103
110
 
104
111
  vocab_path = None
105
112
 
@@ -107,7 +114,7 @@ class RXNMapper:
107
114
  vocab_path = os.path.join(self.model_path, "vocab.txt")
108
115
 
109
116
  tokenizer = SmilesTokenizer(
110
- vocab_path, max_len=model.config.max_position_embeddings
117
+ vocab_path, model_max_length=model.config.max_position_embeddings
111
118
  )
112
119
  return (model, tokenizer)
113
120
 
@@ -134,7 +141,7 @@ class RXNMapper:
134
141
  else:
135
142
  use_head = force_head
136
143
 
137
- encoded_ids = self.tokenizer.batch_encode_plus(
144
+ encoded_ids = self.tokenizer(
138
145
  rxn_smiles_list,
139
146
  padding=True,
140
147
  return_tensors="pt",
@@ -148,8 +155,6 @@ class RXNMapper:
148
155
  f"Reaction SMILES has {max_input_length} tokens, should be at most {max_supported_by_model}."
149
156
  )
150
157
 
151
- # suppress warning that suggests setting "attn_implementation"; doing
152
- # so would break compatibility for old `transformers` versions.
153
158
  with suppress_transformers_warnings():
154
159
  with torch.no_grad():
155
160
  output = self.model(**parsed_input)
@@ -330,7 +330,7 @@ def canonicalize_and_atom_map(smi: str, return_equivalent_atoms=False):
330
330
  ]
331
331
  )
332
332
 
333
- atom_maps_canonical = [mol.GetAtoms()[idx].GetProp("atom_map") for idx in order] # type: ignore[call-arg]
333
+ atom_maps_canonical = [mol.GetAtomWithIdx(idx).GetProp("atom_map") for idx in order]
334
334
 
335
335
  if not return_equivalent_atoms:
336
336
  return (can_smi, atom_maps_canonical)
@@ -6,15 +6,16 @@ import collections
6
6
  import logging
7
7
  import os
8
8
  import re
9
+ from typing import Dict, List, Optional
9
10
 
10
- from transformers import BertTokenizer
11
+ from transformers import PreTrainedTokenizer
11
12
 
12
13
  from .smiles_utils import SMI_REGEX_PATTERN
13
14
 
14
15
  logger = logging.getLogger(__name__)
15
16
 
16
17
 
17
- class SmilesTokenizer(BertTokenizer):
18
+ class SmilesTokenizer(PreTrainedTokenizer):
18
19
  r"""
19
20
  Constructs a SmilesTokenizer.
20
21
  Mostly copied from https://github.com/huggingface/transformers
@@ -23,24 +24,25 @@ class SmilesTokenizer(BertTokenizer):
23
24
  vocab_file: Path to a SMILES character per line vocabulary file
24
25
  """
25
26
 
27
+ vocab_files_names = {"vocab_file": "vocab.txt"}
28
+ model_input_names = ["input_ids", "token_type_ids", "attention_mask"]
29
+
26
30
  def __init__(
27
31
  self,
28
- vocab_file,
29
- # unk_token="[UNK]",
30
- # sep_token="[SEP]",
31
- # pad_token="[PAD]",
32
- # cls_token="[CLS]",
33
- # mask_token="[MASK]",
34
- **kwargs
32
+ vocab_file: Optional[str],
33
+ unk_token: str = "[UNK]",
34
+ sep_token: str = "[SEP]",
35
+ pad_token: str = "[PAD]",
36
+ cls_token: str = "[CLS]",
37
+ mask_token: str = "[MASK]",
38
+ **kwargs,
35
39
  ):
36
- """Constructs a BertTokenizer.
40
+ """Constructs a SmilesTokenizer.
37
41
 
38
42
  Args:
39
43
  **vocab_file**: Path to a SMILES character per line vocabulary file
40
44
  """
41
- super().__init__(vocab_file, **kwargs)
42
-
43
- if not os.path.isfile(vocab_file):
45
+ if not vocab_file or not os.path.isfile(vocab_file):
44
46
  raise ValueError("Can't find a vocab file at path '{}'.".format(vocab_file))
45
47
  self.vocab = load_vocab(vocab_file)
46
48
  self.highest_unused_index = max(
@@ -49,29 +51,78 @@ class SmilesTokenizer(BertTokenizer):
49
51
  self.ids_to_tokens = collections.OrderedDict(
50
52
  [(ids, tok) for tok, ids in self.vocab.items()]
51
53
  )
52
- self.basic_tokenizer = BasicSmilesTokenizer() # type: ignore[assignment]
54
+ self.basic_tokenizer = BasicSmilesTokenizer()
55
+
56
+ if "max_len" in kwargs and "model_max_length" not in kwargs:
57
+ kwargs["model_max_length"] = kwargs.pop("max_len")
58
+
59
+ super().__init__(
60
+ unk_token=unk_token,
61
+ sep_token=sep_token,
62
+ pad_token=pad_token,
63
+ cls_token=cls_token,
64
+ mask_token=mask_token,
65
+ **kwargs,
66
+ )
53
67
  self.init_kwargs["model_max_length"] = self.model_max_length
54
68
 
55
69
  @property
56
- def vocab_size(self):
70
+ def vocab_size(self) -> int:
57
71
  return len(self.vocab)
58
72
 
59
73
  @property
60
- def vocab_list(self):
74
+ def vocab_list(self) -> List[str]:
61
75
  return list(self.vocab.keys())
62
76
 
63
- def _tokenize(self, text): # type: ignore[override]
77
+ def get_vocab(self) -> Dict[str, int]:
78
+ return dict(self.vocab, **self.added_tokens_encoder)
79
+
80
+ def _tokenize(self, text: str, **kwargs) -> List[str]: # type: ignore[override]
64
81
  split_tokens = [token for token in self.basic_tokenizer.tokenize(text)]
65
82
  return split_tokens
66
83
 
67
- def _convert_token_to_id(self, token):
84
+ def _convert_token_to_id(self, token: str) -> int:
68
85
  """Converts a token (str/unicode) in an id using the vocab."""
69
86
  return self.vocab.get(token, self.vocab.get(self.unk_token))
70
87
 
71
- def _convert_id_to_token(self, index):
88
+ def _convert_id_to_token(self, index: int) -> str:
72
89
  """Converts an index (integer) in a token (string/unicode) using the vocab."""
73
90
  return self.ids_to_tokens.get(index, self.unk_token)
74
91
 
92
+ def build_inputs_with_special_tokens(
93
+ self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None
94
+ ) -> List[int]:
95
+ if token_ids_1 is None:
96
+ return [self.cls_token_id] + token_ids_0 + [self.sep_token_id]
97
+ cls = [self.cls_token_id]
98
+ sep = [self.sep_token_id]
99
+ return cls + token_ids_0 + sep + token_ids_1 + sep
100
+
101
+ def get_special_tokens_mask(
102
+ self,
103
+ token_ids_0: List[int],
104
+ token_ids_1: Optional[List[int]] = None,
105
+ already_has_special_tokens: bool = False,
106
+ ) -> List[int]:
107
+ if already_has_special_tokens:
108
+ return super().get_special_tokens_mask(
109
+ token_ids_0=token_ids_0,
110
+ token_ids_1=token_ids_1,
111
+ already_has_special_tokens=True,
112
+ )
113
+ if token_ids_1 is not None:
114
+ return [1] + ([0] * len(token_ids_0)) + [1] + ([0] * len(token_ids_1)) + [1]
115
+ return [1] + ([0] * len(token_ids_0)) + [1]
116
+
117
+ def create_token_type_ids_from_sequences(
118
+ self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None
119
+ ) -> List[int]:
120
+ sep = [self.sep_token_id]
121
+ cls = [self.cls_token_id]
122
+ if token_ids_1 is None:
123
+ return len(cls + token_ids_0 + sep) * [0]
124
+ return len(cls + token_ids_0 + sep) * [0] + len(token_ids_1 + sep) * [1]
125
+
75
126
  def convert_tokens_to_string(self, tokens):
76
127
  """Converts a sequence of tokens (string) in a single string."""
77
128
  out_string = " ".join(tokens).replace(" ##", "").strip()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rxnmapper
3
- Version: 0.4.2
3
+ Version: 0.5.0
4
4
  Summary: Reaction atom-mapping from transformers
5
5
  Home-page: https://github.com/rxn4chemistry/rxnmapper
6
6
  Author: IBM RXN team
@@ -9,16 +9,14 @@ License: MIT
9
9
  Classifier: Operating System :: OS Independent
10
10
  Classifier: Intended Audience :: Developers
11
11
  Classifier: Intended Audience :: Science/Research
12
- Classifier: License :: OSI Approved :: MIT License
13
12
  Classifier: Programming Language :: Python :: 3
14
- Classifier: Programming Language :: Python :: 3.6
15
- Classifier: Programming Language :: Python :: 3.7
16
- Classifier: Programming Language :: Python :: 3.8
17
- Classifier: Programming Language :: Python :: 3.9
18
13
  Classifier: Programming Language :: Python :: 3.10
19
14
  Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
20
18
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
- Requires-Python: >=3.6
19
+ Requires-Python: >=3.10
22
20
  Description-Content-Type: text/markdown
23
21
  License-File: LICENSE
24
22
  Requires-Dist: pandas>=1.0.3
@@ -38,8 +36,7 @@ Requires-Dist: sphinx==2.2.1; extra == "dev"
38
36
  Requires-Dist: twine==3.1.1; extra == "dev"
39
37
  Requires-Dist: types-setuptools>=62.6.0; extra == "dev"
40
38
  Provides-Extra: rdkit
41
- Requires-Dist: rdkit-pypi>=2021.3.2; python_version < "3.7" and extra == "rdkit"
42
- Requires-Dist: rdkit>=2022.3.4; python_version >= "3.7" and extra == "rdkit"
39
+ Requires-Dist: rdkit>=2022.3.4; extra == "rdkit"
43
40
  Dynamic: license-file
44
41
 
45
42
  # Extraction of organic chemistry grammar from unsupervised learning of chemical reactions
@@ -51,37 +48,27 @@ Enable robust atom mapping on valid reaction SMILES. The atom-mapping informatio
51
48
 
52
49
  ## Installation
53
50
 
54
- ### From pip
55
- ```console
56
- conda create -n rxnmapper python=3.6 -y
57
- conda activate rxnmapper
58
- pip install rxnmapper
51
+ ### Create virtual environment (optional)
52
+
53
+ ```bash
54
+ python3 -m venv .venv
55
+ source .venv/bin/activate
59
56
  ```
60
57
 
61
- ### From github
62
- You can install the package and setup the environment directly from github using:
58
+ ### Install from pip
63
59
 
64
- ```console
65
- git clone https://github.com/rxn4chemistry/rxnmapper.git
66
- cd rxnmapper
67
- conda create -n rxnmapper python=3.6 -y
68
- conda activate rxnmapper
69
- pip install -e .
60
+ ```bash
61
+ pip install "rxnmapper[rdkit]"
70
62
  ```
71
63
 
72
- ### RDkit
64
+ You can leave out `[rdkit]` if RDKit is already available in your Python environment.
73
65
 
74
- In both installation settings above, the `RDKit` dependency is not installed automatically, unless you include the extra when installing: `pip install "rxmapper[rdkit]"`.
75
- It can also be installed via Conda or Pypi:
66
+ ### From source
76
67
 
77
68
  ```bash
78
- # Install RDKit from Conda
79
- conda install -c conda-forge rdkit
80
-
81
- # Install RDKit from Pypi
82
- pip install rdkit
83
- # for Python<3.7
84
- # pip install rdkit-pypi
69
+ git clone https://github.com/rxn4chemistry/rxnmapper.git
70
+ cd rxnmapper
71
+ pip install -e ".[rdkit]"
85
72
  ```
86
73
 
87
74
  ## Usage
@@ -118,10 +105,12 @@ results = list(rxn_mapper.map_reactions_with_info(rxns)) # results as dictionar
118
105
 
119
106
  ### Testing
120
107
 
121
- You can run the examples above with the test suite as well:
108
+ You can run the test suite with:
122
109
 
123
- 1. In your Conda environment: `pip install -e .[dev]`
124
- 2. `pytest tests` from the root
110
+ ```bash
111
+ pip install -e .[dev,rdkit]
112
+ pytest tests
113
+ ```
125
114
 
126
115
  ## Examples
127
116
 
@@ -17,9 +17,4 @@ twine==3.1.1
17
17
  types-setuptools>=62.6.0
18
18
 
19
19
  [rdkit]
20
-
21
- [rdkit:python_version < "3.7"]
22
- rdkit-pypi>=2021.3.2
23
-
24
- [rdkit:python_version >= "3.7"]
25
20
  rdkit>=2022.3.4
@@ -11,20 +11,18 @@ classifiers =
11
11
  Operating System :: OS Independent
12
12
  Intended Audience :: Developers
13
13
  Intended Audience :: Science/Research
14
- License :: OSI Approved :: MIT License
15
14
  Programming Language :: Python :: 3
16
- Programming Language :: Python :: 3.6
17
- Programming Language :: Python :: 3.7
18
- Programming Language :: Python :: 3.8
19
- Programming Language :: Python :: 3.9
20
15
  Programming Language :: Python :: 3.10
21
16
  Programming Language :: Python :: 3.11
17
+ Programming Language :: Python :: 3.12
18
+ Programming Language :: Python :: 3.13
19
+ Programming Language :: Python :: 3.14
22
20
  Topic :: Software Development :: Libraries :: Python Modules
23
21
  url = https://github.com/rxn4chemistry/rxnmapper
24
22
 
25
23
  [options]
26
24
  packages = find:
27
- python_requires = >= 3.6
25
+ python_requires = >= 3.10
28
26
  zip_safe = False
29
27
  include_package_data = True
30
28
  install_requires =
@@ -52,8 +50,7 @@ dev =
52
50
  twine==3.1.1
53
51
  types-setuptools>=62.6.0
54
52
  rdkit =
55
- rdkit-pypi>=2021.3.2 ; python_version<"3.7"
56
- rdkit>=2022.3.4 ; python_version>="3.7"
53
+ rdkit>=2022.3.4
57
54
 
58
55
  [flake8]
59
56
  extend-ignore = E203, E501
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes