-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Streamline and simplify the IB artifact building.
- Loading branch information
Showing
5 changed files
with
96 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
.idea | ||
venv | ||
build | ||
dist | ||
src/deephaven_ib.egg-info | ||
docker/data | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Interactive Brokers Python Wheels Builder | ||
|
||
This directory provides a Docker Compose setup for building Python wheels for the Interactive Brokers API. | ||
|
||
## Requirements | ||
|
||
- Docker | ||
- Docker Compose | ||
|
||
## Usage | ||
|
||
1. Set the `IB_VERSION` environment variable to the version of Interactive Brokers' API you want to use. | ||
2. Run `docker compose up` from the directory containing the Docker Compose file. This will build the wheels. | ||
3. After the build process is complete, the wheels will be available in the `./dist` directory. | ||
4. To install the wheels, run `pip install ./dist/*.whl`. | ||
|
||
> **Note:** Steps 1 and 2 can be combined as `IB_VERSION=10.19.04 docker compose up`. | ||
## Details | ||
|
||
The build process is defined in the `build_ibpy.sh` script. | ||
The `./build` directory contains the scratch work for building the wheels. | ||
|
||
By using Docker, you can build the wheels in a clean environment that is isolated from your local machine. | ||
This setup will work on any platform that supports Docker. | ||
|
||
## Note | ||
|
||
Interactive Brokers does not make their Python wheels available via PyPI, and the wheels are not redistributable. | ||
This script lets you build the wheels locally, and then install them via pip. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env bash | ||
|
||
# This script is used to build Python wheels for the Interactive Brokers' API. | ||
|
||
|
||
# check that IB_VERSION is set | ||
if [ -z "$IB_VERSION" ]; then | ||
echo "IB_VERSION must be set" | ||
exit 1 | ||
fi | ||
|
||
# IB has a funky versioning scheme, so we need to strip out the periods in some places before download | ||
IB_VERSION_DOWNLOAD=$(echo ${IB_VERSION} | sed 's/[.]//') | ||
|
||
rm -rf ./build | ||
rm -rf ./dist | ||
|
||
mkdir ./build | ||
mkdir ./dist | ||
|
||
pushd ./build | ||
|
||
python3 -m pip install build | ||
|
||
echo "Downloading IB API version ${IB_VERSION} (${IB_VERSION_DOWNLOAD})" | ||
curl -o ./api.zip "https://interactivebrokers.github.io/downloads/twsapi_macunix.${IB_VERSION_DOWNLOAD}.zip" | ||
unzip api.zip | ||
cd ./IBJts/source/pythonclient | ||
python3 -m build --wheel | ||
popd | ||
cp ./build/IBJts/source/pythonclient/dist/* ./dist/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
|
||
# This is a Docker Compose file for building Interactive Brokers python wheels. | ||
# Ideally, the wheels would be published by IB for installation via pip, but | ||
# (1) IB does not make them available via pypi, and | ||
# (2) the wheels are not redistributable. | ||
# This script lets you build the wheels locally, and then install them via pip. | ||
# | ||
# To build the wheels, run `docker-compose up` from the directory containing this file. | ||
# To install the wheels, run `pip install ./dist/*.whl`. | ||
# After running the script, the wheels will be available in the `./dist` directory. | ||
# The `./build` directory contains the scratch work for building the wheels. | ||
# | ||
# The build process is defined in the `build_ibpy.sh` script. | ||
# | ||
# By using Docker, you can build the wheels in a clean environment that is isolated from your local machine. | ||
# It also will work on any platform that supports Docker. | ||
|
||
version: '3.8' | ||
|
||
services: | ||
build: | ||
image: python:3.10 | ||
environment: | ||
- IB_VERSION | ||
volumes: | ||
- .:/app | ||
- ./build:/build | ||
- ./dist:/dist | ||
command: /bin/bash -c "/app/build_ibpy.sh" |