Skip to content

Commit 2a0f9c2

Browse files
committed
Merge branch '197_metabref_compat' into 'master'
Modify MetabRef queries to remove reliance on header / token and add workflow for publishing to PyPi Closes #197 and #196 See merge request mass-spectrometry/corems!153
2 parents 56bb00d + 84471f9 commit 2a0f9c2

File tree

12 files changed

+2098
-2012
lines changed

12 files changed

+2098
-2012
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 3.2.1
2+
current_version = 3.3.0
33
commit = False
44
tag = False
55

.github/workflows/pypi_publish.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Publish PyPi Package
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- id: checkout
13+
uses: actions/checkout@v3
14+
15+
- id: python-setup
16+
name: Set up Python
17+
uses: actions/setup-python@v2
18+
with:
19+
python-version: '3.11'
20+
21+
- id: python-dependencies
22+
name: Install dependencies
23+
run: |
24+
python -m pip install --upgrade pip
25+
pip install setuptools wheel twine
26+
27+
- id: publish-pypi
28+
env:
29+
TWINE_USERNAME: __token__
30+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
31+
run: |
32+
make pypi

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ CoreMS aims to provide
4949

5050
## Current Version
5151

52-
`3.2.1`
52+
`3.3.0`
5353

5454
***
5555

@@ -335,11 +335,11 @@ UML (unified modeling language) diagrams for Direct Infusion FT-MS and GC-MS cla
335335
336336
If you use CoreMS in your work, please use the following citation:
337337
338-
Version [3.2.1 Release on GitHub](https://github.com/EMSL-Computing/CoreMS/releases/tag/v3.2.1), archived on Zenodo:
338+
Version [3.3.0 Release on GitHub](https://github.com/EMSL-Computing/CoreMS/releases/tag/v3.3.0), archived on Zenodo:
339339
340340
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.14009575.svg)](https://doi.org/10.5281/zenodo.14009575)
341341
342-
Yuri E. Corilo, William R. Kew, Lee Ann McCue, Katherine R . Heal, James C. Carr (2024, October 29). EMSL-Computing/CoreMS: CoreMS 3.2.1 (Version v3.2.1), as developed on Github. Zenodo. http://doi.org/10.5281/zenodo.14009575
342+
Yuri E. Corilo, William R. Kew, Lee Ann McCue, Katherine R . Heal, James C. Carr (2024, October 29). EMSL-Computing/CoreMS: CoreMS 3.3.0 (Version v3.3.0), as developed on Github. Zenodo. http://doi.org/10.5281/zenodo.14009575
343343
344344
```
345345

corems/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__author__ = "Yuri E. Corilo"
2-
__version__ = "3.2.1"
2+
__version__ = "3.3.0"
33
import time
44
import os
55
import sys

corems/molecular_id/search/database_interfaces.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,16 @@ def get_header(self):
9292

9393
return header
9494

95-
def get_query(self, url):
95+
def get_query(self, url, use_header=True):
9696
"""
9797
Request payload from URL according to `get` protocol.
9898
9999
Parameters
100100
----------
101101
url : str
102102
URL for request.
103+
use_header: bool
104+
Whether or not the query should include the header
103105
104106
Returns
105107
-------
@@ -109,7 +111,10 @@ def get_query(self, url):
109111
"""
110112

111113
# Query URL via `get`
112-
response = requests.get(url, headers=self.get_header())
114+
if use_header:
115+
response = requests.get(url, headers=self.get_header())
116+
else:
117+
response = requests.get(url)
113118

114119
# Check response
115120
response.raise_for_status()
@@ -352,6 +357,16 @@ def _dict_to_dataclass(self, metabref_lib, data_class):
352357
if key not in input_dict.keys():
353358
input_dict[key] = None
354359
return data_class(**input_dict)
360+
361+
def get_query(self, url, use_header=False):
362+
"""Overwrites the get_query method on the parent class to default to not use a header
363+
364+
Notes
365+
-----
366+
As of January 2025, the metabref database no longer requires a token and therefore no header is needed
367+
368+
"""
369+
return super().get_query(url, use_header)
355370

356371

357372
class MetabRefGCInterface(MetabRefInterface):

docs/corems.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ <h1 id="corems">CoreMS</h1>
154154

155155
<h2 id="current-version">Current Version</h2>
156156

157-
<p><code>3.2.1</code></p>
157+
<p><code>3.3.0</code></p>
158158

159159
<hr />
160160

@@ -487,11 +487,11 @@ <h2 id="citing-corems">Citing CoreMS</h2>
487487

488488
<p>If you use CoreMS in your work, please use the following citation:</p>
489489

490-
<p>Version <a href="https://github.com/EMSL-Computing/CoreMS/releases/tag/v3.2.1">3.2.1 Release on GitHub</a>, archived on Zenodo: </p>
490+
<p>Version <a href="https://github.com/EMSL-Computing/CoreMS/releases/tag/v3.3.0">3.3.0 Release on GitHub</a>, archived on Zenodo: </p>
491491

492492
<p><a href="https://doi.org/10.5281/zenodo.14009575"><img src="https://zenodo.org/badge/DOI/10.5281/zenodo.14009575.svg" alt="DOI" /></a></p>
493493

494-
<p>Yuri E. Corilo, William R. Kew, Lee Ann McCue, Katherine R . Heal, James C. Carr (2024, October 29). EMSL-Computing/CoreMS: CoreMS 3.2.1 (Version v3.2.1), as developed on Github. Zenodo. <a href="http://doi.org/10.5281/zenodo.14009575">http://doi.org/10.5281/zenodo.14009575</a></p>
494+
<p>Yuri E. Corilo, William R. Kew, Lee Ann McCue, Katherine R . Heal, James C. Carr (2024, October 29). EMSL-Computing/CoreMS: CoreMS 3.3.0 (Version v3.3.0), as developed on Github. Zenodo. <a href="http://doi.org/10.5281/zenodo.14009575">http://doi.org/10.5281/zenodo.14009575</a></p>
495495

496496
<p>```</p>
497497

@@ -527,7 +527,7 @@ <h2 id="citing-corems">Citing CoreMS</h2>
527527
<label class="view-source-button" for="mod-corems-view-source"><span>View Source</span></label>
528528

529529
<div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="n">__author__</span> <span class="o">=</span> <span class="s2">&quot;Yuri E. Corilo&quot;</span>
530-
</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a><span class="n">__version__</span> <span class="o">=</span> <span class="s2">&quot;3.2.1&quot;</span>
530+
</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a><span class="n">__version__</span> <span class="o">=</span> <span class="s2">&quot;3.3.0&quot;</span>
531531
</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">import</span> <span class="nn">time</span>
532532
</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">import</span> <span class="nn">os</span>
533533
</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a><span class="kn">import</span> <span class="nn">sys</span>

0 commit comments

Comments
 (0)