=========
readonly
=========
.. image:: https://img.shields.io/badge/License-GPLv3-blue.svg
:target: https://github.com/wiseaidev/readonly/blob/main/LICENSE
:alt: License
.. image:: https://img.shields.io/pypi/v/readonly.svg
:target: https://pypi.org/project/readonly/
:alt: pypi version
.. image:: https://img.shields.io/github/repo-size/wiseaidev/readonly
:target: https://github.com/wiseaidev/readonly/
:alt: Repo Size
.. image:: https://circleci.com/gh/wiseaidev/readonly/tree/main.svg?style=svg
:target: https://circleci.com/gh/wiseaidev/readonly/tree/main
:alt: Circle ci Build Status
**readonly** is a simple package to make any given module attributes into read only mode.
🛠️ Requirements
---------------
**readonly** 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 readonly-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/readonly-dxc671ba-py3.9
🚨 Installation
---------------
With :code:`pip`:
.. code-block:: console
python3.9 -m pip install readonly
🚸 Usage
--------
.. code-block:: python3
>>> from readonly import readonly
>>> import math
>>> math = readonly(math)
# raises AttributeError
>>> math.pi = 3.0
🎉 Credits
----------
The following projects were used to build and test :code:`readonly`.
- `python`_
- `poetry`_
- `pytest`_
- `flake8`_
- `coverage`_
- `rstcheck`_
- `mypy`_
- `pytestcov`_
- `tox`_
- `isort`_
- `black`_
- `precommit`_
👋 Contribute
-------------
If you are looking for a way to contribute to the project, please refer to the `Guideline`_.
📝 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/
.. _readonly: https://pypi.org/project/readonly/
.. _Marco Sulla: https://github.com/Marco-Sulla
.. _Guideline: https://github.com/wiseaidev/readonly/blob/main/CONTRIBUTING.rst
.. _pyenv: https://github.com/pyenv/pyenv
.. _poetry: https://github.com/python-poetry/poetry
.. _pipx: https://github.com/pypa/pipx
.. _python: https://www.python.org/
.. _pytest: https://docs.pytest.org/en/7.1.x/
.. _flake8: https://flake8.pycqa.org/en/latest/
.. _coverage: https://coverage.readthedocs.io/en/6.3.2/
.. _rstcheck: https://pypi.org/project/rstcheck/
.. _mypy: https://mypy.readthedocs.io/en/stable/
.. _pytestcov: https://pytest-cov.readthedocs.io/en/latest/
.. _tox: https://tox.wiki/en/latest/
.. _isort: https://github.com/PyCQA/isort
.. _black: https://black.readthedocs.io/en/stable/
.. _precommit: https://pre-commit.com/
Raw data
{
"_id": null,
"home_page": "https://github.com/wiseaidev/readonly",
"name": "readonly",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9,<4.0",
"maintainer_email": "",
"keywords": "python,readonly",
"author": "Mahmoud Harmouch",
"author_email": "business@wiseai.dev",
"download_url": "https://files.pythonhosted.org/packages/02/92/4ec1230d43fe7f93ef6dc00e5ecf33013e47875fa24fb4000de81b00c358/readonly-0.1.2.tar.gz",
"platform": null,
"description": "=========\nreadonly\n=========\n\n.. image:: https://img.shields.io/badge/License-GPLv3-blue.svg\n :target: https://github.com/wiseaidev/readonly/blob/main/LICENSE\n :alt: License\n\n.. image:: https://img.shields.io/pypi/v/readonly.svg\n :target: https://pypi.org/project/readonly/\n :alt: pypi version\n\n.. image:: https://img.shields.io/github/repo-size/wiseaidev/readonly\n :target: https://github.com/wiseaidev/readonly/\n :alt: Repo Size\n\n.. image:: https://circleci.com/gh/wiseaidev/readonly/tree/main.svg?style=svg\n :target: https://circleci.com/gh/wiseaidev/readonly/tree/main\n :alt: Circle ci Build Status\n\n**readonly** is a simple package to make any given module attributes into read only mode. \n\n\ud83d\udee0\ufe0f Requirements\n---------------\n\n**readonly** requires Python 3.9 or above.\n\nTo install Python 3.9, I recommend using `pyenv`_.\n\n.. code-block:: bash\n\n # install pyenv\n git clone https://github.com/pyenv/pyenv ~/.pyenv\n\n # setup pyenv (you should also put these three lines in .bashrc or similar)\n # if you are using zsh\n cat << EOF >> ~/.zshrc\n # pyenv config\n export PATH=\"${HOME}/.pyenv/bin:${PATH}\"\n export PYENV_ROOT=\"${HOME}/.pyenv\"\n eval \"$(pyenv init -)\"\n EOF\n\n # or if you using the default bash shell, do this instead:\n cat << EOF >> ~/.bashrc\n # pyenv config\n export PATH=\"${HOME}/.pyenv/bin:${PATH}\"\n export PYENV_ROOT=\"${HOME}/.pyenv\"\n eval \"$(pyenv init -)\"\n EOF\n # Close and open a new shell session\n # install Python 3.9.10\n pyenv install 3.9.10\n\n # make it available globally\n pyenv global system 3.9.10\n\n\nTo manage the Python 3.9 virtualenv, I recommend using `poetry`_.\n\n.. code-block:: bash\n\n # install poetry\n curl -sSL https://install.python-poetry.org | python3 -\n poetry --version\n Poetry version 1.1.13\n\n # Having the python executable in your PATH, you can use it:\n poetry env use 3.9.10\n\n # However, you are most likely to get the following issue:\n Creating virtualenv readonly-dxc671ba-py3.9 in ~/.cache/pypoetry/virtualenvs\n\n ModuleNotFoundError\n\n No module named 'virtualenv.seed.via_app_data'\n\n at <frozen importlib._bootstrap>:973 in _find_and_load_unlocked\n\n # To resolve it, you need to reinstall virtualenv through pip\n sudo apt remove --purge python3-virtualenv virtualenv\n python3 -m pip install -U virtualenv\n\n # Now, you can just use the minor Python version in this case:\n poetry env use 3.9.10\n Using virtualenv: ~/.cache/pypoetry/virtualenvs/readonly-dxc671ba-py3.9\n\n\n\ud83d\udea8 Installation\n---------------\n\nWith :code:`pip`:\n\n.. code-block:: console\n\n python3.9 -m pip install readonly\n\n\n\ud83d\udeb8 Usage\n--------\n\n.. code-block:: python3\n\n >>> from readonly import readonly\n >>> import math\n >>> math = readonly(math)\n\n # raises AttributeError\n >>> math.pi = 3.0\n\n\ud83c\udf89 Credits\n----------\n\nThe following projects were used to build and test :code:`readonly`.\n\n- `python`_\n- `poetry`_\n- `pytest`_\n- `flake8`_\n- `coverage`_\n- `rstcheck`_\n- `mypy`_\n- `pytestcov`_\n- `tox`_\n- `isort`_\n- `black`_\n- `precommit`_\n\n\n\ud83d\udc4b Contribute\n-------------\n\nIf you are looking for a way to contribute to the project, please refer to the `Guideline`_.\n\n\ud83d\udcdd License\n----------\n\nThis program and the accompanying materials are made available under the terms and conditions of the `GNU GENERAL PUBLIC LICENSE`_.\n\n.. _GNU GENERAL PUBLIC LICENSE: http://www.gnu.org/licenses/\n.. _readonly: https://pypi.org/project/readonly/\n.. _Marco Sulla: https://github.com/Marco-Sulla\n.. _Guideline: https://github.com/wiseaidev/readonly/blob/main/CONTRIBUTING.rst\n.. _pyenv: https://github.com/pyenv/pyenv\n.. _poetry: https://github.com/python-poetry/poetry\n.. _pipx: https://github.com/pypa/pipx\n.. _python: https://www.python.org/\n.. _pytest: https://docs.pytest.org/en/7.1.x/\n.. _flake8: https://flake8.pycqa.org/en/latest/\n.. _coverage: https://coverage.readthedocs.io/en/6.3.2/\n.. _rstcheck: https://pypi.org/project/rstcheck/\n.. _mypy: https://mypy.readthedocs.io/en/stable/\n.. _pytestcov: https://pytest-cov.readthedocs.io/en/latest/\n.. _tox: https://tox.wiki/en/latest/\n.. _isort: https://github.com/PyCQA/isort\n.. _black: https://black.readthedocs.io/en/stable/\n.. _precommit: https://pre-commit.com/\n",
"bugtrack_url": null,
"license": "GNU General Public License v3.0",
"summary": "Make any module attributes read only.",
"version": "0.1.2",
"split_keywords": [
"python",
"readonly"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "82f623cba74140a256a5f44ffdb7a00b868ec2c37f9764e095e15e9b33516775",
"md5": "3066c985aefbcbc95ceb834c8044177d",
"sha256": "c95cd593bb1fc62f842c357e9a15c47af009e91de5b9c8acc7f9ac4534ca3d11"
},
"downloads": -1,
"filename": "readonly-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3066c985aefbcbc95ceb834c8044177d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9,<4.0",
"size": 7172,
"upload_time": "2023-04-17T22:25:03",
"upload_time_iso_8601": "2023-04-17T22:25:03.206206Z",
"url": "https://files.pythonhosted.org/packages/82/f6/23cba74140a256a5f44ffdb7a00b868ec2c37f9764e095e15e9b33516775/readonly-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "02924ec1230d43fe7f93ef6dc00e5ecf33013e47875fa24fb4000de81b00c358",
"md5": "332f280547e3b5a7359b0001269a481d",
"sha256": "a2608fd5a355d42cb3ddb2de502a296be8a5ac9885c64d7002180e96cec02f6c"
},
"downloads": -1,
"filename": "readonly-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "332f280547e3b5a7359b0001269a481d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9,<4.0",
"size": 4645,
"upload_time": "2023-04-17T22:25:05",
"upload_time_iso_8601": "2023-04-17T22:25:05.509697Z",
"url": "https://files.pythonhosted.org/packages/02/92/4ec1230d43fe7f93ef6dc00e5ecf33013e47875fa24fb4000de81b00c358/readonly-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-17 22:25:05",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "wiseaidev",
"github_project": "readonly",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"circle": true,
"tox": true,
"lcname": "readonly"
}