Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sicara/rag-initiator

Repo used to mob to learn how to rag
https://github.com/sicara/rag-initiator

Last synced: about 2 months ago
JSON representation

Repo used to mob to learn how to rag

Awesome Lists containing this project

README

        

# rag-initiator

> repo used to learn how to do a rag

## Project requirements

### Pyenv and `Python 3.11.6`

- Install [pyenv](https://github.com/pyenv/pyenv) to manage your Python versions and virtual environments:
```bash
curl -sSL https://pyenv.run | bash
```
- If you are on MacOS and experiencing errors on python install with pyenv, follow this [comment](https://github.com/pyenv/pyenv/issues/1740#issuecomment-738749988)
- Add these lines to your `~/.bashrc` or `~/.zshrc` to be able to activate `pyenv virtualenv`:
```bash
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
eval "$(pyenv init --path)"
```
- Restart your shell

- Install the right version of `Python` with `pyenv`:
```bash
pyenv install 3.11.6
```

### Poetry

- Install [Poetry](https://python-poetry.org) to manage your dependencies and tooling configs:
```bash
curl -sSL https://install.python-poetry.org | python - --version 1.7.0
```
*If you have not previously installed any Python version, you may need to set your global Python version before installing Poetry:*
```bash
pyenv global 3.11.6
```

## Installation

### Python virtual environment and dependencies

1. Create a `pyenv` virtual environment and link it to your project folder:
```bash
pyenv virtualenv 3.11.6 rag-initiator
pyenv local rag-initiator
```
*Now, every time you are in your project directory your virtualenv will be activated!*

2. Install dependencies with `Poetry`:
```bash
poetry install --no-root
```

Steps 1. and 2. can also be done in one command:
```bash
make install
```

### Install git hooks (running before commit and push commands)

```bash
poetry run pre-commit install
```

## Testing

To run unit tests, run `pytest` with:
```bash
pytest tests --cov src
```
or
```bash
make test
```

## Formatting and static analysis

### Code formatting with `ruff`

To check code formatting, run `ruff format` with:
```bash
ruff format --check .
```
or
```bash
make format-check
```

You can also [integrate it to your IDE](https://docs.astral.sh/ruff/integrations/) to reformat
your code each time you save a file.

### Static analysis with `ruff`

To run static analysis, run `ruff` with:
```bash
ruff check src tests
```
or
```bash
make lint-check
```

To run static analysis and to apply auto-fixes, run `ruff` with:
```bash
make lint-fix
```
### Type checking with `mypy`

To type check your code, run `mypy` with:
```bash
mypy src --explicit-package-bases --namespace-packages
```
or
```bash
make type-check
```