Dependencies and Packages
QGas is built on a combination of Python backend tools and JavaScript frontend libraries. This document provides a comprehensive overview of all dependencies, their purposes, and version requirements.
Python Dependencies
The Python environment is managed via Conda and defined in environment.yml.
Core Python
| Package | Version | Purpose |
|---|---|---|
| python | 3.11.5+ | Base Python interpreter. Version 3.11 required for modern features and performance. |
GUI and Image Processing
| Package | Version | Purpose |
|---|---|---|
| tkinter | Built-in | Desktop GUI framework. Included with Python, used for server control interface. |
| Pillow | 10.0.0+ | Python Imaging Library. Used for logo display in GUI and image processing for georeferencing. |
HTTP Communication
| Package | Version | Purpose |
|---|---|---|
| http.server | Built-in | Standard library HTTP server for serving static files and JSON endpoints. |
| socketserver | Built-in | TCP server infrastructure with address reuse for quick restarts. |
Utilities
| Package | Version | Purpose |
|---|---|---|
| json | Built-in | JSON parsing and serialization for GeoJSON data handling. |
| gzip | Built-in | Data compression for efficient transfer of large GeoJSON files. |
| threading | Built-in | Server execution in background threads. |
| concurrent.futures | Built-in | Thread pool executor for parallel processing of data operations. |
JavaScript Dependencies (Frontend)
JavaScript libraries are loaded via CDN in the browser. No local installation required.
Mapping and Visualization
| Library | Version | Purpose | Source |
|---|---|---|---|
| Leaflet.js | 1.9.4 | Core interactive mapping library. Provides map rendering, layer management, and interaction handling. | unpkg.com |
| Leaflet Draw | 1.0.4 | Drawing tools plugin for Leaflet. Enables interactive geometry creation and editing. | cdn.jsdelivr.net |
| Leaflet PolylineDecorator | 1.6.0 | Arrow decorators for pipelines. Shows flow direction on pipeline segments. | cdn.jsdelivr.net |
| OpenStreetMap Tiles | Current | Background map tiles. Requires internet connection during use. | openstreetmap.org |
Data Processing
| Library | Version | Purpose | Source |
|---|---|---|---|
| JSZip | 3.10.1 | ZIP file creation in browser. Used for packaging exports. | cdnjs.cloudflare.com |
| SheetJS (xlsx) | 0.18.5 | Excel file handling. Enables Excel export functionality. | cdnjs.cloudflare.com |
Charting and Statistics
| Library | Version | Purpose | Source |
|---|---|---|---|
| Chart.js | Latest | Interactive charts for statistics window. Renders bar charts, pie charts, histograms. | cdn.jsdelivr.net |
| chartjs-plugin-zoom | Latest | Chart.js plugin for zooming and panning in statistical charts. | cdn.jsdelivr.net |
Development Tools (Optional)
These tools are recommended for development but not required for running QGas:
| Tool | Purpose |
|---|---|
| VS Code | Recommended IDE with Python and JavaScript support |
| Python Extension | VS Code Python language support and debugging |
| Git | Version control |
Browser Requirements
QGas requires a modern web browser with ES6+ JavaScript support:
Recommended Browsers
- Microsoft Edge (Latest) - Recommended, tested extensively
- Google Chrome (Latest) - Full support
- Mozilla Firefox (Latest) - Full support
Required Browser Features
- ES6 Module support
- Fetch API
- Canvas API (for charts)
- File API (for exports)
- localStorage
Network Ports
QGas requires the following ports to be available:
| Port | Protocol | Purpose |
|---|---|---|
| 8000 | HTTP | Static file server and API endpoints |
Ensure these ports are not blocked by firewall or used by other applications.
Installation via Conda
All Python dependencies are automatically installed when creating the Conda environment:
conda env create -f environment.yml
conda activate QGas
This ensures:
- Correct Python version
- All required packages installed
- Isolated environment (no conflicts with system Python)
- Reproducible setup across different machines
Dependency Management
Adding New Python Dependencies
To add a new Python package:
- Add it to
environment.ymlunderdependencies - Update the environment:
conda env update -f environment.yml - Document it in this file
Adding New JavaScript Libraries
To add a new JavaScript library:
- Add CDN link in
GUI.htmlheader - Ensure it's loaded before scripts that use it
- Document it in this file
- Consider fallback for offline scenarios if critical
Version Pinning Strategy
- Python Core: Major.minor pinned (e.g., 3.11.5)
- Critical Libraries: Minimum version specified (e.g., 10.0.0)
- JavaScript CDN: Exact version specified for stability
- Development Tools: Latest version recommended
Before updating major versions of Leaflet or other core libraries, thoroughly test all functionality as API changes may break existing tools.