Skip to content
AtlasDocs
Sign inGet started
Updated Aug 04, 2026

PyInstaller Example

PyInstaller bundles the interpreter, the atlas/ package, and Atlas.dll into one .exe. Ships as-is on a Windows machine - no installer step, no sidecar.

Prereqs

  • Python 3.9+ x64. 32-bit Python can't load Atlas.dll.
  • pip install pyinstaller
  • The SDK folder from the repo.

One-shot build

The Console Example ships a build_exe.bat wrapper around pyinstaller build_exe.spec with the right flags. From Console Example/:

Terminal
# Console Example ships build_exe.bat - a thin wrapper around
# pyinstaller build_exe.spec with the right flags. From Console Example/:
$ pip install pyinstaller
$ build_exe.bat

The exact output path is set by the bat's --distpath flag. The single file is Atlas Auth Example (Python).exe.

The spec - what it does

binaries=[(Atlas.dll, '.')] pulls the DLL into the bundle root. At launch the .exe unpacks to a temp _MEIxxx folder; atlas/_ffi.py probes there first, so the DLL is found without any ATLAS_DLL_PATH override.

Python
# build_exe.spec - bundles Atlas.dll INSIDE the .exe
# (single-file distribution; no sidecar to lose)
a = Analysis(
['Atlas Auth Example.py'],
pathex=[str(SDK_DIR)],
binaries=[
# (source, destination-inside-bundle)
(str(SDK_DIR / "Atlas.dll"), '.'),
],
hiddenimports=['atlas', 'atlas._ffi'],
)
exe = EXE(pyz, a.scripts, a.binaries, a.datas, [],
name='Atlas Auth Example (Python)',
console=True,
)

The spec file's comment notes the trade-off: bundling the DLL means rev'ing the DLL requires rebuilding the .exe. To ship the DLL alongside instead, drop the binaries entry and copy Atlas.dll next to the .exe manually.

If you package it differently

Third-party packagers (Nuitka, py2exe, etc.) aren't in the example. The ATLAS_DLL_PATH env override is the universal fallback - set it before import atlas:

Python
# If Atlas.dll lives somewhere else (rare), pin it before importing:
import os
os.environ["ATLAS_DLL_PATH"] = r"C:\path\to\Atlas.dll"
import atlas
atlas.Startup()

After it builds

Whitelist the hash of the resulting .exe, not python.exe. See Executable Hash Whitelist.