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 @@ -145,3 +145,5 @@
04-May-2025 - V1.32 Add methods and support for IHM structure loading
12-Jun-2025 - V1.33 Add transformation to populate rcsb_entry_container_identifiers.pubmed_id and rcsb_polymer_entity_container_identifiers.uniprot_ids
27-Jun-2025 - V1.34 Add transformation to populate rcsb_polymer_instance_info
4-Nov-2025 - V1.35 Strip newline characters from 'chem_comp.name';
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.

5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,9 @@ git clone --recurse-submodules https://github.com/rcsb/py-rcsb_utils_dictionary.
```

Optionally, run test suite (Python versions 3.7+) using
[setuptools](https://setuptools.readthedocs.io/en/latest/) or
[tox](http://tox.readthedocs.io/en/latest/example/platform.html):

```bash
python setup.py test

or simply run

tox
```

Expand Down
15 changes: 6 additions & 9 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ name: $(BuildDefinitionName)_$(Date:yyyyMMdd)$(Rev:.rr)

trigger:
- master
- utilsdict-*

pr:
- master
Expand All @@ -27,20 +26,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: "py310", python: "3.10", os: "macos" }
parameters: { tox: "py313", python: "3.13", os: "macos" }
#
#- template: azure-template-publish-job.yml
# parameters: {tox: "py310", python: "3.10", os: 'macos'}
- template: azure-template-publish-job.yml
parameters: { tox: "py310", python: "3.10", os: "linux" }
parameters: { tox: "py313", python: "3.13", os: "linux" }
#
2 changes: 1 addition & 1 deletion azure-template-publish-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
93 changes: 64 additions & 29 deletions azure-template-tox-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
#
- checkout: self
submodules: true
fetchDepth: 1
#
- ${{ if startsWith(parameters.os, 'macos') }}:
- bash: |
Expand Down Expand Up @@ -66,62 +67,96 @@ jobs:
#
- script: sudo apt-get update
displayName: "update apt"
#- script: sudo apt-get upgrade
# displayName: 'upgrade apt'
#- script: sudo apt-get update
# displayName: 'update apt'
- script: sudo apt-get install flex
displayName: "Install flex"
- script: sudo apt-get install bison
displayName: "Install bison"
#
- ? ${{ if and(contains(parameters.fixtures, 'mysql'), startsWith(parameters.os, 'linux')) }}
: - bash: |
sudo apt-get install libmysqlclient-dev python-mysqldb
sudo apt list --installed | grep -i mysql
displayName: "Install mysql development libraries"
- bash: |
echo "Retarting mysql service"
sudo systemctl restart mysql.service
mysql -V
mysql --user=root --password=root -e "use mysql; select * from user;"
#
echo "Try resetting password"
mysqladmin --user=root --password=root password 'ChangeMeSoon'
#
# mysql -u root -p root -e "SET PASSWORD FOR root@'localhost' = PASSWORD(‘ChangeMeSoon’);"
# mysql -u root -p root -e "FLUSH PRIVILEGES; update mysql.user set password=password('ChangeMeSoon') where user='root'; FLUSH PRIVILEGES;"
# UPDATE mysql.user SET Password=PASSWORD('ChangeMeSoon') WHERE User='root';

echo "Running preliminary mysql setup"
mysql --user=root --password=ChangeMeSoon <<_EOF_
DELETE FROM mysql.user WHERE User='';
DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');
DROP DATABASE IF EXISTS test;
DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%';
FLUSH PRIVILEGES;
_EOF_
ps -ef | grep -i my
mysql --user=root --password=ChangeMeSoon -e "show databases;"
#
displayName: "Start and configure mysql ..."

# -----
- ? ${{ if and(contains(parameters.fixtures, 'mongodb'), startsWith(parameters.os, 'linux')) }}
: # Mongo install
- script: |
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
sudo apt list --installed | grep mongodb
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org
sudo apt list --installed | grep mongo
displayName: "Installing mongodb"
#
- script: |
sudo service mongod start
sudo ss -tulpn
displayName: "Start Mongo service"
#
#
- script: 'python -c "import sys; print(sys.version); print(sys.executable)"'
displayName: show python information
#
- 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'
#
- task: DownloadSecureFile@1
name: oelicense
displayName: "Download OE license file"
inputs:
secureFile: "oe_license.txt"

- ${{ if startsWith(parameters.tox, 'py') }}:
- script: |
export OE_LICENSE=$(oelicense.secureFilePath)
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')) }}
- ? ${{ if and(not(startsWith(parameters.tox, 'py')), startsWith(parameters.python, '3.13')) }}
: - script: |
export OE_LICENSE=$(oelicense.secureFilePath)
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')) }}
: - script: |
export OE_LICENSE=$(oelicense.secureFilePath)
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
88 changes: 88 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "rcsb.utils.dictionary"
description = "RCSB Python Dictionary 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 = [
"scipy",
"numpy",
"mmcif >= 0.91.0",
"rcsb.utils.chemref >= 0.91",
"rcsb.utils.citation >= 0.25",
"rcsb.utils.config >= 0.40",
"rcsb.utils.ec >= 0.25",
"rcsb.utils.io >= 1.52",
"rcsb.utils.multiproc >= 0.19",
"rcsb.utils.repository >= 0.50",
"rcsb.utils.seq >= 0.82",
"rcsb.utils.struct >= 0.47",
"rcsb.utils.targets >= 0.88",
"rcsb.utils.taxonomy >= 0.43",
"rcsb.utils.validation >= 0.31",
"rcsb.utils.insilico3d >= 0.42",
]
dynamic = ["version"]

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

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

# ---------------- hatch configuration ----------------
[tool.hatch.version]
path = "rcsb/utils/dictionary/__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
3 changes: 3 additions & 0 deletions rcsb/utils/dictionary/DictMethodChemRefHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# 18-Sep-2023 dwp Load COD references separately from CCDC/CSD references
# 3-May-2024 dwp Change BIRD citation method to copy categories instead of just renaming, and only apply to BIRD entries
# 25-Jul-2024 dwp Fix assignment logic of Pharos data for rcsb_chem_comp_related.related_mapping_method in addChemCompRelated()
# 4-Nov-2025 dwp Strip newline characters from 'chem_comp.name'
##
"""
Helper class implements external method references supporting chemical
Expand Down Expand Up @@ -901,6 +902,8 @@ def addChemCompSynonyms(self, dataContainer, catName, **kwargs):
ccObj = dataContainer.getObj("chem_comp")
ccId = ccObj.getValue("id", 0)
ccName = ccObj.getValue("name", 0)
if ccName:
ccName = ccName.replace("\n", "") # strip newline characters
# ccSynonymL = []
# if ccObj.hasAttribute("pdbx_synonyms"):
# ccSynonymL = str(ccObj.getValue("pdbx_synonyms", 0)).split(";")
Expand Down
2 changes: 1 addition & 1 deletion rcsb/utils/dictionary/DictMethodCompModelHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ def buildCompModelProvenance(self, dataContainer, catName, **kwargs):
return False

if catName != "rcsb_comp_model_provenance":
logger.warning("input catName (%s) not 'rcsb_comp_model_provenance'")
logger.warning("input catName (%s) not 'rcsb_comp_model_provenance'", catName)

catName = "rcsb_comp_model_provenance"

Expand Down
Loading