threepp
C++20 기반 크로스플랫폼 3D 라이브러리, 파이썬 바인딩 및 three.js 수준 API 제공
경량형이며 선택적 타입을 지원하는 표현식 언어로, 임의의 Python 객체 매칭을 위한 맞춤 문법을 제공합니다
A lightweight, optionally typed expression language with a custom grammar for matching arbitrary Python objects.
개발 도구PythonGitHub @zeroSteiner직접 설치운영자 미확인
써 보셨어요? 한 번만 눌러 주세요. 로그인은 필요 없어요.
메이커가 쓴 소개는 위의 한 줄이 전부입니다. 더 자세한 내용은 저장소 README에서 읽을 수 있습니다. 저장소 README ↗
README 전체를 불러오는 중입니다.
README 전문 보기 ↗|badge-build| |badge-pypi|
A lightweight, optionally typed expression language with a custom grammar for matching arbitrary Python objects.
Documentation is available at https://zeroSteiner.github.io/rule-engine/.
:Warning: Version 6.0 will remove support for Python version 3.10. There is currently no timeline for its release.
:Warning:
Version 5.0 removes support for Python versions 3.6, 3.7, 3.8, and 3.9 and deprecates attribute-style access on
MAPPING values (use bracket syntax mapping["key"] instead). See the Change Log_ for details.
Rule Engine expressions are written in their own language, defined as strings in Python. The syntax is most similar to Python with some inspiration from Ruby. Some features of this language includes:
The following example demonstrates the basic usage of defining a rule object and applying it to two dictionaries,
showing that one matches while the other does not. See Getting Started_ for more information.
.. code-block:: python
import rule_engine
rule = rule_engine.Rule( 'first_name == "Luke" and email =~ ".*@rebels.org$"' ) # => rule.matches({ 'first_name': 'Luke', 'last_name': 'Skywalker', 'email': '[email protected]' }) # => True rule.matches({ 'first_name': 'Darth', 'last_name': 'Vader', 'email': '[email protected]' }) # => False
The next example demonstrates the optional type system. A custom context is created that defines two symbols, one string
and one float. Because symbols are defined, an exception will be raised if an unknown symbol is specified or an invalid
operation is used. See Type Hinting_ for more information.
.. code-block:: python
import rule_engine
context = rule_engine.Context(type_resolver=rule_engine.type_resolver_from_dict({ 'first_name': rule_engine.DataType.STRING, 'age': rule_engine.DataType.FLOAT }))
rule = rule_engine.Rule('last_name == "Vader"', context=context)
rule = rule_engine.Rule('first_name + 1', context=context)
Want to give the rule expression language a try? Checkout the Debug REPL_ that makes experimentation easy. After
installing just run python -m rule_engine.debug_repl.
Install the latest release from PyPi using pip install rule-engine. Releases follow Semantic Versioning_ to
indicate in each new version whether it fixes bugs, adds features or breaks backwards compatibility. See the
Change Log_ for a curated list of changes.
The Rule Engine library is released under the BSD 3-Clause license. It is able to be used for both commercial and
private purposes. For more information, see the LICENSE_ file.
.. |badge-build| image:: https://img.shields.io/github/actions/workflow/status/zeroSteiner/rule-engine/ci.yml?branch=master&style=flat-square :alt: GitHub Workflow Status (branch) :target: https://github.com/zeroSteiner/rule-engine/actions/workflows/ci.yml
.. |badge-pypi| image:: https://img.shields.io/pypi/v/rule-engine?style=flat-square :alt: PyPI :target: https://pypi.org/project/rule-engine/
.. |social-github| image:: https://img.shields.io/github/followers/zeroSteiner?style=social :alt: GitHub followers :target: https://github.com/zeroSteiner
.. |social-twitter| image:: https://img.shields.io/twitter/follow/zeroSteiner :alt: Twitter Follow :target: https://twitter.com/zeroSteiner
.. _Change Log: https://zerosteiner.github.io/rule-engine/change_log.html .. _Debug REPL: https://zerosteiner.github.io/rule-engine/debug_repl.html .. _Getting Started: https://zerosteiner.github.io/rule-engine/getting_started.html .. _LICENSE: https://github.com/zeroSteiner/rule-engine/blob/master/LICENSE .. _Semantic Versioning: https://semver.org/ .. _Type Hinting: https://zerosteiner.github.io/rule-engine/getting_started.html#type-hinting