Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
558a1b2
Initial plan
Copilot Aug 25, 2026
e07a8fd
Add ChEBI web service converter
Copilot Aug 25, 2026
5b2da6a
Use CHEBI:60888 as test entity in test_ChEBI.py
Copilot Aug 25, 2026
5326dab
Fix ChEBI API endpoints and add name search test for 'bapta'
Copilot Aug 25, 2026
5abfa37
Fix ChEBI accession field mapping
Copilot Aug 25, 2026
d53ed44
Fix ChEBI response parsing for current API
Copilot Aug 25, 2026
1ce8cde
Handle falsy ChEBI field values safely
Copilot Aug 25, 2026
493730f
Fix failing ChEBI tests: update INCHIKEY to match current ChEBI API d…
Copilot Aug 25, 2026
a6d074c
Also URL-encode query parameters in ChEBI search methods
Copilot Aug 25, 2026
7e2bb0b
Add INCHI/IUPAC name constants and iupac_name support to ChEBI conver…
Copilot Aug 25, 2026
67be3d8
Fix ChEBI from_chebiid to supplement entity endpoint with es_search f…
Copilot Aug 26, 2026
e1d7674
Only call es_search fallback in from_chebiid when iupac_name is missing
Copilot Aug 26, 2026
6aca29c
Fix ChEBI iupac_name extraction: use names dict from entity endpoint,…
Copilot Aug 26, 2026
4983295
Skip falsy list elements in _get_first_value
Copilot Aug 26, 2026
47ac1bf
Use structure_search endpoint with similarity threshold=1 for SMILES …
Copilot Aug 26, 2026
58b6b6c
Fix ChEBI structure_search API: use similarity parameter instead of t…
Copilot Aug 26, 2026
c1a6235
Merge branch 'main' into copilot/add-new-chebi-service
hechth Oct 20, 2026
1118126
Merge branch 'main' into copilot/add-new-chebi-service
hechth Oct 29, 2026
106b5f1
added more tests for chebi
hechth Oct 29, 2026
87a5336
changed build system to uv
hechth Nov 6, 2026
f3b6344
extended cas number testing and added curation functionality
hechth Nov 6, 2026
5d8b0b3
add user agent to requests
mbodova Nov 8, 2026
5130330
add test for run monitor
mbodova Nov 9, 2026
d918f97
change test logging
mbodova Nov 9, 2026
72508e9
change test data
mbodova Nov 9, 2026
9c84d81
remove xfail
mbodova Nov 9, 2026
494d29f
change astral uv version
mbodova Nov 9, 2026
1aeae50
remove redundant import
mbodova Nov 9, 2026
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
7 changes: 7 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[flake8]
# uv creates the virtual environment inside the repository, so a bare `flake8 .`
# would otherwise descend into the installed dependencies and report their issues.
extend-exclude =
.venv
build
dist
11 changes: 8 additions & 3 deletions .github/workflows/publish_pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Build and publish to pypi
uses: JRubics/poetry-publish@v2.1
- name: Install uv
uses: astral-sh/setup-uv@v10.3.3
- name: Build sdist and wheel
run: |
uv build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
pypi_token: ${{ secrets.PYPI_API_TOKEN }}
password: ${{ secrets.PYPI_API_TOKEN }}
17 changes: 8 additions & 9 deletions .github/workflows/test-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,22 @@ jobs:

steps:
- uses: actions/checkout@v6
- name: Set up Python 3.12
uses: actions/setup-python@v6
- name: Install uv
uses: astral-sh/setup-uv@v10.3.3
with:
python-version: 3.12
python-version: "3.12"
- name: Install dependencies
run: |
pip install poetry
poetry install --with=dev
uv sync --frozen
- name: Lint with ruff
run: |
poetry run ruff check . --fix --exit-non-zero-on-fix
uv run ruff check . --fix --exit-non-zero-on-fix
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
uv run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
uv run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
poetry run pytest --cov --cov-report term --cov-report xml --junitxml=xunit-result.xml
uv run pytest --cov --cov-report term --cov-report xml --junitxml=xunit-result.xml
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@ MSMetaEnhancer_*.log
dist
MSMetaEnhancer.egg-info
.vscode
poetry.lock
.venv
# copied into the docs source tree by docs/source/conf.py at build time
docs/source/readme.md
docs/source/CHANGELOG.md
docs/source/CONTRIBUTING.md
docs/build
20 changes: 9 additions & 11 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,15 @@ build:
os: ubuntu-22.04
tools:
python: "3.12"
jobs:
post_create_environment:
# Install poetry
# https://python-poetry.org/docs/#installing-manually
- pip install poetry
post_install:
# Install dependencies with 'docs' dependency group
# https://python-poetry.org/docs/managing-dependencies/#dependency-groups
# VIRTUAL_ENV needs to be set manually for now.
# See https://github.com/readthedocs/readthedocs.org/pull/11152/
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install --with docs

# Install the project and the 'docs' dependency group with uv.
# https://docs.readthedocs.com/platform/stable/config-file/v2.html#python-install
python:
install:
- method: uv
command: sync
groups:
- docs

# Build documentation in the docs/ directory with Sphinx
sphinx:
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

### Added
- Added a `ChEBI` web converter querying the ChEBI service (https://www.ebi.ac.uk/chebi/)
- Supports `compound_name`, `iupac_name`, `inchikey`, `inchi`, `smiles`, and `chebiid` as source attributes and returns `chebiid`, `compound_name`, `iupac_name`, `inchikey`, `inchi`, `smiles`, and `formula`
- Structure search from SMILES uses the ChEBI `structure_search` endpoint with `type=similarity` and a similarity threshold of 1
- Declared `pytest-asyncio` explicitly instead of relying on it arriving transitively, and moved `myst-parser` from the `dev` to the `docs` group so the documentation dependencies are self-contained

### Changed
- Project management moved from Poetry to [uv](https://docs.astral.sh/uv/): metadata converted to PEP 621, `uv_build` is the build backend, and `uv` now handles virtual environments, tests, linting, the docs build, and the package build
- `uv.lock` is committed and used as the source of truth; CI installs with `uv sync --frozen`, so a dependency change without a refreshed lock now fails instead of silently re-resolving
- Read the Docs installs with uv natively, which removes the `pip install poetry` step and its `VIRTUAL_ENV` workaround
- PyPI publishing builds with `uv build` and uploads with `pypa/gh-action-pypi-publish` in place of `JRubics/poetry-publish`
- `docs/source/conf.py` resolves its paths relative to itself rather than to the working directory, so the documentation also builds from the repository root

### Fixed
- Normalize unhyphenated CAS numbers in the `Wikidata` converter before querying: Wikidata stores `P231` hyphenated only, so a source `casno` such as `50782` previously matched nothing. `fix_cas_number` moved to `libs.utils.Generic` and now leaves values that cannot be CAS numbers untouched instead of inserting dashes into them

## [0.6.1] - 2026-10-22

### Added
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ In case you feel like you've made a valuable contribution, but you don't know ho
1. (**important**) announce your plan to the rest of the community *before you start working*. This announcement should be in the form of a (new) issue;
1. (**important**) wait until some kind of consensus is reached about your idea being a good idea;
1. if needed, fork the repository to your own Github profile and create your own feature branch off of the latest master commit. While working on your feature branch, make sure to stay up to date with the main branch by pulling in changes, possibly from the 'upstream' repository (follow the instructions [here](https://help.github.com/articles/configuring-a-remote-for-a-fork/) and [here](https://help.github.com/articles/syncing-a-fork/));
1. make sure the existing tests still work by running ``pytest``;
1. make sure the existing tests still work by running ``uv run pytest`` (see the [setup instructions](README.md#developer-documentation));
1. add your own tests (if necessary);
1. update or expand the documentation;
1. update the [CHANGELOG](CHANGELOG.md) file with change;
Expand Down Expand Up @@ -259,12 +259,12 @@ After implementing your converter:

1. Run the existing tests to ensure you haven't broken anything:
```bash
pytest tests/
uv run pytest tests/
```

2. Run your specific tests:
```bash
pytest tests/test_YourService.py -v
uv run pytest tests/test_YourService.py -v
```

3. Test the integration by using the converter in a real scenario
Expand Down
6 changes: 2 additions & 4 deletions MSMetaEnhancer/libs/Curator.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
is_valid_inchikey,
)
from MSMetaEnhancer.libs.utils.Errors import InvalidAttributeFormat
from MSMetaEnhancer.libs.utils.Generic import fix_cas_number as add_cas_dashes


# Example usage
Expand Down Expand Up @@ -55,10 +56,7 @@ def fix_cas_number(cas_number):
:param cas_number: given CAS number
:return: CAS number enriched by dashes (if needed)
"""
if isinstance(cas_number, str):
if "-" not in cas_number:
return f"{cas_number[:-3]}-{cas_number[-3:-1]}-{cas_number[-1]}"
return cas_number
return add_cas_dashes(cas_number)

@staticmethod
def filter_invalid_metadata(metadata, log, job):
Expand Down
Loading
Loading