Skip to content

Commit

Permalink
Make antlr optional (#423)
Browse files Browse the repository at this point in the history
* make antlr4 optional

* mark optional import with pytest

* add optional entry

* add py312

* add new locks

---------

Co-authored-by: Martin Yeo <[email protected]>
  • Loading branch information
ocefpaf and trexfeathers authored Sep 26, 2024
1 parent d758886 commit d22c5ea
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 2 deletions.
3 changes: 3 additions & 0 deletions cf_units/tests/integration/parse/test_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
#
# This file is part of cf-units and is released under the BSD license.
# See LICENSE in the root of the repository for full licensing details.
import pytest

antlr4 = pytest.importorskip("antlr4")

import cf_units._udunits2_parser.graph as g
from cf_units._udunits2_parser import parse
Expand Down
3 changes: 3 additions & 0 deletions cf_units/tests/integration/parse/test_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
#
# This file is part of cf-units and is released under the BSD license.
# See LICENSE in the root of the repository for full licensing details.
import pytest

antlr4 = pytest.importorskip("antlr4")

import re

Expand Down
3 changes: 3 additions & 0 deletions cf_units/tests/test_tex.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
#
# This file is part of cf-units and is released under the BSD license.
# See LICENSE in the root of the repository for full licensing details.
import pytest

antlr4 = pytest.importorskip("antlr4")

from cf_units.tex import tex

Expand Down
3 changes: 2 additions & 1 deletion requirements/cf-units.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ dependencies:
- numpy

# core dependencies
- antlr-python-runtime 4.11.1.* # To update this, see cf_units/_udunits2_parser/README.md
- cftime>=1.2
- numpy<2
- udunits2
Expand All @@ -28,3 +27,5 @@ dependencies:

# docs dependencies
- sphinx
# latex
- antlr-python-runtime 4.11.1.* # To update this, see cf_units/_udunits2_parser/README.md
4 changes: 3 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ version = attr: cf_units.__version__
[options]
include_package_data = True
install_requires =
antlr4-python3-runtime ==4.11.1 # To update this, see cf_units/_udunits2_parser/README.md
cftime >=1.2
jinja2
numpy ==1.26.4
Expand All @@ -47,6 +46,8 @@ python_requires =
zip_safe = False

[options.extras_require]
latex =
antlr4-python3-runtime ==4.11.1 # To update this, see cf_units/_udunits2_parser/README.md
docs =
sphinx
test =
Expand All @@ -58,6 +59,7 @@ test =
pytest-cov
all =
pre-commit
%(latex)s
%(docs)s
%(test)s

Expand Down

0 comments on commit d22c5ea

Please sign in to comment.