-
Notifications
You must be signed in to change notification settings - Fork 0
Building from Source
Dragon edited this page Dec 22, 2025
·
2 revisions
Last updated: 12/22/2025
# Clone and build in one command
git clone https://github.com/DAPOWER99/NaviDuck.git && cd NaviDuck && python -m pip install -r requirements.txt && python setup.py develop✅ Windows: Fully supported
✅ Linux: Fully supported
✅ macOS: Fully supported
📱 Android: Via Termux
📱 iOS: Via iSH Shell
┌──────────────────────────────────────┐
│ Minimum Requirements │
├──────────────────────────────────────┤
│ 💻 OS: Windows 10, macOS 10.15+, │
│ Ubuntu 20.04+, or equivalent │
│ 🐍 Python: 3.8 or newer │
│ 📦 RAM: 256 MB │
│ 💾 Storage: 50 MB free space │
│ 🌐 Internet: For package downloads │
└──────────────────────────────────────┘
┌──────────────────────────────────────┐
│ Recommended Requirements │
├──────────────────────────────────────┤
│ 💻 OS: Windows 11, macOS 12+, │
│ Ubuntu 22.04+ │
│ 🐍 Python: 3.10 or newer │
│ 📦 RAM: 512 MB │
│ 💾 Storage: 100 MB free space │
│ 🎨 Terminal: Supports UTF-8 & colors │
└──────────────────────────────────────┘
# Clone the repository
git clone https://github.com/DAPOWER99/NaviDuck.git
# Navigate to project directory
cd NaviDuck
# View available versions
git tag # Shows release versions
git branch -a # Shows all branches# Download latest release
curl -L -o naviduck.zip https://github.com/DAPOWER99/NaviDuck/archive/refs/heads/main.zip
# Extract
unzip naviduck.zip
cd NaviDuck-main# 1. Fork on GitHub first
# 2. Then clone your fork
git clone https://github.com/YOUR_USERNAME/NaviDuck.git
cd NaviDuck
# Add upstream
git remote add upstream https://github.com/DAPOWER99/NaviDuck.git# Create virtual environment
python -m venv venv
# Activate it:
# Windows:
venv\Scripts\activate
# Linux/macOS:
source venv/bin/activate
# Verify activation (should show (venv) in prompt)
which python # Should point to venv/bin/python# Using Conda (optional)
conda create -n naviduck python=3.10
conda activate naviduck# Install core dependencies
pip install -r requirements.txt
# Or install manually
pip install requests colorama# Install all dependencies (development + optional)
pip install -r requirements.txt
# Or install individually:
pip install requests beautifulsoup4 colorama
pip install pytest pytest-cov black flake8 mypy
pip install pre-commit # For git hooks# Check installed packages
pip list | grep -E "(requests|colorama|pytest)"
# Expected output:
# colorama 0.4.6
# requests 2.31.0
# pytest 7.4.0# Install in development mode (editable)
pip install -e .
# Verify installation
python -c "import naviduck; print(naviduck.__version__)"# Build wheel package
python setup.py bdist_wheel
# Build source distribution
python setup.py sdist
# Built packages will be in dist/ directory
ls dist/
# naviduck-1.0.0-py3-none-any.whl
# naviduck-1.0.0.tar.gz# Run unit tests
pytest tests/
# Run with coverage
pytest --cov=naviduck tests/
# Run specific test categories
pytest tests/test_search.py
pytest tests/test_network.py -v # Verbose output# Run in test mode
python naviduck.py --test
# Or run normally
python naviduck.py
# Test basic functionality
python -c "
from naviduck.browser_state import BrowserState
state = BrowserState()
print(f'Initialized: {state is not None}')
"# PowerShell as Administrator
# Enable running scripts
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
# Install Python (if not installed)
winget install Python.Python.3.11
# Clone and build
git clone https://github.com/DAPOWER99/NaviDuck.git
cd NaviDuck
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt
python naviduck.py// settings.json for Windows Terminal
{
"profiles": {
"defaults": {
"fontFace": "Cascadia Code",
"fontSize": 11
},
"list": [
{
"name": "NaviDuck",
"commandline": "cmd.exe /k \"cd /d C:\\path\\to\\NaviDuck && venv\\Scripts\\activate && python naviduck.py\"",
"hidden": false
}
]
}
}# Update system
sudo apt update
sudo apt upgrade -y
# Install Python and tools
sudo apt install python3 python3-pip python3-venv git curl
# Install system dependencies (if needed)
sudo apt install build-essential python3-dev
# Build NaviDuck
git clone https://github.com/DAPOWER99/NaviDuck.git
cd NaviDuck
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
# Create desktop entry (optional)
sudo cp naviduck.desktop /usr/share/applications/# Install Python
sudo pacman -S python python-pip
# Build
git clone https://github.com/DAPOWER99/NaviDuck.git
cd NaviDuck
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt# Install Python
sudo dnf install python3 python3-pip
# Build
git clone https://github.com/DAPOWER99/NaviDuck.git
cd NaviDuck
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt# Install Python
brew install python
# Install git if needed
brew install git
# Build NaviDuck
git clone https://github.com/DAPOWER99/NaviDuck.git
cd NaviDuck
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
# Create alias (optional)
echo "alias naviduck='cd ~/NaviDuck && source venv/bin/activate && python naviduck.py'" >> ~/.zshrc
source ~/.zshrc# Install Python
sudo port install python311
sudo port select --set python python311
# Build
git clone https://github.com/DAPOWER99/NaviDuck.git
cd NaviDuck
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt# Install Termux from F-Droid or Play Store
# Then in Termux:
# Update packages
pkg update && pkg upgrade
# Install Python and dependencies
pkg install python git
# Clone and build
git clone https://github.com/DAPOWER99/NaviDuck.git
cd NaviDuck
pip install requests colorama
# Run
python naviduck.py
# Note: Tor requires root or special setup on Android# Install iSH Shell from App Store
# Then in iSH:
# Update package list
apk update
# Install Python and dependencies
apk add python3 py3-pip git
# Clone and build
git clone https://github.com/DAPOWER99/NaviDuck.git
cd NaviDuck
pip3 install requests colorama
# Run
python3 naviduck.py# Enable Linux (Beta) in ChromeOS settings
# Then in Linux terminal:
# Install Python
sudo apt update
sudo apt install python3 python3-pip python3-venv
# Build NaviDuck
git clone https://github.com/DAPOWER99/NaviDuck.git
cd NaviDuck
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt# Windows: Install Tor Browser manually
# Download from: https://www.torproject.org/
# Linux:
sudo apt install tor # Debian/Ubuntu
sudo dnf install tor # Fedora
sudo pacman -S tor # Arch
# macOS:
brew install tor
# Then update TorManager path in code:
# In TorManager.__init__():
self.tor_exe = "/usr/bin/tor" # Linux/macOS
# or
self.tor_exe = r"C:\Users\You\Desktop\Tor Browser\Browser\TorBrowser\Tor\tor.exe"# Install additional Tor libraries
pip install stem # Python Tor controller
# Test Tor connection
python -c "
import stem.control
with stem.control.Controller.from_port() as controller:
controller.authenticate()
print('Tor version:', controller.get_version())
"# For better HTML parsing
pip install beautifulsoup4 lxml html5lib
# For enhanced UI
pip install rich prompt-toolkit
# For async features (future)
pip install aiohttp asyncio
# For data analysis (debugging)
pip install pandas numpy matplotlib# Create custom build with feature flags
FEATURES = {
'ENHANCED_PARSING': True,
'ASYNC_SUPPORT': False,
'RICH_UI': False,
'ADVANCED_CACHING': True,
}
# Build with specific features
python setup.py build --features "enhanced_parsing advanced_caching"# Install PyInstaller
pip install pyinstaller
# Create executable
pyinstaller --onefile --name naviduck naviduck.py
# With console window (Windows)
pyinstaller --onefile --console naviduck.py
# Without console (GUI-like)
pyinstaller --onefile --windowed naviduck.py
# Add icons
pyinstaller --onefile --icon=icon.ico naviduck.py# Install Nuitka
pip install nuitka
# Compile to executable
python -m nuitka --onefile naviduck.py
# With optimizations
python -m nuitka --onefile --enable-plugin=tk-inter naviduck.py#!/bin/bash
# setup-dev.sh
set -e # Exit on error
echo "🚀 Setting up NaviDuck development environment..."
# Clone repository
if [ ! -d "NaviDuck" ]; then
git clone https://github.com/DAPOWER99/NaviDuck.git
fi
cd NaviDuck
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Upgrade pip
pip install --upgrade pip
# Install dependencies
pip install -r requirements-dev.txt
# Install pre-commit hooks
pre-commit install
# Run tests
pytest tests/ -v
# Create development config
cp config.example.json config.dev.json
echo "✅ Development environment setup complete!"
echo "👉 Activate with: source venv/bin/activate"
echo "👉 Run tests: pytest"
echo "👉 Start NaviDuck: python naviduck.py --debug"// config.dev.json
{
"environment": "development",
"debug": true,
"log_level": "DEBUG",
"test_mode": true,
"cache_enabled": false,
"mock_responses": true,
"features": {
"experimental": true,
"unsafe": false
}
}# .github/workflows/build.yml
name: Build and Test
on: [push, pull_request]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.8', '3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Lint with flake8
run: |
flake8 naviduck.py --count --max-complexity=10 --statistics
- name: Test with pytest
run: |
pytest tests/ --cov=naviduck --cov-report=xml
- name: Build package
run: |
python setup.py sdist bdist_wheel
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: dist-${{ matrix.os }}-${{ matrix.python-version }}
path: dist/# Dockerfile
FROM python:3.10-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
curl \
tor \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy application
COPY . .
# Create non-root user
RUN useradd -m -u 1000 naviduck
USER naviduck
# Run Tor in background and start NaviDuck
CMD tor & python naviduck.py# docker-compose.yml
version: '3.8'
services:
naviduck:
build: .
container_name: naviduck
volumes:
- ./data:/home/naviduck/.naviduck
ports:
- 8080:8080
environment:
- TOR_ENABLED=true
- DEBUG=false
command: python naviduck.py --host 0.0.0.0 --port 8080# Build image
docker build -t naviduck .
# Run container
docker run -it --rm naviduck
# Run with volume for persistent data
docker run -it --rm -v naviduck_data:/home/naviduck/.naviduck naviduck
# Run with compose
docker-compose up# Security-focused dependencies
pip install bandit safety pyre-check
# Run security checks
bandit -r naviduck.py
safety check#!/bin/bash
# build-secure.sh
# Build with security flags
export CFLAGS="-fstack-protector-strong -D_FORTIFY_SOURCE=2"
export LDFLAGS="-Wl,-z,now,-z,relro"
# Install in isolated environment
python -m venv secure_venv --without-pip
source secure_venv/bin/activate
# Install with hash checking
pip install --require-hashes -r requirements-secure.txt
# Build with security audit
python setup.py build --security-audit# On internet-connected machine
# Download all dependencies
pip download -r requirements.txt -d offline_packages
# Copy to air-gapped machine
# Then install from local packages
pip install --no-index --find-links=offline_packages -r requirements.txt
# Build without network access
python setup.py build --offline# Performance monitoring
pip install py-spy memory_profiler line_profiler
# Optimized dependencies
pip install lxml # Faster than BeautifulSoup
pip install orjson # Faster JSON parsing
pip install uvloop # Faster async (if using async)#!/bin/bash
# build-perf.sh
# Set optimization flags
export CFLAGS="-O3 -march=native"
export CXXFLAGS="-O3 -march=native"
# Install with optimizations
pip install --no-binary :all: -r requirements.txt
# Build with optimizations
python setup.py build --optimize# Create benchmark build
python setup.py build --benchmark
# Run performance tests
python -m pytest tests/performance/ -v
# Profile memory usage
python -m memory_profiler naviduck.py
# Profile CPU usage
python -m cProfile -o profile.stats naviduck.py# Minimal build for unit tests
pip install pytest pytest-cov pytest-mock
python setup.py build --test-unit
pytest tests/unit/# Build with integration test dependencies
pip install pytest-docker pytest-selenium
python setup.py build --test-integration
pytest tests/integration/# Full build for E2E tests
pip install playwright pytest-playwright
python -m playwright install
python setup.py build --test-e2e
pytest tests/e2e/# Build with coverage instrumentation
python setup.py build --coverage
# Run tests with coverage
pytest --cov=naviduck --cov-report=html tests/
# View coverage report
open htmlcov/index.html # Or on Windows: start htmlcov/index.html# Build with only search features
python setup.py build --features "search"
# Build with AI features only
python setup.py build --features "ai"
# Build with privacy features
python setup.py build --features "tor privacy"
# Build minimal version
python setup.py build --minimal# config_custom.py
BUILD_CONFIG = {
'features': {
'search': True,
'ai': True,
'tor': False,
'bookmarks': True,
'history': False,
},
'optimizations': {
'caching': True,
'compression': True,
},
'dependencies': {
'required': ['requests'],
'optional': ['beautifulsoup4', 'colorama'],
}
}
# Build with custom config
python setup.py build --config config_custom.py# Build for Windows with optimizations
$env:PYTHONOPTIMIZE = "2"
python setup.py build --platform windows --optimize
# Include Windows-specific dependencies
pip install pywin32 pythoncom# Build for Linux with system optimizations
export CFLAGS="-O2 -pipe"
export LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now"
python setup.py build --platform linux --optimize# Build for macOS with optimizations
export ARCHFLAGS="-arch x86_64 -arch arm64"
export CFLAGS="-O2"
python setup.py build --platform macos --universal# setup.py
from setuptools import setup, find_packages
setup(
name="naviduck",
version="1.0.0",
packages=find_packages(),
install_requires=[
"requests>=2.25.0",
"colorama>=0.4.4",
],
extras_require={
'dev': [
'pytest>=6.0',
'pytest-cov>=2.0',
'black>=21.0',
'flake8>=3.9',
],
'tor': [
'stem>=1.8.0',
],
'full': [
'beautifulsoup4>=4.9.0',
'lxml>=4.6.0',
'rich>=10.0.0',
]
},
entry_points={
'console_scripts': [
'naviduck=naviduck.main:main',
],
},
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
python_requires='>=3.8',
)# Clean previous builds
rm -rf build/ dist/ *.egg-info/
# Build source distribution
python setup.py sdist
# Build wheel
python setup.py bdist_wheel
# Build universal wheel
python setup.py bdist_wheel --universal
# Build for specific Python version
python setup.py bdist_wheel --python-tag py38
# Verify packages
twine check dist/*# Basic executable
pyinstaller --onefile naviduck.py
# With console
pyinstaller --onefile --console naviduck.py
# With data files
pyinstaller --onefile --add-data "icons/*:icons" naviduck.py
# With icon
pyinstaller --onefile --icon=icon.ico naviduck.py
# Create directory bundle
pyinstaller --onedir naviduck.py# Install cx_Freeze
pip install cx_Freeze
# Build executable
python setup.py build_exe
# With optimizations
python setup.py build_exe --optimize 2# Install packaging tools
sudo apt install devscripts debhelper dh-python
# Create Debian package
dpkg-buildpackage -us -uc
# Or using stdeb
pip install stdeb
python setup.py --command-packages=stdeb.command bdist_deb# Install packaging tools
sudo dnf install rpm-build rpmdevtools
# Setup build environment
rpmdev-setuptree
# Create spec file
python setup.py bdist_rpm --spec-only
# Build RPM
rpmbuild -ba python-naviduck.spec# Create PKGBUILD file
cat > PKGBUILD << 'EOF'
# Maintainer: Your Name <email@example.com>
pkgname=naviduck
pkgver=1.0.0
pkgrel=1
pkgdesc="CLI browser with AI features"
arch=('any')
url="https://github.com/DAPOWER99/NaviDuck"
license=('MIT')
depends=('python' 'python-requests' 'python-colorama')
makedepends=('python-setuptools')
source=("https://github.com/DAPOWER99/NaviDuck/archive/v$pkgver.tar.gz")
sha256sums=('SKIP')
build() {
cd "$srcdir/NaviDuck-$pkgver"
python setup.py build
}
package() {
cd "$srcdir/NaviDuck-$pkgver"
python setup.py install --root="$pkgdir" --optimize=1 --skip-build
}
EOF
# Build package
makepkg -si# For quick testing
curl -s https://raw.githubusercontent.com/DAPOWER99/NaviDuck/main/naviduck.py > naviduck.py
python -c "import requests; print('Dependencies OK')" 2>/dev/null || pip install requests
python naviduck.py --test#!/bin/bash
# dev-build.sh
git pull
source venv/bin/activate
pip install -U -r requirements-dev.txt
pytest tests/ -xvs
python naviduck.py --debug#!/bin/bash
# prod-build.sh
set -e
python -m venv venv_prod
source venv_prod/bin/activate
pip install -U pip
pip install -r requirements.txt --no-deps
python setup.py bdist_wheel
# Verify with:
python -m py_compile naviduck.py# Check Python version
python --version
# If wrong version, specify explicitly
python3.10 naviduck.py
# or
py -3.10 naviduck.py # Windows# Fix virtual environment permissions
sudo chown -R $USER:$USER venv/
# Fix pip permissions
pip install --user package_name
# Or use sudo (not recommended)
sudo pip install package_name# Linux: Install system packages
sudo apt install python3-dev # Debian/Ubuntu
sudo dnf install python3-devel # Fedora
sudo pacman -S python # Arch
# macOS: Install command line tools
xcode-select --install
# Windows: Install Visual C++ Build Tools
# Download from: https://visualstudio.microsoft.com/visual-cpp-build-tools/# Install missing module
pip install requests
# Or install all requirements
pip install -r requirements.txt# Update certificates
pip install --upgrade certifi
# Or temporarily bypass (not recommended for production)
export PYTHONHTTPSVERIFY=0# Update pip
pip install --upgrade pip
# Try with different index
pip install -i https://pypi.org/simple/ package_name
# Or install from source
pip install git+https://github.com/user/repo.git# "python is not recognized"
# Add Python to PATH or use:
py naviduck.py
# Virtual environment activation fails
# Use absolute path:
C:\path\to\venv\Scripts\activate
# File path too long
# Enable long paths in Windows Registry
reg add "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /v LongPathsEnabled /t REG_DWORD /d 1 /f# Python 2 vs Python 3
# Always use python3
python3 naviduck.py
# Certificate issues
# Install certificates
/Applications/Python\ 3.*/Install\ Certificates.command
# Homebrew Python not in PATH
echo 'export PATH="/usr/local/opt/python/libexec/bin:$PATH"' >> ~/.zshrc# Missing tkinter
sudo apt install python3-tk # Debian/Ubuntu
# Permission denied
sudo chmod +x naviduck.py
# Terminal encoding issues
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8#!/bin/bash
# verify-build.sh
echo "🔍 Verifying NaviDuck build..."
# Check Python version
python --version | grep -q "Python 3" || echo "❌ Wrong Python version"
# Check dependencies
python -c "import requests; import colorama; print('✅ Dependencies OK')"
# Run unit tests
pytest tests/unit/ -q
# Test basic functionality
python -c "
from naviduck import BrowserState, SearchManager
state = BrowserState()
print(f'✅ BrowserState: {state}')
"
# Test CLI
python naviduck.py --help | grep -q "NaviDuck" && echo "✅ CLI works"
echo "🎉 Build verification complete!"# Run all verification steps
./scripts/verify-build.sh
# Check code quality
flake8 naviduck.py
black --check naviduck.py
mypy naviduck.py
# Security audit
bandit -r naviduck.py
# Performance benchmark
python -m pytest tests/performance/ -v# Use pip cache
export PIP_CACHE_DIR=~/.cache/pip
# Parallel builds (if supported)
python setup.py build -j 4
# Skip unnecessary steps
python setup.py build --skip-tests
# Use pre-built wheels
pip install --only-binary :all: -r requirements.txt# Clean build artifacts
python setup.py clean --all
# Remove unnecessary files
find . -name "*.pyc" -delete
find . -name "__pycache__" -type d -exec rm -rf {} +
# Create minimal distribution
python setup.py bdist --format=zip --minimal- All tests pass
- No syntax errors
- Dependencies are correctly specified
- Documentation is updated
- Version number is correct
- License files included
- Security audit completed
- Performance benchmarks passed
- Cross-platform compatibility verified
- Executable runs without errors
- All features work as expected
- No missing dependencies
- Build artifacts are clean
- Digital signatures applied (if applicable)
- Release notes updated
# Check existing issues
https://github.com/DAPOWER99/NaviDuck/issues
# Search for similar problems
https://stackoverflow.com/questions/tagged/python+cli
# Python packaging documentation
https://packaging.python.org/
# Platform-specific guides
# Windows: https://docs.python.org/3/using/windows.html
# macOS: https://docs.python.org/3/using/mac.html
# Linux: https://docs.python.org/3/using/unix.htmlWhen asking for build help, include:
- Full error message
-
Python version (
python --version) - Operating System
- Steps you tried
- Relevant logs
Last updated: 12/22/2025
Building from Source Guide version: 3.0
Remember: If you encounter build issues, check the Troubleshooting Guide for solutions to common problems.
Happy building! 🏗️🦆