Make any given module attributes read only.
OTHER License
.. 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.
readonly requires Python 3.9 or above.
To install Python 3.9, I recommend using pyenv
_.
.. code-block:: bash
git clone https://github.com/pyenv/pyenv ~/.pyenv
cat << EOF >> ~/.zshrc
export PATH="${HOME}/.pyenv/bin:${PATH}" export PYENV_ROOT="${HOME}/.pyenv" eval "$(pyenv init -)" EOF
cat << EOF >> ~/.bashrc
export PATH="${HOME}/.pyenv/bin:${PATH}" export PYENV_ROOT="${HOME}/.pyenv" eval "$(pyenv init -)" EOF
pyenv install 3.9.10
pyenv global system 3.9.10
To manage the Python 3.9 virtualenv, I recommend using poetry
_.
.. code-block:: bash
curl -sSL https://install.python-poetry.org | python3 - poetry --version Poetry version 1.1.13
poetry env use 3.9.10
Creating virtualenv readonly-dxc671ba-py3.9 in ~/.cache/pypoetry/virtualenvs
ModuleNotFoundError
No module named 'virtualenv.seed.via_app_data'
at :973 in _find_and_load_unlocked
sudo apt remove --purge python3-virtualenv virtualenv python3 -m pip install -U virtualenv
poetry env use 3.9.10 Using virtualenv: ~/.cache/pypoetry/virtualenvs/readonly-dxc671ba-py3.9
With :code:pip
:
.. code-block:: console
python3.9 -m pip install readonly
.. code-block:: python3
from readonly import readonly import math math = readonly(math)
math.pi = 3.0
The following projects were used to build and test :code:readonly
.
python
_poetry
_pytest
_flake8
_coverage
_rstcheck
_mypy
_pytestcov
_tox
_isort
_black
_precommit
_If you are looking for a way to contribute to the project, please refer to the Guideline
_.
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/