asteval


Nameasteval JSON
Version 1.0.5 PyPI version JSON
download
home_pageNone
SummarySafe, minimalistic evaluator of python expression using ast module
upload_time2024-09-30 01:14:03
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseThe MIT License Copyright (c) 2024 Matthew Newville, The University of Chicago Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords ast expression evaluation eval
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ASTEVAL
=======

.. image:: https://github.com/lmfit/asteval/actions/workflows/ubuntu_numpy.yml/badge.svg
   :target: https://github.com/lmfit/asteval/actions/workflows/ubuntu_numpy.yml

.. image:: https://github.com/lmfit/asteval/actions/workflows/ubuntu_nonumpy.yml/badge.svg
   :target: https://github.com/lmfit/asteval/actions/workflows/ubuntu_nonumpy.yml

.. image:: https://github.com/lmfit/asteval/actions/workflows/macos_numpy.yml/badge.svg
   :target: https://github.com/lmfit/asteval/actions/workflows/macos_numpy.yml

.. image:: https://github.com/lmfit/asteval/actions/workflows/windows_numpy.yml/badge.svg
   :target: https://github.com/lmfit/asteval/actions/workflows/windows_numpy.yml

.. image:: https://codecov.io/gh/lmfit/asteval/branch/master/graph/badge.svg
   :target: https://codecov.io/gh/lmfit/asteval

.. image:: https://img.shields.io/pypi/v/asteval.svg
   :target: https://pypi.org/project/asteval

.. image:: https://img.shields.io/pypi/dm/asteval.svg
   :target: https://pypi.org/project/asteval

.. image:: https://img.shields.io/badge/docs-read-brightgreen
   :target: https://lmfit.github.io/asteval/

.. image:: https://zenodo.org/badge/4185/newville/asteval.svg
   :target: https://zenodo.org/badge/latestdoi/4185/newville/asteval


Links
-----

* Documentation: https://lmfit.github.io/asteval/
* PyPI installation: https://pypi.org/project/asteval/
* Development Code: https://github.com/lmfit/asteval
* Issue Tracker: https://github.com/lmfit/asteval/issues

Installation
------------

Use ``pip install asteval`` to install the asteval library.

Asteval requires Python 3.8 or higher.  If installed, many functions and
constants from Numpy will be used by default.

About ASTEVAL
--------------

ASTEVAL is a safe(ish) evaluator of Python expressions and statements,
using Python's ast module.  The idea is to provide a simple, safe, and
robust miniature mathematical language that can handle user input.  The
emphasis here is on mathematical expressions so that many functions from
``numpy`` are imported and used if available.

Many Python language constructs are supported by default, These include
slicing, subscripting, list comprehension, conditionals (if-elif-else
blocks and if expressions), flow control (for loops, while loops, and
try-except-finally blocks). All data are Python objects and built-in data
structures (dictionaries, tuples, lists, Numpy arrays, strings) are fully
supported by default.

Many of the standard built-in Python functions are available, as are all
mathematical functions from the math module.  If the Numpy module is
installed, many of its functions will also be available.  Users can define
and run their own functions within the confines of the limitations of
Asteval.

There are several absences and differences with Python, and Asteval is by
no means an attempt to reproduce Python with its own ast module.  Some of
the most important differences and absences are:

 1. Variable and function symbol names are held in a simple symbol
    table (a single dictionary), giving a flat namespace.
 2. creating classes is not supported.
 3. importing modules is not supported by default - it can be enabled.
 4. function decorators, yield, lambda, exec, and eval are not supported.
 5. files can only be opened in read-only mode.

In addition, accessing many internal methods and classes of objects is
forbidden in order to strengthen Asteval against malicious user code.


Matt Newville <newville@cars.uchicago.edu>
Last Update:  30-June-2024

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "asteval",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "AST, expression evaluation, eval",
    "author": null,
    "author_email": "Matthew Newville <matt.newville@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/b1/ba/31fb900dc07b946450f495d68d0cdeea40d9abda285bff1b9fcea09c08ac/asteval-1.0.5.tar.gz",
    "platform": null,
    "description": "ASTEVAL\n=======\n\n.. image:: https://github.com/lmfit/asteval/actions/workflows/ubuntu_numpy.yml/badge.svg\n   :target: https://github.com/lmfit/asteval/actions/workflows/ubuntu_numpy.yml\n\n.. image:: https://github.com/lmfit/asteval/actions/workflows/ubuntu_nonumpy.yml/badge.svg\n   :target: https://github.com/lmfit/asteval/actions/workflows/ubuntu_nonumpy.yml\n\n.. image:: https://github.com/lmfit/asteval/actions/workflows/macos_numpy.yml/badge.svg\n   :target: https://github.com/lmfit/asteval/actions/workflows/macos_numpy.yml\n\n.. image:: https://github.com/lmfit/asteval/actions/workflows/windows_numpy.yml/badge.svg\n   :target: https://github.com/lmfit/asteval/actions/workflows/windows_numpy.yml\n\n.. image:: https://codecov.io/gh/lmfit/asteval/branch/master/graph/badge.svg\n   :target: https://codecov.io/gh/lmfit/asteval\n\n.. image:: https://img.shields.io/pypi/v/asteval.svg\n   :target: https://pypi.org/project/asteval\n\n.. image:: https://img.shields.io/pypi/dm/asteval.svg\n   :target: https://pypi.org/project/asteval\n\n.. image:: https://img.shields.io/badge/docs-read-brightgreen\n   :target: https://lmfit.github.io/asteval/\n\n.. image:: https://zenodo.org/badge/4185/newville/asteval.svg\n   :target: https://zenodo.org/badge/latestdoi/4185/newville/asteval\n\n\nLinks\n-----\n\n* Documentation: https://lmfit.github.io/asteval/\n* PyPI installation: https://pypi.org/project/asteval/\n* Development Code: https://github.com/lmfit/asteval\n* Issue Tracker: https://github.com/lmfit/asteval/issues\n\nInstallation\n------------\n\nUse ``pip install asteval`` to install the asteval library.\n\nAsteval requires Python 3.8 or higher.  If installed, many functions and\nconstants from Numpy will be used by default.\n\nAbout ASTEVAL\n--------------\n\nASTEVAL is a safe(ish) evaluator of Python expressions and statements,\nusing Python's ast module.  The idea is to provide a simple, safe, and\nrobust miniature mathematical language that can handle user input.  The\nemphasis here is on mathematical expressions so that many functions from\n``numpy`` are imported and used if available.\n\nMany Python language constructs are supported by default, These include\nslicing, subscripting, list comprehension, conditionals (if-elif-else\nblocks and if expressions), flow control (for loops, while loops, and\ntry-except-finally blocks). All data are Python objects and built-in data\nstructures (dictionaries, tuples, lists, Numpy arrays, strings) are fully\nsupported by default.\n\nMany of the standard built-in Python functions are available, as are all\nmathematical functions from the math module.  If the Numpy module is\ninstalled, many of its functions will also be available.  Users can define\nand run their own functions within the confines of the limitations of\nAsteval.\n\nThere are several absences and differences with Python, and Asteval is by\nno means an attempt to reproduce Python with its own ast module.  Some of\nthe most important differences and absences are:\n\n 1. Variable and function symbol names are held in a simple symbol\n    table (a single dictionary), giving a flat namespace.\n 2. creating classes is not supported.\n 3. importing modules is not supported by default - it can be enabled.\n 4. function decorators, yield, lambda, exec, and eval are not supported.\n 5. files can only be opened in read-only mode.\n\nIn addition, accessing many internal methods and classes of objects is\nforbidden in order to strengthen Asteval against malicious user code.\n\n\nMatt Newville <newville@cars.uchicago.edu>\nLast Update:  30-June-2024\n",
    "bugtrack_url": null,
    "license": "The MIT License  Copyright (c) 2024 Matthew Newville, The University of Chicago  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Safe, minimalistic evaluator of python expression using ast module",
    "version": "1.0.5",
    "project_urls": {
        "Documentation": "https://lmfit.github.io/asteval/",
        "Homepage": "https://github.com/lmfit/asteval",
        "Tracker": "https://github.com/lmfit/asteval/issues"
    },
    "split_keywords": [
        "ast",
        " expression evaluation",
        " eval"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0a0d2c6aaab67ac566d76322e87827d707214c5f6ffb5a4fcd456a8633da1788",
                "md5": "cee251558975de2ff547265f19a623fa",
                "sha256": "082b95312578affc8a6d982f7d92b7ac5de05634985c87e7eedd3188d31149fa"
            },
            "downloads": -1,
            "filename": "asteval-1.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cee251558975de2ff547265f19a623fa",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 21803,
            "upload_time": "2024-09-30T01:14:02",
            "upload_time_iso_8601": "2024-09-30T01:14:02.305409Z",
            "url": "https://files.pythonhosted.org/packages/0a/0d/2c6aaab67ac566d76322e87827d707214c5f6ffb5a4fcd456a8633da1788/asteval-1.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b1ba31fb900dc07b946450f495d68d0cdeea40d9abda285bff1b9fcea09c08ac",
                "md5": "96e0ffe85f2cc7d1259a1a83294a953a",
                "sha256": "bac3c8dd6d2b789e959cfec9bb296fb8338eec066feae618c462132701fbc665"
            },
            "downloads": -1,
            "filename": "asteval-1.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "96e0ffe85f2cc7d1259a1a83294a953a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 50826,
            "upload_time": "2024-09-30T01:14:03",
            "upload_time_iso_8601": "2024-09-30T01:14:03.850169Z",
            "url": "https://files.pythonhosted.org/packages/b1/ba/31fb900dc07b946450f495d68d0cdeea40d9abda285bff1b9fcea09c08ac/asteval-1.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-30 01:14:03",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "lmfit",
    "github_project": "asteval",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "asteval"
}
        
Elapsed time: 1.29228s