From d0dd4435533bf3a751f41924fc47728de3a8a96c Mon Sep 17 00:00:00 2001 From: Bobby <30593201+luciferreeves@users.noreply.github.com> Date: Fri, 2 Sep 2022 19:31:14 -0400 Subject: =?UTF-8?q?Added=20brands=20and=20updated=20readme=20=E2=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.rst | 109 +++++++++++++++++++++++---------- images/cover.png | Bin 0 -> 30720 bytes images/logo_1500px.png | Bin 0 -> 107381 bytes images/logo_500px.png | Bin 0 -> 27748 bytes images/logo_no_text_1500px.png | Bin 0 -> 152434 bytes images/logo_no_text_500px.png | Bin 0 -> 39699 bytes images/logo_no_text_black_1500px.png | Bin 0 -> 152571 bytes images/logo_no_text_black_500px.png | Bin 0 -> 39699 bytes images/logo_no_text_t_1500px.png | Bin 0 -> 115382 bytes images/logo_no_text_t_500px.png | Bin 0 -> 31255 bytes images/logo_no_text_t_black_1500px.png | Bin 0 -> 104661 bytes images/logo_no_text_t_black_500px.png | Bin 0 -> 28410 bytes images/logo_t_1500px.png | Bin 0 -> 80839 bytes images/logo_t_500px.png | Bin 0 -> 21161 bytes images/logo_t_black_1500px.png | Bin 0 -> 73939 bytes images/logo_t_black_500px.png | Bin 0 -> 19427 bytes images/logo_wob_1500px.png | Bin 0 -> 105201 bytes images/logo_wob_500px.png | Bin 0 -> 26378 bytes 18 files changed, 76 insertions(+), 33 deletions(-) create mode 100644 images/cover.png create mode 100644 images/logo_1500px.png create mode 100644 images/logo_500px.png create mode 100644 images/logo_no_text_1500px.png create mode 100644 images/logo_no_text_500px.png create mode 100644 images/logo_no_text_black_1500px.png create mode 100644 images/logo_no_text_black_500px.png create mode 100644 images/logo_no_text_t_1500px.png create mode 100644 images/logo_no_text_t_500px.png create mode 100644 images/logo_no_text_t_black_1500px.png create mode 100644 images/logo_no_text_t_black_500px.png create mode 100644 images/logo_t_1500px.png create mode 100644 images/logo_t_500px.png create mode 100644 images/logo_t_black_1500px.png create mode 100644 images/logo_t_black_500px.png create mode 100644 images/logo_wob_1500px.png create mode 100644 images/logo_wob_500px.png diff --git a/README.rst b/README.rst index d12d970..9804ec0 100644 --- a/README.rst +++ b/README.rst @@ -1,28 +1,22 @@ ======== -Overview +Edify ======== -.. start-badges +.. Cover Image +.. image:: images/cover.png + :alt: Cover Image -.. list-table:: - :stub-columns: 1 +| - * - docs - - |docs| - * - tests - - | |github-actions| |codecov| - * - package - - | |version| |wheel| |supported-versions| |supported-implementations| - | |commits-since| -.. |docs| image:: https://readthedocs.org/projects/edify/badge/?style=flat +.. image:: https://readthedocs.org/projects/edify/badge/?style=flat :target: https://edify.readthedocs.io/ :alt: Documentation Status -.. |github-actions| image:: https://github.com/luciferreeves/edify/actions/workflows/github-actions.yml/badge.svg +.. image:: https://github.com/luciferreeves/edify/actions/workflows/github-actions.yml/badge.svg?branch=main :alt: GitHub Actions Build Status :target: https://github.com/luciferreeves/edify/actions -.. |codecov| image:: https://codecov.io/gh/luciferreeves/edify/branch/main/graphs/badge.svg?branch=main +.. image:: https://codecov.io/gh/luciferreeves/edify/branch/main/graphs/badge.svg?branch=main :alt: Coverage Status :target: https://codecov.io/github/luciferreeves/edify @@ -50,9 +44,9 @@ Overview .. end-badges -Regular Expressions Made Simple +Edify (/ˈɛdɪfaɪ/, "ed-uh-fahy") is a Python library that allows you to easily create regular expressions for matching text in a programmatically-friendly way. It is designed to be used in conjunction with the ``re`` module. -* Free software: Apache Software License 2.0 +It also allows you to verify a string quickly by providing commonly used regex patterns in its extensive set of built-in patterns. To tap into a pattern, simply import the pattern function from the ``edify.library`` module. Installation ============ @@ -66,33 +60,82 @@ You can also install the in-development version with:: pip install https://github.com/luciferreeves/edify/archive/main.zip -Documentation +Why Edify? +=========== + +Regex is a powerful tool, but its syntax is not very intuitive and can be difficult to build, understand, and use. It gets even more difficult when you have to deal with backtracking, look-ahead, and other features that make regex difficult. + +That's where Edify becomes extremely useful. It allows you to create regular expressions in a programmatic way by invoking the ``RegexBuilder`` class, based on the SuperExpressive_ library. The API uses the `fluent builder pattern `_, and is completely immutable. It is built to be discoverable and predictable. + +- Properties and methods describe what they do in plain English. +- Order matters! Quantifiers are specified before the thing they change, just like in English (e.g. ``RegexBuilder().exactly(5).digit()``.) +- If you make a mistake, you'll know how to fix it. Edify will guide you towards a fix if your expression is invalid. +- ``subexpressions`` can be used to create meaningful, reusable components. + +Edify turns those complex and unwieldy regexes that appear in code reviews into something that can be read, understood, and **properly reviewed** by your peers - and maintained by anyone! + + +.. _SuperExpressive: https://github.com/francisrstokes/super-expressive + +Quick Start ============= +To get started make sure you have python 3.7 or later installed and then, install Edify from ``pip``:: -https://edify.readthedocs.io/ + pip install edify +Then go on to import the ``RegexBuilder`` class from the ``edify`` module. -Development -=========== +Using Pre-Built Patterns +------------------------ + +The following example recognises and captures any email like ``email@example.com``. -To run all the tests run:: +.. code-block:: python - tox -Note, to combine the coverage data from all the tox environments run: + from edify.library import email -.. list-table:: - :widths: 10 90 - :stub-columns: 1 + email_addr = "email@example.com" + assert email(email_addr) == True - - - Windows - - :: - set PYTEST_ADDOPTS=--cov-append - tox +Building Regex Example +---------------------- + +The following example recognises and captures the value of a 16-bit hexadecimal number like ``0xC0D3``. + +.. code-block:: python + + + import re + from edify import RegexBuilder + + expr = ( + RegexBuilder() + .start_of_input() + .optional().string("0x") + .capture() + .exactly(4).any_of() + .range("A", "F") + .range("a", "f") + .range("0", "9") + .end() + .end() + .end_of_input() + .to_regex() + ) + + """ + Produces the following regular expression: + re.compile(^(?:0x)?([A-Fa-f0-9]{4})$) + """ + + assert expr.match("0xC0D3") + + +Documentation +============= - - - Other - - :: +Further API documentation is available on `edify.rftd.io `_. - PYTEST_ADDOPTS=--cov-append tox diff --git a/images/cover.png b/images/cover.png new file mode 100644 index 0000000..24c06d9 Binary files /dev/null and b/images/cover.png differ diff --git a/images/logo_1500px.png b/images/logo_1500px.png new file mode 100644 index 0000000..9c7c75b Binary files /dev/null and b/images/logo_1500px.png differ diff --git a/images/logo_500px.png b/images/logo_500px.png new file mode 100644 index 0000000..6f77726 Binary files /dev/null and b/images/logo_500px.png differ diff --git a/images/logo_no_text_1500px.png b/images/logo_no_text_1500px.png new file mode 100644 index 0000000..22804b5 Binary files /dev/null and b/images/logo_no_text_1500px.png differ diff --git a/images/logo_no_text_500px.png b/images/logo_no_text_500px.png new file mode 100644 index 0000000..bbcfc41 Binary files /dev/null and b/images/logo_no_text_500px.png differ diff --git a/images/logo_no_text_black_1500px.png b/images/logo_no_text_black_1500px.png new file mode 100644 index 0000000..18ab859 Binary files /dev/null and b/images/logo_no_text_black_1500px.png differ diff --git a/images/logo_no_text_black_500px.png b/images/logo_no_text_black_500px.png new file mode 100644 index 0000000..9bf361c Binary files /dev/null and b/images/logo_no_text_black_500px.png differ diff --git a/images/logo_no_text_t_1500px.png b/images/logo_no_text_t_1500px.png new file mode 100644 index 0000000..0f476a9 Binary files /dev/null and b/images/logo_no_text_t_1500px.png differ diff --git a/images/logo_no_text_t_500px.png b/images/logo_no_text_t_500px.png new file mode 100644 index 0000000..5c507e7 Binary files /dev/null and b/images/logo_no_text_t_500px.png differ diff --git a/images/logo_no_text_t_black_1500px.png b/images/logo_no_text_t_black_1500px.png new file mode 100644 index 0000000..3371816 Binary files /dev/null and b/images/logo_no_text_t_black_1500px.png differ diff --git a/images/logo_no_text_t_black_500px.png b/images/logo_no_text_t_black_500px.png new file mode 100644 index 0000000..194cd13 Binary files /dev/null and b/images/logo_no_text_t_black_500px.png differ diff --git a/images/logo_t_1500px.png b/images/logo_t_1500px.png new file mode 100644 index 0000000..7e7ebe1 Binary files /dev/null and b/images/logo_t_1500px.png differ diff --git a/images/logo_t_500px.png b/images/logo_t_500px.png new file mode 100644 index 0000000..7a10cb0 Binary files /dev/null and b/images/logo_t_500px.png differ diff --git a/images/logo_t_black_1500px.png b/images/logo_t_black_1500px.png new file mode 100644 index 0000000..abf3dd2 Binary files /dev/null and b/images/logo_t_black_1500px.png differ diff --git a/images/logo_t_black_500px.png b/images/logo_t_black_500px.png new file mode 100644 index 0000000..649b3de Binary files /dev/null and b/images/logo_t_black_500px.png differ diff --git a/images/logo_wob_1500px.png b/images/logo_wob_1500px.png new file mode 100644 index 0000000..acf4848 Binary files /dev/null and b/images/logo_wob_1500px.png differ diff --git a/images/logo_wob_500px.png b/images/logo_wob_500px.png new file mode 100644 index 0000000..76c83c2 Binary files /dev/null and b/images/logo_wob_500px.png differ -- cgit v1.2.3