File size: 2,914 Bytes
779ae91 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
# Poetry Commands for Folio Project
This document provides a reference for common Poetry commands used in the Folio project.
## Installation
```bash
# Install Poetry
curl -sSL https://install.python-poetry.org | python3 -
# Configure Poetry to create virtual environments in the project directory
poetry config virtualenvs.in-project true
```
## Basic Commands
### Environment Management
```bash
# Create/initialize a virtual environment
poetry env use python3
# Activate the virtual environment
poetry shell
# Exit the virtual environment
exit # or Ctrl+D
```
### Dependency Management
```bash
# Install all dependencies from pyproject.toml
poetry install
# Add a new dependency
poetry add package-name
# Add a development dependency
poetry add --group dev package-name
# Note: The dev group includes both development tools (linting, testing)
# and CLI tools (focli interactive shell)
# Update all dependencies
poetry update
# Update a specific dependency
poetry update package-name
# Show installed packages
poetry show
# Show dependency tree
poetry show --tree
```
## Running Commands
```bash
# Run a command within the virtual environment
poetry run python -m src.folio.app
# Run the linter
poetry run ruff check --fix --unsafe-fixes .
# Run tests
poetry run pytest tests/
# Run end-to-end tests
poetry run pytest tests/e2e/
```
## Project Commands
These commands replace the traditional Make commands:
```bash
# Start the portfolio dashboard
poetry run python -m src.folio.app --port 8051 --debug
# Start the portfolio dashboard with sample portfolio
poetry run python -m src.folio.app --port 8051 --debug --portfolio src/folio/assets/sample-portfolio.csv
# Run the SPY simulator
poetry run python ./scripts/folio-simulator.py
# Start the Folio CLI interactive shell
poetry run python src/!focli/focli.py
```
## Advanced Commands
```bash
# Export dependencies to requirements.txt
poetry export -f requirements.txt --output requirements.txt
# Export development dependencies
poetry export --with dev -f requirements.txt --output requirements-dev.txt
# Build the project
poetry build
# Check for dependency conflicts
poetry check
```
## Troubleshooting
```bash
# Clear Poetry's cache
poetry cache clear --all pypi
# Update Poetry itself
poetry self update
# Get Poetry version
poetry --version
# Get detailed environment info (useful for debugging)
poetry env info
```
## Make Integration
The Folio project has integrated Poetry into its Makefile, so you can continue to use familiar Make commands:
```bash
# Set up Poetry and create a virtual environment
make env
# Install dependencies using Poetry
make install
# Run linter using Poetry
make lint
# Run tests using Poetry
make test
# Run the application using Poetry
make folio
```
All these Make commands now use Poetry under the hood, providing a seamless transition to the new dependency management system.
|