3636
3737 - name : Install Poetry
3838 run : |
39- # Install specific version of Poetry directly
40- pip install "poetry==1.5.1"
39+ echo "=== Installing Poetry ==="
40+ # Uninstall any existing Poetry installations
41+ pip uninstall -y poetry || true
42+ pip uninstall -y poetry-core || true
43+ pip uninstall -y poetry-plugin-export || true
44+
45+ # Clear Poetry cache and config
46+ rm -rf ~/.cache/pypoetry
47+ rm -rf ~/.config/pypoetry
48+
49+ # Install specific version of Poetry directly using pipx
50+ python -m pip install --user pipx
51+ python -m pipx ensurepath
52+ pipx install "poetry==1.5.1"
53+
54+ # Add Poetry to PATH
4155 echo "$(python -m site --user-base)/bin" >> $GITHUB_PATH
56+ echo "$HOME/.local/bin" >> $GITHUB_PATH
57+
58+ # Verify installation
59+ which poetry || { echo "Poetry not found in PATH"; exit 1; }
60+ poetry --version || { echo "Poetry version check failed"; exit 1; }
4261
4362 - name : Configure Poetry
4463 run : |
@@ -47,34 +66,43 @@ jobs:
4766 echo "Python version: $(python --version)"
4867 echo "Poetry version: $(poetry --version || echo 'Not available')"
4968
50- # Verify Python environment
51- echo "\n=== Python Environment ==="
52- python -c "import sys; print('\n'.join(f'{k}: {v}' for k, v in {
53- 'Executable': sys.executable,
54- 'Version': sys.version,
55- 'Prefix': sys.prefix,
56- 'Base Prefix': sys.base_prefix,
57- 'Exec Prefix': sys.exec_prefix,
58- 'Path': '\n ' + '\n '.join(sys.path)
59- }.items()))"
60-
61- # Configure Poetry with error handling
69+ # Set Poetry to use in-project virtualenvs
6270 echo "\n=== Configuring Poetry ==="
63- python -m poetry config virtualenvs.create true || \
71+ poetry config virtualenvs.create true || \
6472 { echo "Failed to set virtualenvs.create"; exit 1; }
65- python -m poetry config virtualenvs.in-project true || \
73+ poetry config virtualenvs.in-project true || \
6674 { echo "Failed to set virtualenvs.in-project"; exit 1; }
67- python -m poetry config virtualenvs.path .venv || \
68- { echo "Failed to set virtualenvs.path"; exit 1; }
69-
75+
76+ # Create a minimal pyproject.toml if it doesn't exist
77+ if [ ! -f pyproject.toml ]; then
78+ echo "\n=== Creating minimal pyproject.toml ==="
79+ cat > pyproject.toml <<EOL
80+ [tool.poetry]
81+ name = "dialogchain"
82+ version = "0.1.0"
83+ description = "DialogChain Python Package"
84+ authors = ["Your Name <your.email@example.com>"]
85+
86+ [tool.poetry.dependencies]
87+ python = "^3.8"
88+
89+ [build-system]
90+ requires = ["poetry-core>=1.0.0"]
91+ build-backend = "poetry.core.masonry.api"
92+ EOL
93+ fi
94+
7095 # Verify configuration
7196 echo "\n=== Current Poetry Configuration ==="
72- python -m poetry config --list || \
97+ poetry config --list || \
7398 { echo "Failed to list Poetry configuration"; exit 1; }
7499
75100 echo "\n=== Poetry Environment ==="
76- python -m poetry env info || \
101+ poetry env info || \
77102 { echo "Failed to get Poetry environment info"; exit 1; }
103+
104+ echo "\n=== Python Path ==="
105+ python -c "import sys; print('\n'.join(sys.path))"
78106
79107 - name : Install dependencies
80108 run : |
0 commit comments