Skip to content

Use a simpler parser than sympy for Dimension #13

@mocquin

Description

@mocquin

Sympy is used in phyispy in many ways, and in order to remove it from physipy's dependencies we would have to build some of its function from scratch.
The main topic of this issue is to remove the use of sympy.parsing.sympy_parser.parse_expr here : https://github.com/mocquin/physipy/blob/4bb31129750070f61e89e803e42a392f251b445b/physipy/quantity/dimension.py#L73C14-L73C24
used to parse string expression of dimension into dict :

>>> parse_str_to_dic("L**2/M")
 {'L': 2, 'M': -1}

In this context, the package 'simparser' was developped, as a candidate to replace this function :

https://github.com/mocquin/simparser/tree/master

It seems to be faster than sympy to convert the string to dict, and probably is imported faster as well. The main argument against the use of this package to replace just that sympy function is that is add a bit of complexity to the physipy package (more code and tests to maintain) just for one function, so for now I'll just keep using sympy.

Eventually, it'd be great to remove sympy from the dependencies. Having an alternative for sympy.parsing.sympy_parser.parse_expr is part of the requirements to do so.

Metadata

Metadata

Assignees

No one assigned

    Labels

    sympyRelated to sympy

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions