Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade dependency pyparsing from >=3 to >=3.1.2 #306

Merged
merged 1 commit into from
Dec 14, 2024

Conversation

zzkluck
Copy link
Contributor

@zzkluck zzkluck commented Dec 14, 2024

Recently I reinstalled the foamlib environment, and pip automatically installed foamlib==0.8.1 and pyparsing==3.1.1 for me, after which foamlib crashed. Here are the steps to reproduce this:

> conda create -n pyparsing_version_test python=3.12
> conda activate pyparsing_version_test
> pip install pyparsing==3.1.1
> pip install foamlib
......
Requirement already satisfied: pyparsing<4,>=3 in ~\miniconda3\envs\pyparsing_version_test\lib\site-packages (from foamlib) (3.1.1)
Installing collected packages: numpy, aioshutil, foamlib
Successfully installed aioshutil-1.5 foamlib-0.8.1 numpy-2.2.0
> python
Python 3.12.8 | packaged by Anaconda, Inc. | (main, Dec 11 2024, 16:48:34) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import foamlib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "~\miniconda3\envs\pyparsing_version_test\Lib\site-packages\foamlib\__init__.py", line 5, in <module>
    from ._cases import (
  File "~\miniconda3\envs\pyparsing_version_test\Lib\site-packages\foamlib\_cases\__init__.py", line 1, in <module>
    from ._async import AsyncFoamCase
  File "~\miniconda3\envs\pyparsing_version_test\Lib\site-packages\foamlib\_cases\_async.py", line 27, in <module>
    from ._base import FoamCaseBase
  File "~\miniconda3\envs\pyparsing_version_test\Lib\site-packages\foamlib\_cases\_base.py", line 14, in <module>
    from .._files import FoamFieldFile, FoamFile
  File "~\miniconda3\envs\pyparsing_version_test\Lib\site-packages\foamlib\_files\__init__.py", line 1, in <module>
    from ._files import FoamFieldFile, FoamFile
  File "~\miniconda3\envs\pyparsing_version_test\Lib\site-packages\foamlib\_files\_files.py", line 19, in <module>
    from ._io import FoamFileIO
  File "~\miniconda3\envs\pyparsing_version_test\Lib\site-packages\foamlib\_files\_io.py", line 13, in <module>
    from ._parsing import Parsed
  File "~\miniconda3\envs\pyparsing_version_test\Lib\site-packages\foamlib\_files\_parsing.py", line 264, in <module>
    _Tensor.SCALAR.parser()
  File "~\miniconda3\envs\pyparsing_version_test\Lib\site-packages\foamlib\_files\_parsing.py", line 84, in parser
    return common.ieee_float
           ^^^^^^^^^^^^^^^^^
AttributeError: type object 'pyparsing_common' has no attribute 'ieee_float'

According to pyparsing/pyparsing#545, pyparsing introduced common.ieee_float only after version 3.1.2, so using a lower version of pyparsing would make import foamlib fail.

This PR modifies the pyproject.toml file to upgrade the minimal version of pyparsing.

@gerlero
Copy link
Owner

gerlero commented Dec 14, 2024

@zzkluck Good find and thanks for the fix!

@gerlero gerlero merged commit 29e146b into gerlero:main Dec 14, 2024
39 of 40 checks passed
@zzkluck zzkluck deleted the pyparsing_dependency_upgrade branch December 17, 2024 01:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants