Skip to content

Commit

Permalink
#185 remove bibtexparser from required deps, make v2 optional dep min…
Browse files Browse the repository at this point in the history
…imum, skip fixing bibtex if vers not > 2 just in case
  • Loading branch information
sckott committed Nov 25, 2024
1 parent 2884a72 commit de2c185
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 26 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Stable version
pip (or pip3) install habanero
If you need to fix bibtex format citations using content negotiation use
If you would like to fix bibtex format citations using content negotiation you'll have to install the optional dependency bibtexparser >= 2.0.0b7 (done for you with optional `[bibtex]`)

.. code-block:: console
Expand Down
2 changes: 1 addition & 1 deletion habanero/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"""

__title__ = "habanero"
__version__ = "1.2.7.91"
__version__ = "2.0.0"
__author__ = "Scott Chamberlain"
__license__ = "MIT"

Expand Down
12 changes: 1 addition & 11 deletions habanero/cnrequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,22 +69,12 @@ def make_request(url, ids, format, style, locale, fail, **kwargs):
warnings.warn(mssg)
return None

# set encoding
r.encoding = "UTF-8"
text = r.text
if format == "bibtex":
if not _has_bibtexparser:
raise ImportError("bibtexparser is required to do this")

if format == "bibtex" and _has_bibtexparser:
bibtexparser_ver = Version(bibtexparser.__version__)
if bibtexparser_ver.major >= 2:
text = fix_bibtex(text)
# if bibtexparser_ver.major < 2:
# warnings.warn(
# "your bibtexparser version is < v2 - skipping bibtexparser cleaning"
# )
# else:
# text = fix_bibtex(text)
return text


Expand Down
6 changes: 1 addition & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ readme = "README.rst"
license = {file = "LICENSE.md"}
requires-python = ">=3.12"
dependencies = [
"bibtexparser==2.0.0b7",
"httpx>=0.27.2",
"packaging>=24.1",
"pyyaml>=6.0.2",
Expand Down Expand Up @@ -88,10 +87,7 @@ pytest-recording = { git = "https://github.com/kiwicom/pytest-recording", rev =
# from https://github.com/pypa/setuptools/discussions/3627
[project.optional-dependencies]
bibtex = [
"bibtexparser==2.0.0b7",
]
test = [
"pytest",
"bibtexparser>=2.0.0b7",
]

[tool.setuptools.packages.find]
Expand Down
10 changes: 2 additions & 8 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit de2c185

Please sign in to comment.