# Local Development

## Pyenv

* It is a version manager, enabling to shift the versions easily

<pre class="language-bash"><code class="lang-bash"># install specific version
pyenv install 3.10
# apply version
<strong>pyenv global 3.10
</strong><strong># check version
</strong><strong>python3 --version
</strong></code></pre>

## Virtual Environment

* **Venv**, is a fully self-contained development environment, complete with its own Python interpreter, libraries, and required dependencies. This creates a separate “mini” Python setup that’s completely isolated from the system-wide Python installation and any other virtual environments you may have.
* Virtual environments are especially useful when you need to work on multiple projects or multiple versions of the same project without causing conflicts or delays.
* Make sure that Python interpreter version **MUST** be matched

```bash
# Create venv
python3 -m venv venv
# Enter into venv
source venv/bin/activate
# Exit
deactivate
```

## Package Installation

* Make sure the dependencies with correct version must be included in `requirements.txt`

{% code title="requirements.txt" %}
```
opensearch==0.9.2
opensearch-py==2.8.0
```
{% endcode %}

* Install the package

```bash
pip install -r requirements.txt
```
