This commit is contained in:
despiegk 2024-11-08 19:45:52 +03:00
parent aa84cc8793
commit 19988900c6
7 changed files with 129 additions and 7 deletions

17
.gitignore vendored Normal file
View File

@ -0,0 +1,17 @@
__pycache__
*.pyc
.venv
.vscode
index/
prompts2/
python3.12/
python3.13/
site-packages/
include/
bin/
state/
node_modules/
.mypy_cache
target/
lib/investorstool/parsers/input
docs/

View File

@ -1,3 +1,20 @@
# www_threefold4
new version of threefold, minimalistic
## to debug / develop
```bash
hero git clone -u git@git.ourworld.tf:tfgrid/www_threefold4.git
cd ~/code/git.ourworld.tf/tfgrid/www_threefold4
source myenv.sh
# to test an example
cd poc
python server.py
```
## to add package to pip
add it to https://git.ourworld.tf/projectmycelium/hero_server/src/branch/main/requirements.txt

24
install.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
set -ex
BASE_DIR="$(cd "$(dirname "$0")" && pwd)"
source ${BASE_DIR}/myenv.sh
cd $BASE_DIR
python3 -m pip install -r "$BASE_DIR/requirements.txt"
# pip freeze > requirements.txt
#to make sure we have the paths towards hero in our library
PYTHON_VERSION=$(python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")
echo "$BASE_DIR/lib" > "${VENV_DIR}/lib/python${PYTHON_VERSION}/site-packages/herolib.pth"
#for osx
# pip3 install psycopg2-binary
# psycopg2
echo "OK"
python3 -m pip install -r "requirements.txt"
pip install --upgrade pip

27
myenv.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/bash
if [[ "${BASH_SOURCE[0]}" != "${0}" ]]; then
# Script is being sourced
export BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
else
# Script is being executed
export BASE_DIR="$( cd "$( dirname "${0}" )" && pwd )"
fi
export VENV_DIR="${BASE_DIR}/.venv"
python3 -m venv "$VENV_DIR"
source $VENV_DIR/bin/activate
# Check if the directory exists
if [ ! -d "$VENV_DIR" ]; then
echo "Directory $VENV_DIR does not exist. Creating it and setting up a virtual environment."
# The -p flag makes mkdir create any necessary parent directories as well
mkdir -p "$VENV_DIR"
# Create the virtual environment
python3 -m venv "$VENV_DIR"
python3 -m pip install --upgrade pip
fi
export CONTEXTROOT='~/context'
echo "We're good to go"

View File

@ -7,7 +7,9 @@ import os
import markdown
import re
sources_dir = "/Users/despiegk1/code/git.ourworld.tf/freeflowuniverse/heroweb/research/dancing_banner/"
sources_dir = os.path.expanduser("~/code/git.ourworld.tf/tfgrid/www_threefold4/poc")
if not os.path.exists(sources_dir):
raise RuntimeError(f"The source directory '{sources_dir}' does not exist.")
static_dir = f"{sources_dir}/static"
content_dir = f"{sources_dir}/content"

26
requirements.txt Normal file
View File

@ -0,0 +1,26 @@
IPython
colorama
colorlog
flet
inflect
jinja2
markdown-it-py
mdformat
mypy>=1.9.0
openai
psutil
pudb
pydantic>=2.7.1
pylance>=0.10.12
python-Levenshtein
pywalletconnect
pyyaml
qrcode
redis>=5.0.3
requests>=2.32
toml
urllib3
uvicorn
pillow
pymupdf
markdown

9
start.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
set -ex
BASE_DIR="$(cd "$(dirname "$0")" && pwd)"
cd $BASE_DIR
source myenv.sh
cd poc
python server.py