Skip to content

Commit bc2d02c

Browse files
authored
tests: Add data with multiple dois for tests and update pyproject.toml (#16)
1 parent 192dff0 commit bc2d02c

19 files changed

+2026
-1572
lines changed

.github/workflows/main.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ jobs:
2929
tests:
3030
needs: check-branch
3131
strategy:
32+
fail-fast: false
3233
matrix:
3334
python_version:
34-
- "3.8.1"
3535
- "3.9"
3636
- "3.10"
3737
- "3.11"
@@ -63,6 +63,7 @@ jobs:
6363
activate-environment: pymedx
6464
auto-update-conda: true
6565
conda-solver: libmamba
66+
python-version: "${{ matrix.python_version }}"
6667

6768
- name: Install dependencies
6869
run: |
@@ -97,6 +98,7 @@ jobs:
9798
activate-environment: pymedx
9899
auto-update-conda: true
99100
conda-solver: libmamba
101+
python-version: "3.12"
100102

101103
- name: Install dependencies
102104
run: |

.github/workflows/release.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333
activate-environment: pymedx
3434
auto-update-conda: true
3535
conda-solver: libmamba
36+
python-version: "3.12"
3637

3738
- name: Install deps
3839
run: poetry install

conda/dev.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ channels:
33
- nodefaults
44
- conda-forge
55
dependencies:
6-
- python >=3.8.1,<4
6+
- compilers
7+
- python
78
- pip
8-
- poetry
9+
- poetry >=2
910
- nodejs # used by semantic-release
1011
- shellcheck
1112
- pip:
1213
- paginate
14+
- levenshtein==0.25.1 # pep517

poetry.lock

Lines changed: 1951 additions & 1537 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,39 @@
1-
[tool.poetry]
1+
[project]
22
name = "pymedx"
33
version = "0.5.0" # semantic-release
44
description = "PyMedX is a tool set for handling multimedia files."
55
readme = "docs/index.md"
6-
authors = ["Gijs Wobben <[email protected]>", "Ivan Ogasawara <[email protected]>"]
6+
authors = [
7+
{ name = "Gijs Wobben", email = "[email protected]" },
8+
{ name = "Ivan Ogasawara", email = "[email protected]" },
9+
{ name = "Ever Vino", email = "[email protected]" },
10+
]
711
packages = [
8-
{include = "pymedx", from="src"},
12+
{include = "pymedx", from = "src"},
913
]
1014
license = "MIT"
1115
exclude = [
1216
".git/*",
1317
".env*",
1418
]
19+
requires-python = ">3.9,<4"
20+
dependencies = [
21+
"requests (>=2.20.0)",
22+
"lxml (>=5.1.0)",
23+
]
1524

16-
17-
[tool.poetry.dependencies]
18-
python = ">3.8.1,<4"
19-
requests = ">=2.20.0"
20-
lxml = "^5.1.0"
25+
[build-system]
26+
requires = ["poetry-core>=2", "poetry>=2"]
27+
build-backend = "poetry.core.masonry.api"
2128

2229
[tool.poetry.group.dev.dependencies]
30+
python = ">3.9,<4"
31+
python-dotenv = ">=1.0"
2332
pytest = ">=7.3.2"
2433
pytest-cov = ">=4.1.0"
2534
coverage = ">=7.2.7"
2635
pre-commit = ">=3.3.2"
27-
ruff = ">=0.1.5"
36+
ruff = ">=0.9.5"
2837
mypy = ">=1.6.0"
2938
bandit = ">=1.7.5"
3039
vulture = ">=2.9.1"

src/pymedx/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# mypy: disable-error-code="attr-defined"
22
"""PyMedX package."""
3+
34
from importlib import metadata as importlib_metadata
45

56
from .api import PubMed, PubMedCentral

src/pymedx/api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""API module for PubMed."""
2+
23
from __future__ import annotations
34

45
import datetime

src/pymedx/article.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Module for handling articles."""
2+
23
import datetime
34
import json
45

@@ -13,18 +14,18 @@ class PubMedArticle:
1314
"""Data class that contains a PubMed article."""
1415

1516
__slots__ = (
16-
"pubmed_id",
17-
"title",
1817
"abstract",
19-
"keywords",
20-
"journal",
21-
"publication_date",
2218
"authors",
23-
"methods",
2419
"conclusions",
25-
"results",
2620
"copyrights",
2721
"doi",
22+
"journal",
23+
"keywords",
24+
"methods",
25+
"publication_date",
26+
"pubmed_id",
27+
"results",
28+
"title",
2829
"xml",
2930
)
3031

@@ -197,12 +198,12 @@ class PubMedCentralArticle:
197198

198199
# slots which have been implemented
199200
__slots__ = (
200-
"pmc_id",
201-
"title",
202201
"abstract",
203-
"publication_date",
204202
"authors",
205203
"doi",
204+
"pmc_id",
205+
"publication_date",
206+
"title",
206207
)
207208

208209
def __init__(

src/pymedx/book.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Module for functions about book article."""
2+
23
import datetime
34
import json
45

@@ -13,19 +14,19 @@ class PubMedBookArticle:
1314
"""Data class that contains a PubMed article."""
1415

1516
__slots__ = (
16-
"pubmed_id",
17-
"title",
1817
"abstract",
19-
"publication_date",
2018
"authors",
2119
"copyrights",
2220
"doi",
2321
"isbn",
2422
"language",
23+
"publication_date",
2524
"publication_type",
26-
"sections",
2725
"publisher",
2826
"publisher_location",
27+
"pubmed_id",
28+
"sections",
29+
"title",
2930
)
3031

3132
def __init__(

src/pymedx/helpers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Module for helper functions."""
2+
23
from __future__ import annotations
34

45
import datetime
@@ -127,8 +128,7 @@ def get_range_months(
127128
current_end_date = next_month - datetime.timedelta(days=next_month.day)
128129

129130
# Adjust the end date if it goes beyond the specified end_date
130-
if current_end_date > end_date:
131-
current_end_date = end_date
131+
current_end_date = min(current_end_date, end_date)
132132

133133
date_ranges.append((current_start_date, current_end_date))
134134

0 commit comments

Comments
 (0)