From d22c5ea93c89751bf929f48df8d01ea558e17257 Mon Sep 17 00:00:00 2001 From: Filipe Date: Thu, 26 Sep 2024 13:10:44 +0200 Subject: [PATCH] Make antlr optional (#423) * make antlr4 optional * mark optional import with pytest * add optional entry * add py312 * add new locks --------- Co-authored-by: Martin Yeo <40734014+trexfeathers@users.noreply.github.com> --- cf_units/tests/integration/parse/test_graph.py | 3 +++ cf_units/tests/integration/parse/test_parse.py | 3 +++ cf_units/tests/test_tex.py | 3 +++ requirements/cf-units.yml | 3 ++- setup.cfg | 4 +++- 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/cf_units/tests/integration/parse/test_graph.py b/cf_units/tests/integration/parse/test_graph.py index c48de9ad..9743b8a0 100644 --- a/cf_units/tests/integration/parse/test_graph.py +++ b/cf_units/tests/integration/parse/test_graph.py @@ -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 diff --git a/cf_units/tests/integration/parse/test_parse.py b/cf_units/tests/integration/parse/test_parse.py index 5a86371c..b76fadbf 100644 --- a/cf_units/tests/integration/parse/test_parse.py +++ b/cf_units/tests/integration/parse/test_parse.py @@ -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 diff --git a/cf_units/tests/test_tex.py b/cf_units/tests/test_tex.py index ce3977ad..966c887a 100644 --- a/cf_units/tests/test_tex.py +++ b/cf_units/tests/test_tex.py @@ -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 diff --git a/requirements/cf-units.yml b/requirements/cf-units.yml index 69b92a83..79cfcfa0 100644 --- a/requirements/cf-units.yml +++ b/requirements/cf-units.yml @@ -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 @@ -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 diff --git a/setup.cfg b/setup.cfg index 686837b0..deb05e84 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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 @@ -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 = @@ -58,6 +59,7 @@ test = pytest-cov all = pre-commit + %(latex)s %(docs)s %(test)s