Skip to content

The OSINT investigator's workbench. One case, one folder, every tool. Local-first: your media and your investigations never leave your machine.

JavaScript
10.0 KB
Raw Blame
[build-system]
requires = ["hatchling>=1.27,<2"]
build-backend = "hatchling.build"

[project]
name = "azimut"
# Single-sourced from src/azimut/__init__.py so a release is bumped in one place
# (see [tool.hatch.version] below). Never add a literal version here.
dynamic = ["version"]
description = "A local OSINT workspace for media, geolocation proofs and case management."
readme = "README.md"
requires-python = ">=3.11"
license = { text = "AGPL-3.0-only" }
authors = [{ name = "OsintMeThat" }]
keywords = ["osint", "geoint", "geolocation", "investigation", "verification"]
classifiers = [
    "Development Status :: 4 - Beta",
    "Environment :: Web Environment",
    "Intended Audience :: Other Audience",
    "Operating System :: OS Independent",
    "Programming Language :: Python :: 3.11",
    "Programming Language :: Python :: 3.12",
    "Programming Language :: Python :: 3.13",
]
# Upper bounds stop at the next major we haven't tested against: a range is a
# claim about what works, and we can't make that claim for code that doesn't
# exist yet. Raise a bound deliberately, after the suite passes against it.
#
# yt-dlp and gallery-dl are the deliberate exception — see below.
dependencies = [
    "fastapi>=0.111,<1.0",
    "uvicorn[standard]>=0.30,<1.0",
    "pydantic>=2.7,<3",
    "httpx>=0.27,<1.0",
    "pillow>=13,<14",
    "opencv-python-headless>=4.9,<5",
    "numpy>=1.26,<3",
    "requests>=2.31,<3",
    "python-multipart>=0.0.9,<1.0",
    # Notes to PDF (engine/notes_pdf.py). fpdf2 and markdown-it-py are pure
    # Python, so the three binaries get the same renderer and no build step.
    # WeasyPrint would render nicer CSS but needs Pango and cairo present on the
    # machine, which is a GTK install on Windows and the end of the one-click
    # binary. reportlab was tried and dropped: it cannot draw Burmese and Arabic
    # correctly in one document (see docs, and the shaping note below).
    "fpdf2>=2.8,<3",
    "markdown-it-py>=4.0,<5",
    # Reading a multi-tab workbook into one sheet per tab (engine/sheetxlsx.py). The
    # binders this tool replaces arrive as .xlsx with five or six tabs, and asking the
    # analyst to export each one to CSV by hand is asking them not to bother. Pure
    # Python with its one pure-Python dependency (et-xmlfile), so the three binaries
    # get the same reader and no build step. Reading only: the case's own table is a
    # CSV, and writing xlsx would be a second artifact format to keep honest.
    "openpyxl>=3.1,<4",
    # Text shaping, and not optional: without it Arabic comes out unjoined and
    # Burmese mis-stacked — text that looks like text and is wrong, which is
    # worse than text that is missing. fpdf2 uses it when it is importable,
    # which is why nothing imports it by name. abi3 wheels cover win_amd64,
    # macOS universal2 and manylinux x86_64/arm64.
    "uharfbuzz>=0.50,<1",
    # Timezone from a latitude/longitude, for the civil local time the sun and
    # moon panel shows beside UTC (engine/sky.py). Chosen over timezonefinder,
    # which carries 65 MB of tz polygons into each of the three binaries where
    # this ships prebuilt abi3 wheels at 9 MB. tzdata is what zoneinfo reads on
    # Windows, which has no system tz database.
    "tzfpy>=1.3,<2",
    "tzdata>=2024.1,<2027",
    # Reading a KML, a KMZ or a GPX somebody sent (engine/maplayers.py). Those
    # are untrusted XML, and the stdlib parser expands entities: one file can
    # read a local path through an external entity, or exhaust memory through a
    # nested one. This is the small pure-Python answer — no build step, same
    # parser in all three binaries — and it arrives through fpdf2 already.
    "defusedxml>=0.7,<1",
    # Whole-bundle AES-GCM encryption. Intel macOS lost its wheels in version 49
    # and has had none since, so it stays under that line rather than building
    # from source. The other release targets follow the current major.
    "cryptography>=45,<49; sys_platform == 'darwin' and platform_machine == 'x86_64'",
    "cryptography>=45,<51; sys_platform != 'darwin' or platform_machine != 'x86_64'",
    # Unbounded ON PURPOSE. These two race against sites that change without
    # notice, so an old version is a broken version — the usual "pin for
    # reproducibility" logic inverts here. Azimut can also fetch newer copies
    # at runtime into the workspace, which shadow whatever is installed or
    # frozen into the binary (engine/scrapers.py).
    "yt-dlp>=2024.4.9",
    "gallery-dl>=1.27",
    # Linux only: lets yt-dlp read a Chromium-family browser's cookies for gated
    # downloads (engine/media.py) — the cookie values are sealed with the Secret
    # Service keyring there, and this is the client that unseals them. macOS uses
    # the `security` CLI (no dep) and Windows is routed to the cookies.txt
    # fallback, so neither needs it. Pulls in cryptography + jeepney (Linux
    # wheels, no compiler). Without it, Firefox and the cookies.txt fallback
    # still work everywhere; only Chromium-on-Linux would go dark.
    "secretstorage>=3.3,<4; sys_platform == 'linux'",
]

[project.optional-dependencies]
dev = [
    "pytest>=8,<10",
    "pytest-asyncio>=0.23,<2",
    "httpx>=0.27,<1.0",
    # Starlette 1.3+ uses HTTPX2 for TestClient; keep the old HTTPX runtime
    # client above because application integrations still import that package.
    "httpx2>=2,<3",
    # Reads an exported note back, so the PDF tests assert what is on the page
    # rather than that bytes were written. Test-only: nothing ships it.
    "pypdf>=6,<7",
    # Runs the suite across the machine's cores, which CI asks for with `-n auto`.
    # The tests were already isolated from each other — every one builds its case
    # under `tmp_path`, and nothing is scoped wider than a test — so the only
    # thing serial execution bought was a quarter of an hour per CI run. Not in
    # `addopts` on purpose: a local run stays serial, because parallel output
    # interleaves and `-x` and pdb stop being useful the moment it does.
    "pytest-xdist>=3.6,<4",
    # Static analysis, run in CI (see .github/workflows/ci.yml). ruff is 0.x and
    # ships rule changes between minors, so it's pinned to one minor; mypy to the
    # next major. Both bounds are raised deliberately, after the suite is green.
    "ruff>=0.15,<0.16",
    "mypy>=2.3,<3",
]

[dependency-groups]
# Release-only tools are locked with the application dependencies. Build the
# distributions without isolation so hatchling also comes from uv.lock.
release = [
    "build>=1.2,<2",
    "hatchling>=1.27,<2",
    "pyinstaller>=6,<7",
]

[project.scripts]
azimut = "azimut.cli:main"

[project.urls]
Homepage = "https://github.com/OsintMeThat/azimut"

# The frontend builds into src/azimut/static (git-ignored). Force it into BOTH
# the sdist and the wheel — `python -m build` builds the wheel from the sdist,
# so if the sdist omits static the shipped wheel has no UI. Run `npm run build`
# before building the package.
# The version hatchling stamps into the wheel/sdist is read from __version__,
# so pyproject never carries a second copy that can drift out of sync.
[tool.hatch.version]
path = "src/azimut/__init__.py"

[tool.hatch.build]
artifacts = ["src/azimut/static/**"]

[tool.hatch.build.targets.wheel]
packages = ["src/azimut"]
# The capture extension (repo root extension/) ships inside the wheel so the
# app can serve it for install (GET /api/ingest/extension.zip) — a pip/binary
# user has no repo checkout to load it from. Runtime files only: the dev
# harness (vitest, package.json, node_modules) stays out.
[tool.hatch.build.targets.wheel.force-include]
"extension/manifest.json" = "azimut/extension/manifest.json"
"extension/background.js" = "azimut/extension/background.js"
"extension/bridge.js" = "azimut/extension/bridge.js"
"extension/handoff.js" = "azimut/extension/handoff.js"
"extension/mapmath.js" = "azimut/extension/mapmath.js"
"extension/maptheme.js" = "azimut/extension/maptheme.js"
"extension/maptools.js" = "azimut/extension/maptools.js"
"extension/mapdraw.js" = "azimut/extension/mapdraw.js"
"extension/mapref.js" = "azimut/extension/mapref.js"
"extension/maplink.js" = "azimut/extension/maplink.js"
"extension/mapoverlay.js" = "azimut/extension/mapoverlay.js"
"extension/overlay.js" = "azimut/extension/overlay.js"
"extension/reverse.js" = "azimut/extension/reverse.js"
"extension/popup.html" = "azimut/extension/popup.html"
"extension/popup.js" = "azimut/extension/popup.js"
"extension/options.html" = "azimut/extension/options.html"
"extension/options.js" = "azimut/extension/options.js"
"extension/ui.css" = "azimut/extension/ui.css"
"extension/icons" = "azimut/extension/icons"
"extension/README.md" = "azimut/extension/README.md"

[tool.pytest.ini_options]
testpaths = ["tests"]
asyncio_mode = "auto"
# Print every thread's stack when one test runs longer than this, using the
# stdlib's own faulthandler rather than a plugin. A test that hangs on a runner
# we don't have takes the job's whole budget and is then killed with no name
# attached: the shard reports a percentage and nothing else. This turns that
# into a traceback. Well above the slowest test the suite has (`jobwait.WAIT`
# is 60), so a healthy run never prints.
faulthandler_timeout = 180

[tool.ruff]
# Match the codebase's existing wrap. Default rule set (E/F/W) only — this is a
# bug-and-hygiene gate, not a formatter, so nothing here reflows working code.
line-length = 100
target-version = "py311"

[tool.mypy]
# Every Python file the repo ships or runs, not only the package: `packaging/entry.py`
# is the script PyInstaller analyses, so it is *inside* all three binaries, and it was
# checked by nothing. `scripts/` is the release and development tooling. Tests stay out
# — they are checked by running them.
files = ["src/azimut", "scripts", "packaging"]
# yt-dlp, gallery-dl and cv2 ship no type stubs; don't fail on their absence.
# No python_version pin: mypy runs under the CI interpreter (3.12+), and numpy's
# 2.x stubs use 3.12 syntax that a 3.11 target can't parse. The 3.11 floor stays
# guaranteed by the pytest matrix, not the type-checker.
ignore_missing_imports = true