Skip to content

Commit e72f2fb

Browse files
authored
create jupyter-quant meta package (#318)
* create jupyter-quant meta package - create meta-package - add pyproject.toml file - add optional dependencies - remove unnecessary compilation steps from Dockerfile * include latest updates
1 parent dab712c commit e72f2fb

File tree

6 files changed

+117
-70
lines changed

6 files changed

+117
-70
lines changed

.github/dependabot.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@ updates:
88
- package-ecosystem: "docker" # See documentation for possible values
99
directory: "/" # Location of package manifests
1010
schedule:
11-
interval: "weekly"
12-
11+
interval: "daily"
12+
time: "04:00"
1313
- package-ecosystem: "github-actions"
1414
directory: "/"
1515
schedule:
16-
interval: "weekly"
17-
16+
interval: "daily"
17+
time: "04:10"
1818
- package-ecosystem: "pip" # See documentation for possible values
1919
directory: "/" # Location of package manifests
2020
schedule:
21-
interval: "daily"
21+
interval: "daily"
22+
time: "04:20"

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@ docker-compose.yml
55
.ipynb_checkpoints/
66
.virtual_documents/
77
.DS_Store
8+
*.egg-info
9+
wheels/
10+
build/
11+
dist/

Dockerfile

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@
33
###############################################################################
44
# hadolint global ignore=DL3003,DL3008,SC2028
55
ARG IMG_PYTHON_VERSION
6-
FROM python:"${IMG_PYTHON_VERSION}" AS builder
6+
FROM python:$IMG_PYTHON_VERSION AS builder
77

88
ENV APT_PROXY_FILE=/etc/apt/apt.conf.d/01proxy
9+
ARG GH_URL_BASE=https://github.com/quantbelt/jupyter-quant/releases/download/ta-lib-0.4.0-linux
10+
ARG TALIB_FILE=ta-lib-0.4.0-linux_
11+
ARG TALIB_URL="${GH_URL_BASE}/${TALIB_FILE}"
912

10-
COPY requirements.txt /.
13+
COPY README.md LICENSE.txt pyproject.toml /
14+
COPY jupyter_quant/__init__.py /jupyter_quant/
1115

1216
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
1317
RUN if [ -n "$APT_PROXY" ]; then \
@@ -22,30 +26,30 @@ RUN if [ -n "$APT_PROXY" ]; then \
2226
apt-get clean && rm -rf /var/lib/apt/lists/* && \
2327
# # TA-Lib
2428
cd /tmp && \
25-
curl -LO https://github.com/quantbelt/jupyter-quant/releases/download/ta-lib-0.4.0-linux/ta-lib-0.4.0-linux_"$(uname -m)".tgz && \
26-
curl -LO https://github.com/quantbelt/jupyter-quant/releases/download/ta-lib-0.4.0-linux/ta-lib-0.4.0-linux_"$(uname -m)".tgz.sha256 && \
27-
sha256sum -c ta-lib-0.4.0-linux_"$(uname -m)".tgz.sha256 && \
28-
cd / && tar xzf /tmp/ta-lib-0.4.0-linux_"$(uname -m)".tgz && \
29+
curl -LO "${TALIB_URL}$(uname -m).tgz" && \
30+
curl -LO "${TALIB_URL}$(uname -m).tgz.sha256" && \
31+
sha256sum -c "${TALIB_FILE}$(uname -m).tgz.sha256" && \
32+
cd / && tar xzf "/tmp/${TALIB_FILE}$(uname -m).tgz" && \
2933
export PREFIX=/usr/local/ta-lib && \
3034
export TA_LIBRARY_PATH="$PREFIX/lib" && \
3135
export TA_INCLUDE_PATH="$PREFIX/include" && \
3236
# end TA-Lib
33-
pip wheel --no-cache-dir --wheel-dir /wheels -r /requirements.txt
37+
pip wheel --no-cache-dir --wheel-dir /wheels .
3438

3539
###############################################################################
3640
# Final stage
3741
###############################################################################
3842
ARG IMG_PYTHON_VERSION
39-
FROM python:"${IMG_PYTHON_VERSION}"-slim
43+
FROM python:${IMG_PYTHON_VERSION}-slim
4044

4145
ENV APT_PROXY_FILE=/etc/apt/apt.conf.d/01proxy
4246

4347
ENV USER="${USER:-gordon}"
4448
ARG USER_ID="${USER_ID:-1000}"
4549
ARG USER_GID="${USER_GID:-1000}"
46-
ENV PYTHONDONTWRITEBYTECODE 1
47-
ENV PYTHONUNBUFFERED 1
48-
ENV PIP_USER true
50+
ENV PYTHONDONTWRITEBYTECODE=1
51+
ENV PYTHONUNBUFFERED=1
52+
ENV PIP_USER=true
4953
ENV PATH="$PATH:/home/$USER/.local/bin"
5054

5155
# base data directory
@@ -100,11 +104,10 @@ USER $USER_ID:$USER_GID
100104

101105
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
102106
RUN --mount=type=bind,from=builder,source=/wheels,target=/wheels \
103-
pip install --user --no-cache-dir /wheels/* && \
107+
pip install --user --no-deps --compile --no-cache-dir /wheels/* && \
104108
# Import matplotlib the first time to build the font cache.
105109
MPLBACKEND=Agg python -c "import matplotlib.pyplot" && \
106-
mkdir "${JUPYTER_SERVER_ROOT}" && \
107-
python -c "import compileall; compileall.compile_dir('${BASE_DATA}/lib/python$(echo "$PYTHON_VERSION" | cut -d '.' -f1,2)/site-packages', force=True)"
110+
mkdir "${JUPYTER_SERVER_ROOT}"
108111

109112
COPY entrypoint.sh /
110113
WORKDIR ${JUPYTER_SERVER_ROOT}

jupyter_quant/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"""Jupyter quant, a dockerized quant research environment."""
2+
3+
__version__="2409.02"

pyproject.toml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
[build-system]
2+
requires = ["setuptools>=61.0"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "jupyter-quant"
7+
dynamic = ["version"]
8+
authors = [{ name = "gnzsnz" }]
9+
description = "Jupyter quant research environment. "
10+
readme = "README.md"
11+
requires-python = ">=3.10"
12+
license = { file = "LICENSE.txt" }
13+
classifiers = [
14+
"Programming Language :: Python :: 3",
15+
"License :: OSI Approved :: Apache Software License",
16+
"Operating System :: OS Independent",
17+
"Development Status :: 3 - Alpha",
18+
]
19+
dependencies = [
20+
"alphalens-reloaded==0.4.5",
21+
"arch==7.1.0",
22+
"black==24.8.0",
23+
"bottleneck==1.4.0",
24+
"dask[dataframe,distributed]==2024.9.0",
25+
"empyrical-reloaded==0.5.10",
26+
"exchange_calendars==4.5.6",
27+
"h5py==3.11.0",
28+
"hurst==0.0.5",
29+
"ib-fundamental==0.0.5",
30+
"ib_async==1.0.3",
31+
"ipympl==0.9.4",
32+
"ipywidgets==8.1.5",
33+
"isort==5.13.2",
34+
"jedi-language-server==0.41.4",
35+
"jupyterlab==4.2.5",
36+
"jupyterlab-lsp==5.1.0",
37+
"jupyterlab_code_formatter==3.0.2",
38+
"jupyterlab_widgets==3.0.13",
39+
"lightgbm==4.5.0",
40+
"matplotlib==3.9.2",
41+
"numba==0.60.0",
42+
"numexpr==2.10.1",
43+
"numpy==1.26.4",
44+
"optuna==4.0.0",
45+
"pandas==2.2.3",
46+
"patsy==0.5.6",
47+
"pip==24.2",
48+
"py_vollib==1.0.1",
49+
"py_vollib_vectorized==0.1.1",
50+
"pyarrow==17.0.0",
51+
"pyfolio-reloaded==0.9.8",
52+
"pykalman==0.9.7",
53+
"PyPortfolioOpt==1.5.5",
54+
"quantstats-lumi==0.3.3",
55+
"scikit-learn==1.5.2",
56+
"scipy==1.14.1",
57+
"sdepy==1.2.0",
58+
"seaborn==0.13.2",
59+
"shap==0.46.0",
60+
"statsmodels==0.14.3",
61+
"TA-Lib==0.4.32",
62+
"tzdata==2024.2",
63+
"yellowbrick==1.5",
64+
"yfinance==0.2.43",
65+
"zipline-reloaded==3.0.4",
66+
]
67+
68+
[project.optional-dependencies]
69+
sk-util = ["skfolio==0.4.0", "sktime==0.33.0"]
70+
bayes = [
71+
"arviz==0.19.0",
72+
"bambi==0.14.0",
73+
"pymc==5.16.2",
74+
"formulae==0.5.4",
75+
"graphviz==0.20.3",
76+
]
77+
dev = ["pre-commit>=3.7.1", "build", "wheel"]
78+
79+
[project.urls]
80+
"Homepage" = "https://github.com/quantbelt/jupyter-quant"
81+
"Bug Tracker" = "https://github.com/quantbelt/jupyter-quant/issues"
82+
83+
[tool.setuptools]
84+
packages = ["jupyter_quant"]
85+
86+
[tool.setuptools.dynamic]
87+
version = {attr = "jupyter_quant.__version__"}

requirements.txt

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)