Skip to content
Merged
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
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencies = [
"networkx~=3.0",
"pydantic~=2.10.6",
"requests~=2.32.3",
"typer[all]~=0.9.0",
"typer[all]~=0.16.0",
]
requires-python = ">=3.9"
classifiers = [
Expand Down Expand Up @@ -44,7 +44,7 @@ dev = [
]

[project.scripts]
bibx = "bibx.cli:app"
bibx = "bibx.cli:main"

[tool.ruff.lint]
select = [
Expand Down
2 changes: 1 addition & 1 deletion src/bibx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"read_wos",
]

__version__ = "0.6.3"
__version__ = "0.7.0"


def query_openalex(
Expand Down
2 changes: 1 addition & 1 deletion src/bibx/builders/wos.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def __init__(self, *isi_files: TextIO) -> None:
def build(self) -> Collection:
"""Build a collection of articles from Web of Science (WoS) ISI files."""
articles = self._get_articles_from_files()
return Collection(list(articles))
return Collection(Collection.deduplicate_articles(list(articles)))

def _get_articles_as_str_from_files(self) -> Iterable[str]:
for file in self._files:
Expand Down
13 changes: 6 additions & 7 deletions src/bibx/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@


@app.callback()
def main(
def set_verbose(
verbose: Annotated[ # noqa: FBT002
bool, typer.Option("--verbose", "-v", help="Enable verbose logging.")
] = False,
Expand Down Expand Up @@ -99,14 +99,8 @@ def openalex(
help="how to handle references",
default=EnrichReferences.BASIC,
),
verbose: bool = typer.Option(
help="be more verbose",
default=False,
),
) -> None:
"""Run the sap algorithm on a seed file of any supported format."""
if verbose:
logging.basicConfig(level=logging.INFO)
c = query_openalex(" ".join(query), enrich=enrich)
s = Sap()
graph = s.create_graph(c)
Expand All @@ -115,5 +109,10 @@ def openalex(
rprint(graph)


def main() -> None:
"""Entry point for the CLI."""
app()


if __name__ == "__main__":
app()
2 changes: 2 additions & 0 deletions src/bibx/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ def _uniqe_articles_by_id(cls, articles: list[Article]) -> dict[str, Article]:
graph = nx.Graph()
id_to_article: defaultdict[str, list[Article]] = defaultdict(list)
for article in cls._all_articles(articles):
if not article.ids:
continue
first, *rest = article.ids
# Add a loop edge so that the unique articles are included
graph.add_edge(first, first)
Expand Down
Loading