Skip to content

Commit 8a977d6

Browse files
seutamotl
authored andcommitted
CFR: Build as a self-contained program using PyInstaller
1 parent 2f9540f commit 8a977d6

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- MongoDB: Added adapter amalgamating PyMongo to use CrateDB as backend
88
- SQLAlchemy: Clean up and refactor SQLAlchemy polyfills
99
to `cratedb_toolkit.util.sqlalchemy`
10+
- CFR: Build as a self-contained program using PyInstaller
1011

1112
## 2024/06/18 v0.0.14
1213
- Add `ctk cfr` and `ctk wtf` diagnostics programs

cratedb_toolkit/cfr/cli.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Copyright (c) 2021-2024, Crate.io Inc.
22
# Distributed under the terms of the AGPLv3 license, see LICENSE.
33
import logging
4+
import multiprocessing
45
import sys
56

67
import click
@@ -77,3 +78,10 @@ def sys_import(ctx: click.Context, source: str):
7778
except Exception as ex:
7879
error_logger(ctx)(ex)
7980
sys.exit(1)
81+
82+
83+
if getattr(sys, "frozen", False):
84+
# https://github.com/pyinstaller/pyinstaller/issues/6368
85+
multiprocessing.freeze_support()
86+
# https://stackoverflow.com/questions/45090083/freeze-a-program-created-with-pythons-click-pacage
87+
cli(sys.argv[1:])

pyproject.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ all = [
110110
"cratedb-toolkit[full,influxdb,mongodb]",
111111
]
112112
cfr = [
113-
"pandas<3,>=1",
114-
"pyarrow<17",
113+
"pandas<2.2",
114+
"pyarrow<16.1",
115115
]
116116
cloud = [
117117
"croud==1.11.1",
@@ -167,6 +167,9 @@ release = [
167167
"build<2",
168168
"twine<6",
169169
]
170+
release-cfr = [
171+
"pyinstaller<7",
172+
]
170173
service = [
171174
"fastapi<0.112",
172175
"uvicorn<0.31",
@@ -195,6 +198,7 @@ documentation = "https://github.com/crate-workbench/cratedb-toolkit"
195198
homepage = "https://github.com/crate-workbench/cratedb-toolkit"
196199
repository = "https://github.com/crate-workbench/cratedb-toolkit"
197200
[project.scripts]
201+
cratedb-cfr = "cratedb_toolkit.cfr.cli:cli"
198202
cratedb-retention = "cratedb_toolkit.retention.cli:cli"
199203
cratedb-toolkit = "cratedb_toolkit.cli:cli"
200204
cratedb-wtf = "cratedb_toolkit.wtf.cli:cli"
@@ -355,3 +359,5 @@ release = [
355359
]
356360

357361
test = { cmd = "pytest" }
362+
363+
build-cfr = { cmd = "pyinstaller cratedb_toolkit/cfr/cli.py --onefile --name cratedb-cfr"}

0 commit comments

Comments
 (0)