Metadata-Version: 2.1
Name: deez-py
Version: 0.1.2
Summary: A Python implementation of a lexical analyzer that provides comprehensive scanning, and lookahead capabilities.
Home-page: https://github.com/ThePrimeagen/ts-rust-zig-deez
License: GNU General Public License v3.0
Keywords: python,deez_py,lexer
Author: Mahmoud Harmouch
Author-email: business@wiseai.dev
Requires-Python: >=3.9,<4.0
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: Other/Proprietary License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.9
Project-URL: Repository, https://github.com/ThePrimeagen/ts-rust-zig-deez
Description-Content-Type: text/x-rst

=========
deez_py
=========

.. image:: https://img.shields.io/badge/License-GPLv3-blue.svg
   :target: https://github.com/ThePrimeagen/ts-rust-zig-deez_py/tree/master/python/LICENSE
   :alt: License

.. image:: https://img.shields.io/pypi/v/deez_py.svg
   :target: https://pypi.org/project/deez_py/
   :alt: pypi version

**deez_py** is a Python implementation of a lexical analyzer that provides comprehensive scanning, and lookahead capabilities.

🛠️ Requirements
---------------

**deez_py** requires Python 3.9 or above.

To install Python 3.9, I recommend using `pyenv`_.

.. code-block:: bash

   # install pyenv
   git clone https://github.com/pyenv/pyenv ~/.pyenv

   # setup pyenv (you should also put these three lines in .bashrc or similar)
   # if you are using zsh
   cat << EOF >> ~/.zshrc
   # pyenv config
   export PATH="${HOME}/.pyenv/bin:${PATH}"
   export PYENV_ROOT="${HOME}/.pyenv"
   eval "$(pyenv init -)"
   EOF

   # or if you using the default bash shell, do this instead:
   cat << EOF >> ~/.bashrc
   # pyenv config
   export PATH="${HOME}/.pyenv/bin:${PATH}"
   export PYENV_ROOT="${HOME}/.pyenv"
   eval "$(pyenv init -)"
   EOF
   # Close and open a new shell session
   # install Python 3.9.10
   pyenv install 3.9.10

   # make it available globally
   pyenv global system 3.9.10


To manage the Python 3.9 virtualenv, I recommend using `poetry`_.

.. code-block:: bash

   # install poetry
   curl -sSL https://install.python-poetry.org | python3 -
   poetry --version
   Poetry version 1.1.13

   # Having the python executable in your PATH, you can use it:
   poetry env use 3.9.10

   # However, you are most likely to get the following issue:
   Creating virtualenv deez_py-dxc671ba-py3.9 in ~/.cache/pypoetry/virtualenvs

   ModuleNotFoundError

   No module named 'virtualenv.seed.via_app_data'

   at <frozen importlib._bootstrap>:973 in _find_and_load_unlocked

   # To resolve it, you need to reinstall virtualenv through pip
   sudo apt remove --purge python3-virtualenv virtualenv
   python3 -m pip install -U virtualenv

   # Now, you can just use the minor Python version in this case:
   poetry env use 3.9.10
   Using virtualenv: ~/.cache/pypoetry/virtualenvs/deez_py-dxc671ba-py3.9


🚨 Installation
---------------

With :code:`pip`:

.. code-block:: console

   python3 -m pip install deez-py


🚸 Usage
--------

.. code-block:: python3

   >>> from deez_py import Lexer
   >>> lex = Lexer('=+(){},;')
   >>> for _ in range(9):
   >>>     print(lex.get_next_token())
   ... 
   Token(type=<TokenType.Equal: '='>, literal='=')
   Token(type=<TokenType.Plus: '+'>, literal='+')
   Token(type=<TokenType.LParen: '('>, literal='(')
   Token(type=<TokenType.RParen: ')'>, literal=')')
   Token(type=<TokenType.LSquirly: '{'>, literal='{')
   Token(type=<TokenType.RSquirly: '}'>, literal='}')
   Token(type=<TokenType.Comma: ','>, literal=',')
   Token(type=<TokenType.Semicolon: ';'>, literal=';')
   Token(type=<TokenType.Eof: 'EOF'>, literal='EOF')

📝 License
----------

This program and the accompanying materials are made available under the terms and conditions of the `GNU GENERAL PUBLIC LICENSE`_.

.. _GNU GENERAL PUBLIC LICENSE: http://www.gnu.org/licenses/
.. _deez_py: https://pypi.org/project/deez_py/
.. _pyenv: https://github.com/pyenv/pyenv
.. _poetry: https://github.com/python-poetry/poetry

