Skip to content

Commit 62b5dce

Browse files
authored
fix issue with articles without ids (#44)
* Fix issue with typer * Fix issue with files without id * Update version
1 parent 03f8728 commit 62b5dce

File tree

5 files changed

+12
-11
lines changed

5 files changed

+12
-11
lines changed

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ dependencies = [
1313
"networkx~=3.0",
1414
"pydantic~=2.10.6",
1515
"requests~=2.32.3",
16-
"typer[all]~=0.9.0",
16+
"typer[all]~=0.16.0",
1717
]
1818
requires-python = ">=3.9"
1919
classifiers = [
@@ -44,7 +44,7 @@ dev = [
4444
]
4545

4646
[project.scripts]
47-
bibx = "bibx.cli:app"
47+
bibx = "bibx.cli:main"
4848

4949
[tool.ruff.lint]
5050
select = [

src/bibx/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"read_wos",
2929
]
3030

31-
__version__ = "0.6.3"
31+
__version__ = "0.7.0"
3232

3333

3434
def query_openalex(

src/bibx/builders/wos.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ def __init__(self, *isi_files: TextIO) -> None:
261261
def build(self) -> Collection:
262262
"""Build a collection of articles from Web of Science (WoS) ISI files."""
263263
articles = self._get_articles_from_files()
264-
return Collection(list(articles))
264+
return Collection(Collection.deduplicate_articles(list(articles)))
265265

266266
def _get_articles_as_str_from_files(self) -> Iterable[str]:
267267
for file in self._files:

src/bibx/cli.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222

2323
@app.callback()
24-
def main(
24+
def set_verbose(
2525
verbose: Annotated[ # noqa: FBT002
2626
bool, typer.Option("--verbose", "-v", help="Enable verbose logging.")
2727
] = False,
@@ -99,14 +99,8 @@ def openalex(
9999
help="how to handle references",
100100
default=EnrichReferences.BASIC,
101101
),
102-
verbose: bool = typer.Option(
103-
help="be more verbose",
104-
default=False,
105-
),
106102
) -> None:
107103
"""Run the sap algorithm on a seed file of any supported format."""
108-
if verbose:
109-
logging.basicConfig(level=logging.INFO)
110104
c = query_openalex(" ".join(query), enrich=enrich)
111105
s = Sap()
112106
graph = s.create_graph(c)
@@ -115,5 +109,10 @@ def openalex(
115109
rprint(graph)
116110

117111

112+
def main() -> None:
113+
"""Entry point for the CLI."""
114+
app()
115+
116+
118117
if __name__ == "__main__":
119118
app()

src/bibx/collection.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ def _uniqe_articles_by_id(cls, articles: list[Article]) -> dict[str, Article]:
4646
graph = nx.Graph()
4747
id_to_article: defaultdict[str, list[Article]] = defaultdict(list)
4848
for article in cls._all_articles(articles):
49+
if not article.ids:
50+
continue
4951
first, *rest = article.ids
5052
# Add a loop edge so that the unique articles are included
5153
graph.add_edge(first, first)

0 commit comments

Comments
 (0)