FTO - First time only
-
Install poetry if not already installed:
pipx install poetry
-
[FTO] Create a new project with poetry:
poetry new py-pdf-chat
-
[FTO] cd into the newly created project:
cd py-pdf-chat
-
[FTO] Test everything is working fine:
- Create a file in root:
touch main.py
- Write some print statement:
print("Hello")
- Run file using poetry:
poetry run python main.py
- Create a file in root:
-
Activate the environment in terminal with:
poetry shell
-
Activate the environtemt for vscode:
cmd + shift + p
to open the command pallete.- Search for
select interpreter
- Provide the path of poetry venv for the current project (copy from terminal).
-
To deactivate the environment use command:
deactivate
. -
[FTO] To add any dependency/package (say fastapi) use command:
poetry add fastapi
similarly for following:- streamlit
- google-generativeai
- python-dotenv
- langchain
- PyPDF2
- faiss-cpu
-
[!CAUTION] Due to some issue with poetry not able to install mentioned, download
langchain-google-genai = "^0.0.9"
manually with pip seperately.
-
Create 2 env files:
.env
and.env.example
enterGOOGLE_API_KEY
. -
In order to run the py files use:
poetry run python app.py
-
To run the project:
streamlit run app/app.py