Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions HISTORY.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,5 @@
29-Oct-2024 - V0.94 Add patch for ATC data processing to handle stringified arrays;
Update CI/CD (to use python 3.10)
15-Jul-2025 - V0.95 Update base ChEMBL version to 35
4-Nov-2025 - V0.96 Strip newline characters from 'chem_comp.*' data item values;
Switch to 'pyproject.toml' file and hatch build system, and update pipelines to Python 3.13
7 changes: 0 additions & 7 deletions MANIFEST.in

This file was deleted.

7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,10 @@ git clone --recurse-submodules https://github.com/rcsb/py-rcsb_utils_chemref.git

```

Optionally, run test suite (Python versions 2.7, 3.6, and 3.8) using
[setuptools](https://setuptools.readthedocs.io/en/latest/) or
Optionally, run test suite (Python versions > 3.9) using
[tox](http://tox.readthedocs.io/en/latest/example/platform.html):

```bash
python setup.py test

or simply run

tox
```

Expand Down
14 changes: 9 additions & 5 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,18 @@ schedules:

jobs:
- template: azure-template-tox-job.yml
parameters: { tox: "format_pep8", python: "3.10", os: "linux" }
parameters: { tox: "format_pep8", python: "3.13", os: "linux" }
- template: azure-template-tox-job.yml
parameters: { tox: "lint_pylint", python: "3.10", os: "linux" }
parameters: { tox: "lint_pylint", python: "3.13", os: "linux" }
- template: azure-template-tox-job.yml
parameters: { tox: "test_coverage", python: "3.10", os: "linux" }
parameters: { tox: "test_coverage", python: "3.13", os: "linux" }
#
- template: azure-template-tox-job.yml
parameters: { tox: "py310", python: "3.10", os: "linux" }
parameters: { tox: "py313", python: "3.13", os: "linux" }
#
- template: azure-template-tox-job.yml
parameters: { tox: "py313", python: "3.13", os: "macos" }
#
- template: azure-template-publish-job.yml
parameters: { tox: "py310", python: "3.10", os: "linux" }
parameters: { tox: "py313", python: "3.13", os: "linux" }
#
6 changes: 3 additions & 3 deletions azure-template-publish-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
- job: ${{ format('publish_{0}_{1}', parameters.tox, parameters.os) }}
pool:
${{ if eq(parameters.os, 'macos') }}:
vmImage: 'macOS-13'
vmImage: 'macOS-15'
${{ if eq(parameters.os, 'linux') }}:
vmImage: 'ubuntu-22.04'
vmImage: 'ubuntu-latest'
dependsOn:
- ${{ format('build_test_{0}_{1}', parameters.tox, parameters.os) }}
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
Expand All @@ -41,7 +41,7 @@ jobs:
- script: ls -lR $(Pipeline.Workspace)/${{ format('sw_{0}_{1}', parameters.tox, parameters.os) }}
displayName: "Listing of downloaded artifacts"
#
- script: python -m pip install --upgrade pip twine setuptools wheel
- script: python -m pip install --upgrade pip twine wheel hatch
displayName: 'Install packaging tools'
#
- task: DownloadSecureFile@1
Expand Down
42 changes: 23 additions & 19 deletions azure-template-tox-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ jobs:
timeoutInMinutes: 0
pool:
${{ if eq(parameters.os, 'macos') }}:
vmImage: "macOS-13"
vmImage: "macOS-15"
${{ if eq(parameters.os, 'linux') }}:
vmImage: "ubuntu-22.04"
vmImage: "ubuntu-latest"

variables:
- group: py-shared-variables
Expand All @@ -36,12 +36,13 @@ jobs:
#
- checkout: self
submodules: true
fetchDepth: 1
#
- ${{ if startsWith(parameters.os, 'macos') }}:
- bash: |
set -e
ls -la /Applications/Xcode*
sudo xcode-select --switch /Applications/Xcode_14.2.app/Contents/Developer
sudo xcode-select --switch /Applications/Xcode_16.app/Contents/Developer
which g++
c++ --version
displayName: "setup Xcode"
Expand All @@ -58,11 +59,15 @@ jobs:
displayName: "Check bison"
# ----------------------------------------------
- ${{ if startsWith(parameters.os, 'linux') }}:
- script: lsb_release -a
displayName: "Ubuntu kernal version"
- script: which apt
displayName: "Installing OS dependencies"
- script: apt-cache policy | grep http | awk '{print $2 $3}' | sort -u
displayName: "Checking for repos"
#
- script: sudo apt-get update
displayName: "update apt"
- script: sudo apt-get install flex
displayName: "Install flex"
- script: sudo apt-get install bison
Expand Down Expand Up @@ -123,37 +128,36 @@ jobs:
- script: python -m pip install --upgrade pip tox
displayName: "Install tools"
#
- script: pip install -r requirements.txt
- script: pip install .[tests]
displayName: "Install dependencies"
#
# - task: DownloadSecureFile@1
# name: oelicense
# displayName: 'Download OE license file'
# inputs:
# secureFile: 'oe_license.txt'
#
- ${{ if startsWith(parameters.tox, 'py') }}:
- script: |
export CONFIG_SUPPORT_TOKEN_ENV=$(VAR_CONFIG_SUPPORT_TOKEN_ENV)
${{ format('python -m tox -e {0}', parameters.tox) }}
displayName: "Running tox task"
- ? ${{ if and(not(startsWith(parameters.tox, 'py')), startsWith(parameters.python, '3.10')) }}
: - script: |
export CONFIG_SUPPORT_TOKEN_ENV=$(VAR_CONFIG_SUPPORT_TOKEN_ENV)
${{ format('python -m tox -e {0}-py310', parameters.tox) }}
displayName: "Running tox task"
- ? ${{ if and(not(startsWith(parameters.tox, 'py')), startsWith(parameters.python, '3.9')) }}
- ? ${{ if and(not(startsWith(parameters.tox, 'py')), startsWith(parameters.python, '3.13')) }}
: - script: |
export CONFIG_SUPPORT_TOKEN_ENV=$(VAR_CONFIG_SUPPORT_TOKEN_ENV)
${{ format('python -m tox -e {0}-py39', parameters.tox) }}
${{ format('python -m tox -e {0}-py313', parameters.tox) }}
displayName: "Running tox task"
#
# Build artifacts if this is a test target (i.e. labeled as py##)
#
- ${{ if startsWith(parameters.tox, 'py') }}:
- script: pip install --upgrade pip twine setuptools wheel
- script: pip install --upgrade pip build twine hatch
displayName: "Acquire build tools"
- script: python setup.py sdist --dist-dir "$(System.DefaultWorkingDirectory)/dist"
displayName: "Build source dist"
- script: python setup.py bdist_wheel --dist-dir "$(System.DefaultWorkingDirectory)/dist"
displayName: "Build wheel"
#
- script: python setup.py sdist --dist-dir "$(System.DefaultWorkingDirectory)/udist"
displayName: "Build source dist"
- script: python -m build --sdist --wheel --outdir "$(System.DefaultWorkingDirectory)/dist"
displayName: "Build source and wheel distributions"
- script: python -m build --sdist --outdir "$(System.DefaultWorkingDirectory)/udist"
displayName: "Build source distribution to udist"

#
# Check the install artifacts
- script: ls -lR "$(System.DefaultWorkingDirectory)/dist" "$(System.DefaultWorkingDirectory)/udist"
Expand Down
78 changes: 78 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "rcsb.utils.chemref"
description = "RCSB Python Chemical Reference Data Utility Classes"
readme = "README.md"
authors = [
{ name="John Westbrook", email="john.westbrook@rcsb.org" }
]
maintainers = [
{ name="Dennis Piehl", email="dennis.piehl@rcsb.org" }
]
license = "Apache-2.0"
license-files = ["LICENSE"]
requires-python = ">=3.9"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Natural Language :: English",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.13",
]
dependencies = [
"mmcif >= 0.69",
"rcsb.utils.io >= 1.12",
"rcsb.utils.config >= 0.35",
"obonet >= 0.2.5",
"networkx >= 2.4",
"chembl-webresource-client >= 0.10.2",
]
dynamic = ["version"]

[project.optional-dependencies]
tests = ["tox", "pylint", "black>=21.5b1", "flake8", "coverage"]

[project.urls]
Homepage = "https://github.com/rcsb/py-rcsb_utils_chemref"

# ---------------- hatch configuration ----------------
[tool.hatch.version]
path = "rcsb/utils/chemref/__init__.py"

[tool.hatch.build]
exclude = [
"/rcsb/utils/test*/**",
"/rcsb/mock-*/**",
"test*/**"
]

[tool.hatch.build.targets.sdist]
include = [
"/rcsb/**",
"/README.md",
"/LICENSE",
"/HISTORY.txt",
"/pyproject.toml"
]

[tool.hatch.build.targets.wheel]
packages = ["rcsb"]

[tool.hatch.envs.default]
skip-install = true

# ---------------- test configuration ----------------
[tool.hatch.envs.hatch-test]
dependencies = ["tox"]

[tool.hatch.envs.hatch-test.scripts]
run = ["tox"]

# ---------------- UV configuration ----------------
# Add this to prevent uv from automatically creating venvs within individual packages when running 'uv run ...' from within the package directory
[tool.uv]
managed = false
2 changes: 1 addition & 1 deletion rcsb/utils/chemref/ChEMBLProvider.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def getUniChemData(self, inchiKeyList):
14: {
"name": "fdasrs",
"baseUrl": "http://fdasis.nlm.nih.gov/srs/srs.jsp",
"entryUrl": "http://fdasis.nlm.nih.gov/srs/ProxyServlet?mergeData=true&objectHandle=DBMaint&APPLICATION_NAME=fdasrs&actionHandle=default&nextPage=jsp/srs/ResultScreen.jsp&TXTSUPERLISTID=",
"entryUrl": "http://fdasis.nlm.nih.gov/srs/ProxyServlet?mergeData=true&objectHandle=DBMaint&APPLICATION_NAME=fdasrs&actionHandle=default&nextPage=jsp/srs/ResultScreen.jsp&TXTSUPERLISTID=", # noqa: E501 line too long
},
15: {"name": "surechembl", "baseUrl": "https://www.surechembl.org/search/", "entryUrl": "https://www.surechembl.org/chemical/"},
21: {"name": "pubchem_tpharma", "baseUrl": "http://www.thomson-pharma.com/", "entryUrl": "http://pubchem.ncbi.nlm.nih.gov/substance/"},
Expand Down
6 changes: 5 additions & 1 deletion rcsb/utils/chemref/ChemCompProvider.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#
# Updates:
# 7-Jun-2023 aae Include bond count in chem comp data and fix typo
# 4-Nov-2025 dwp Strip newline characters from 'chem_comp.*' data item values (primarily for 'chem_comp.name', but should be safe to apply to other data items)
##
"""
Utilities to provide essential data items for chemical component definitions.
Expand Down Expand Up @@ -244,7 +245,10 @@ def __buildAbridged(self, cL):
cObj = dataContainer.getObj("chem_comp")
ccId = cObj.getValue("id", 0)
for atName in atNameList:
tD[atName] = cObj.getValueOrDefault(atName, 0, defaultValue=None)
atVal = cObj.getValueOrDefault(atName, 0, defaultValue=None)
if atVal:
atVal = atVal.replace("\n", "") # strip newline characters
tD[atName] = atVal
tD["formula_weight"] = float(tD["formula_weight"]) if tD["formula_weight"] and "formula_weight" in tD else None
retD[ccId] = tD
#
Expand Down
2 changes: 1 addition & 1 deletion rcsb/utils/chemref/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
__author__ = "John Westbrook"
__email__ = "john.westbrook@rcsb.org"
__license__ = "Apache 2.0"
__version__ = "0.95"
__version__ = "0.96"
7 changes: 0 additions & 7 deletions requirements.txt

This file was deleted.

7 changes: 0 additions & 7 deletions setup.cfg

This file was deleted.

69 changes: 0 additions & 69 deletions setup.py

This file was deleted.

Loading