Skip to content

Commit 588627c

Browse files
Build zipline-ai with Commands "zipline compile" and "zipline run" (#161)
## Summary Creates console command "zipline" with subcommands "compile" and "run". This change refactors run.py from argparse to click so both can be commands for a click group. This change also updates the pypi package name to zipline-ai. ## Checklist - [ ] Added Unit Tests - [ x] Covered by existing CI - [ x] Integration tested - [ ] Documentation update <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes - **New Features** - Introduced a new command-line interface (CLI) using the `click` library. - Added `zipline` command group with `extract_and_convert` and `run_main` commands. - **Improvements** - Enhanced command-line argument parsing and handling. - Updated package metadata and versioning. - Expanded supported Spark versions. - **Package Changes** - Renamed package from "chronon-ai" to "zipline-ai". - Updated package description and version. - **Breaking Changes** - Modified command-line argument structure. - Replaced `argparse` with `click` library for argument management. - **Dependency Updates** - Added multiple new dependencies, including `google-cloud-storage`. - Removed several dependencies related to Google Cloud services from development requirements. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- - To see the specific tasks where the Asana app for GitHub is being used, see below: - https://app.asana.com/0/0/1209001371150237 --------- Co-authored-by: tchow <[email protected]>
1 parent 521e67c commit 588627c

File tree

9 files changed

+329
-408
lines changed

9 files changed

+329
-408
lines changed

api/py/ai/chronon/repo/compile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def get_folder_name_from_class_name(class_name):
4444
return {v.__name__: k for k, v in FOLDER_NAME_TO_CLASS.items()}[class_name]
4545

4646

47-
@click.command()
47+
@click.command(name='compile')
4848
@click.option(
4949
"--chronon_root",
5050
envvar="CHRONON_ROOT",

api/py/ai/chronon/repo/run.py

Lines changed: 122 additions & 159 deletions
Large diffs are not rendered by default.

api/py/ai/chronon/repo/zipline.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import click
2+
3+
from ai.chronon.repo.compile import extract_and_convert
4+
from ai.chronon.repo.run import main as run_main
5+
6+
7+
@click.group()
8+
def zipline():
9+
pass
10+
11+
12+
zipline.add_command(extract_and_convert)
13+
zipline.add_command(run_main)

api/py/requirements/base.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
click
22
thrift==0.21.0
3+
google-cloud-storage==2.19.0

api/py/requirements/base.txt

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,61 @@
1-
# SHA1:e6acf05ccde0547fea15f1185172abe12ea24af2
1+
# SHA1:fe8b0a1dc101ff0b0ffa9a959160d459b7f7d0e3
22
#
33
# This file is autogenerated by pip-compile-multi
44
# To update, run:
55
#
66
# pip-compile-multi
77
#
8+
cachetools==5.5.0
9+
# via google-auth
10+
charset-normalizer==3.4.1
11+
# via requests
812
click==8.1.8
913
# via -r requirements/base.in
14+
google-api-core==2.24.0
15+
# via
16+
# google-cloud-core
17+
# google-cloud-storage
18+
google-auth==2.37.0
19+
# via
20+
# google-api-core
21+
# google-cloud-core
22+
# google-cloud-storage
23+
google-cloud-core==2.4.1
24+
# via google-cloud-storage
25+
google-cloud-storage==2.19.0
26+
# via -r requirements/base.in
27+
google-crc32c==1.6.0
28+
# via
29+
# google-cloud-storage
30+
# google-resumable-media
31+
google-resumable-media==2.7.2
32+
# via google-cloud-storage
33+
googleapis-common-protos==1.66.0
34+
# via google-api-core
35+
idna==3.10
36+
# via requests
37+
proto-plus==1.25.0
38+
# via google-api-core
39+
protobuf==5.29.3
40+
# via
41+
# google-api-core
42+
# googleapis-common-protos
43+
# proto-plus
44+
pyasn1==0.6.1
45+
# via
46+
# pyasn1-modules
47+
# rsa
48+
pyasn1-modules==0.4.1
49+
# via google-auth
50+
requests==2.32.3
51+
# via
52+
# google-api-core
53+
# google-cloud-storage
54+
rsa==4.9
55+
# via google-auth
1056
six==1.17.0
1157
# via thrift
1258
thrift==0.21.0
1359
# via -r requirements/base.in
60+
urllib3==2.3.0
61+
# via requests

api/py/requirements/dev.in

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,4 @@ pre-commit
66
isort
77
autoflake
88
zipp==3.19.1
9-
importlib-metadata==8.4.0
10-
google-cloud-storage==2.19.0
11-
9+
importlib-metadata==8.4.0

api/py/requirements/dev.txt

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SHA1:06b28bca353cb7f65a2a3712ef7c6deaeb35f0bb
1+
# SHA1:fb02b7333620d08e6d72ffb575b99015aee7c274
22
#
33
# This file is autogenerated by pip-compile-multi
44
# To update, run:
@@ -10,16 +10,10 @@ autoflake==2.3.1
1010
# via -r requirements/dev.in
1111
black==24.10.0
1212
# via -r requirements/dev.in
13-
cachetools==5.5.0
14-
# via
15-
# google-auth
16-
# tox
1713
cfgv==3.4.0
1814
# via pre-commit
1915
chardet==5.2.0
2016
# via tox
21-
charset-normalizer==3.4.1
22-
# via requests
2317
colorama==0.4.6
2418
# via tox
2519
coverage[toml]==7.6.10
@@ -30,31 +24,8 @@ filelock==3.16.1
3024
# via
3125
# tox
3226
# virtualenv
33-
google-api-core==2.24.0
34-
# via
35-
# google-cloud-core
36-
# google-cloud-storage
37-
google-auth==2.37.0
38-
# via
39-
# google-api-core
40-
# google-cloud-core
41-
# google-cloud-storage
42-
google-cloud-core==2.4.1
43-
# via google-cloud-storage
44-
google-cloud-storage==2.19.0
45-
# via -r requirements/dev.in
46-
google-crc32c==1.6.0
47-
# via
48-
# google-cloud-storage
49-
# google-resumable-media
50-
google-resumable-media==2.7.2
51-
# via google-cloud-storage
52-
googleapis-common-protos==1.66.0
53-
# via google-api-core
5427
identify==2.6.5
5528
# via pre-commit
56-
idna==3.10
57-
# via requests
5829
importlib-metadata==8.4.0
5930
# via -r requirements/dev.in
6031
iniconfig==2.0.0
@@ -84,19 +55,6 @@ pluggy==1.5.0
8455
# tox
8556
pre-commit==4.0.1
8657
# via -r requirements/dev.in
87-
proto-plus==1.25.0
88-
# via google-api-core
89-
protobuf==5.29.3
90-
# via
91-
# google-api-core
92-
# googleapis-common-protos
93-
# proto-plus
94-
pyasn1==0.6.1
95-
# via
96-
# pyasn1-modules
97-
# rsa
98-
pyasn1-modules==0.4.1
99-
# via google-auth
10058
pyflakes==3.2.0
10159
# via autoflake
10260
pyproject-api==1.8.0
@@ -107,16 +65,8 @@ pytest-cov==6.0.0
10765
# via -r requirements/dev.in
10866
pyyaml==6.0.2
10967
# via pre-commit
110-
requests==2.32.3
111-
# via
112-
# google-api-core
113-
# google-cloud-storage
114-
rsa==4.9
115-
# via google-auth
11668
tox==4.23.2
11769
# via -r requirements/dev.in
118-
urllib3==2.3.0
119-
# via requests
12070
virtualenv==20.28.1
12171
# via
12272
# pre-commit

api/py/setup.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,15 @@ def get_version():
5252
],
5353
long_description=long_description,
5454
long_description_content_type="text/markdown",
55-
scripts=['ai/chronon/repo/explore.py', 'ai/chronon/repo/compile.py', 'ai/chronon/repo/run.py'],
56-
description="Chronon python API library",
55+
entry_points={
56+
"console_scripts": [
57+
"zipline=ai.chronon.repo.zipline:zipline",
58+
]
59+
},
60+
description="Zipline python API library",
5761
include_package_data=True,
5862
install_requires=basic_requirements,
59-
name="chronon-ai",
63+
name="zipline-ai",
6064
packages=find_packages(),
6165
extras_require={
6266
# Extra requirement to have access to cli commands in python2 environments.

0 commit comments

Comments
 (0)