|
| 1 | +# Poetry Installation and Usage Guide for Wifite2 |
| 2 | + |
| 3 | +This guide explains how to install and use wifite2 with Poetry for development and testing. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- Python 3.9 or higher |
| 8 | +- Poetry (install from https://python-poetry.org/docs/#installation) |
| 9 | + |
| 10 | +## Quick Start |
| 11 | + |
| 12 | +### 1. Install Poetry |
| 13 | + |
| 14 | +If you don't have Poetry installed: |
| 15 | + |
| 16 | +```bash |
| 17 | +curl -sSL https://install.python-poetry.org | python3 - |
| 18 | +``` |
| 19 | + |
| 20 | +Or using pip: |
| 21 | + |
| 22 | +```bash |
| 23 | +pip install poetry |
| 24 | +``` |
| 25 | + |
| 26 | +### 2. Install Dependencies |
| 27 | + |
| 28 | +Clone the repository and install dependencies: |
| 29 | + |
| 30 | +```bash |
| 31 | +git clone https://github.com/kimocoder/wifite2.git |
| 32 | +cd wifite2 |
| 33 | +poetry install |
| 34 | +``` |
| 35 | + |
| 36 | +This will: |
| 37 | +- Create a virtual environment |
| 38 | +- Install all dependencies from `pyproject.toml` |
| 39 | +- Install wifite2 in editable mode |
| 40 | + |
| 41 | +### 3. Run Wifite2 |
| 42 | + |
| 43 | +Activate the Poetry shell: |
| 44 | + |
| 45 | +```bash |
| 46 | +poetry shell |
| 47 | +``` |
| 48 | + |
| 49 | +Then run wifite: |
| 50 | + |
| 51 | +```bash |
| 52 | +wifite |
| 53 | +``` |
| 54 | + |
| 55 | +Or run directly without activating the shell: |
| 56 | + |
| 57 | +```bash |
| 58 | +poetry run wifite |
| 59 | +``` |
| 60 | + |
| 61 | +## Development |
| 62 | + |
| 63 | +### Running Tests |
| 64 | + |
| 65 | +Run all tests: |
| 66 | + |
| 67 | +```bash |
| 68 | +poetry run pytest |
| 69 | +``` |
| 70 | + |
| 71 | +Run specific test file: |
| 72 | + |
| 73 | +```bash |
| 74 | +poetry run pytest tests/test_tui_integration.py |
| 75 | +``` |
| 76 | + |
| 77 | +Run with coverage: |
| 78 | + |
| 79 | +```bash |
| 80 | +poetry run pytest --cov=wifite --cov-report=html |
| 81 | +``` |
| 82 | + |
| 83 | +### Adding Dependencies |
| 84 | + |
| 85 | +Add a runtime dependency: |
| 86 | + |
| 87 | +```bash |
| 88 | +poetry add package-name |
| 89 | +``` |
| 90 | + |
| 91 | +Add a development dependency: |
| 92 | + |
| 93 | +```bash |
| 94 | +poetry add --group dev package-name |
| 95 | +``` |
| 96 | + |
| 97 | +### Updating Dependencies |
| 98 | + |
| 99 | +Update all dependencies: |
| 100 | + |
| 101 | +```bash |
| 102 | +poetry update |
| 103 | +``` |
| 104 | + |
| 105 | +Update specific package: |
| 106 | + |
| 107 | +```bash |
| 108 | +poetry update package-name |
| 109 | +``` |
| 110 | + |
| 111 | +### Show Installed Packages |
| 112 | + |
| 113 | +```bash |
| 114 | +poetry show |
| 115 | +``` |
| 116 | + |
| 117 | +Show dependency tree: |
| 118 | + |
| 119 | +```bash |
| 120 | +poetry show --tree |
| 121 | +``` |
| 122 | + |
| 123 | +## Building and Publishing |
| 124 | + |
| 125 | +### Build Distribution |
| 126 | + |
| 127 | +```bash |
| 128 | +poetry build |
| 129 | +``` |
| 130 | + |
| 131 | +This creates both wheel and source distributions in the `dist/` directory. |
| 132 | + |
| 133 | +### Install from Built Package |
| 134 | + |
| 135 | +```bash |
| 136 | +pip install dist/wifite2-*.whl |
| 137 | +``` |
| 138 | + |
| 139 | +## Troubleshooting |
| 140 | + |
| 141 | +### Virtual Environment Location |
| 142 | + |
| 143 | +Find where Poetry created the virtual environment: |
| 144 | + |
| 145 | +```bash |
| 146 | +poetry env info --path |
| 147 | +``` |
| 148 | + |
| 149 | +### Remove Virtual Environment |
| 150 | + |
| 151 | +```bash |
| 152 | +poetry env remove python |
| 153 | +``` |
| 154 | + |
| 155 | +### Clear Poetry Cache |
| 156 | + |
| 157 | +```bash |
| 158 | +poetry cache clear pypi --all |
| 159 | +``` |
| 160 | + |
| 161 | +### Lock File Issues |
| 162 | + |
| 163 | +If you encounter lock file issues: |
| 164 | + |
| 165 | +```bash |
| 166 | +poetry lock --no-update |
| 167 | +``` |
| 168 | + |
| 169 | +## Configuration |
| 170 | + |
| 171 | +Poetry configuration is stored in `pyproject.toml`. Key sections: |
| 172 | + |
| 173 | +- `[tool.poetry]` - Project metadata |
| 174 | +- `[tool.poetry.dependencies]` - Runtime dependencies |
| 175 | +- `[tool.poetry.group.dev.dependencies]` - Development dependencies |
| 176 | +- `[tool.poetry.scripts]` - Entry points (wifite command) |
| 177 | +- `[tool.pytest.ini_options]` - Pytest configuration |
| 178 | + |
| 179 | +## Comparison with setup.py |
| 180 | + |
| 181 | +Poetry provides several advantages over traditional `setup.py`: |
| 182 | + |
| 183 | +- **Dependency Resolution**: Poetry resolves dependencies and creates a lock file |
| 184 | +- **Virtual Environment Management**: Automatic virtual environment creation |
| 185 | +- **Modern Standards**: Uses `pyproject.toml` (PEP 518) |
| 186 | +- **Reproducible Builds**: Lock file ensures consistent installations |
| 187 | +- **Development Dependencies**: Separate dev dependencies from runtime |
| 188 | + |
| 189 | +Both `setup.py` and Poetry can coexist in the project for compatibility. |
| 190 | + |
| 191 | +## Additional Resources |
| 192 | + |
| 193 | +- [Poetry Documentation](https://python-poetry.org/docs/) |
| 194 | +- [Poetry Commands](https://python-poetry.org/docs/cli/) |
| 195 | +- [Managing Dependencies](https://python-poetry.org/docs/managing-dependencies/) |
0 commit comments