Switching to uv and direnv.
This commit is contained in:
parent
4777d96c42
commit
888b8ae98f
6 changed files with 96 additions and 34 deletions
33
.env
33
.env
|
|
@ -1,33 +0,0 @@
|
||||||
venv_dir=".venv"
|
|
||||||
currentvenv=""
|
|
||||||
get_project_root() {
|
|
||||||
local current_dir="$PWD"
|
|
||||||
while [[ "$current_dir" != "" && ! -d "$current_dir/$venv_dir" ]]; do
|
|
||||||
current_dir=${current_dir%/*}
|
|
||||||
done
|
|
||||||
echo "$current_dir"
|
|
||||||
}
|
|
||||||
|
|
||||||
root_dir=$(get_project_root)
|
|
||||||
|
|
||||||
if [[ -z "$root_dir" || ! -d "$root_dir/$venv_dir" ]]; then
|
|
||||||
echo "Unable to find the virtual environment folder."
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $VIRTUAL_ENV != "" ]]; then
|
|
||||||
currentvenv="${VIRTUAL_ENV##*/}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$currentvenv" != "$venv_dir" ]]; then
|
|
||||||
python_version=$(python3 --version 2>&1)
|
|
||||||
echo "Switching to environment: $venv_dir | $python_version"
|
|
||||||
source "$root_dir/$venv_dir/bin/activate"
|
|
||||||
fi
|
|
||||||
|
|
||||||
pip freeze > requirements.txt
|
|
||||||
sed -i "" -e "s/==/>=/" requirements.txt
|
|
||||||
pip install --upgrade pip
|
|
||||||
pip -q install -r requirements.txt
|
|
||||||
echo "Updated pip packages."
|
|
||||||
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
deactivate
|
|
||||||
29
.envrc
Normal file
29
.envrc
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Check if .venv exists
|
||||||
|
if [[ -d ".venv" ]]; then
|
||||||
|
# Activate the virtual environment
|
||||||
|
export VIRTUAL_ENV="$PWD/.venv"
|
||||||
|
export PATH="$VIRTUAL_ENV/bin:$PATH"
|
||||||
|
|
||||||
|
# Verify we're using the right Python
|
||||||
|
if [[ -x "$VIRTUAL_ENV/bin/python" ]]; then
|
||||||
|
export PYTHONPATH="$PWD/src:$PYTHONPATH"
|
||||||
|
echo "Activated virtual environment: $VIRTUAL_ENV"
|
||||||
|
else
|
||||||
|
echo "Warning: Virtual environment Python not found"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Warning: No .venv directory found"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run uv sync to update packages
|
||||||
|
if command -v uv &> /dev/null; then
|
||||||
|
echo "Running uv sync..."
|
||||||
|
uv sync
|
||||||
|
echo "Packages updated successfully"
|
||||||
|
else
|
||||||
|
echo "Warning: uv not found"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Environment configured with direnv"
|
||||||
5
.gitignore
vendored
5
.gitignore
vendored
|
|
@ -132,3 +132,8 @@ cython_debug/
|
||||||
|
|
||||||
# PyPI configuration file
|
# PyPI configuration file
|
||||||
.pypirc
|
.pypirc
|
||||||
|
|
||||||
|
# uv lock files
|
||||||
|
uv.lock
|
||||||
|
*.pyc
|
||||||
|
.python-version
|
||||||
6
main.py
Normal file
6
main.py
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
def main():
|
||||||
|
print("Hello from gugulet-hu!")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
56
pyproject.toml
Normal file
56
pyproject.toml
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
[project]
|
||||||
|
name = "gugulet-hu"
|
||||||
|
version = "0.1.0"
|
||||||
|
description = "Add your description here"
|
||||||
|
readme = "README.md"
|
||||||
|
requires-python = ">=3.13"
|
||||||
|
dependencies = [
|
||||||
|
"babel==2.17.0",
|
||||||
|
"backrefs==5.9",
|
||||||
|
"beautifulsoup4==4.14.2",
|
||||||
|
"certifi==2025.10.5",
|
||||||
|
"charset-normalizer==3.4.4",
|
||||||
|
"click==8.1.8",
|
||||||
|
"colorama==0.4.6",
|
||||||
|
"csscompressor==0.9.5",
|
||||||
|
"editorconfig==0.17.1",
|
||||||
|
"ghp-import==2.1.0",
|
||||||
|
"hjson==3.1.0",
|
||||||
|
"htmlmin2==0.1.13",
|
||||||
|
"idna==3.11",
|
||||||
|
"importlib-metadata==8.7.0",
|
||||||
|
"jinja2==3.1.6",
|
||||||
|
"jsbeautifier==1.15.4",
|
||||||
|
"jsmin==3.0.1",
|
||||||
|
"markdown==3.9",
|
||||||
|
"markupsafe==3.0.3",
|
||||||
|
"mergedeep==1.3.4",
|
||||||
|
"mkdocs==1.6.1",
|
||||||
|
"mkdocs-get-deps==0.2.0",
|
||||||
|
"mkdocs-glightbox==0.5.1",
|
||||||
|
"mkdocs-macros-plugin==1.4.0",
|
||||||
|
"mkdocs-material==9.6.22",
|
||||||
|
"mkdocs-material-extensions==1.3.1",
|
||||||
|
"mkdocs-mermaid2-plugin==1.2.3",
|
||||||
|
"mkdocs-minify-plugin==0.8.0",
|
||||||
|
"mkdocs-section-index==0.3.10",
|
||||||
|
"packaging==25.0",
|
||||||
|
"paginate==0.5.7",
|
||||||
|
"pathspec==0.12.1",
|
||||||
|
"platformdirs==4.4.0",
|
||||||
|
"pygments==2.19.2",
|
||||||
|
"pymdown-extensions==10.16.1",
|
||||||
|
"python-dateutil==2.9.0.post0",
|
||||||
|
"pyyaml==6.0.3",
|
||||||
|
"pyyaml-env-tag==1.1",
|
||||||
|
"requests==2.32.5",
|
||||||
|
"selectolax==0.3.29",
|
||||||
|
"six==1.17.0",
|
||||||
|
"soupsieve==2.8",
|
||||||
|
"super-collections==0.6.2",
|
||||||
|
"termcolor==3.1.0",
|
||||||
|
"typing-extensions==4.15.0",
|
||||||
|
"urllib3==2.5.0",
|
||||||
|
"watchdog==6.0.0",
|
||||||
|
"zipp==3.23.0",
|
||||||
|
]
|
||||||
Loading…
Add table
Add a link
Reference in a new issue