Skip to content

Commit

Permalink
Add an option to create a venv for use in pycharm.
Browse files Browse the repository at this point in the history
  • Loading branch information
chipkent committed May 1, 2024
1 parent 26fe2d5 commit 018d8f0
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 16 deletions.
21 changes: 15 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,22 +182,31 @@ To keep your development environment clean, the script creates a virtual environ
```
4) Build a [deephaven-ib](https://github.com/deephaven-examples/deephaven-ib) virtual environment:

To install the latest production version from PyPi:
First, install the dependencies needed to run the script:
```bash
python3 -m pip install -r requirements_dhib_env.txt
```

To see all options:
```bash
python3 ./dhib_env.py --help
```

To install the latest production version from PyPi:
```bash
python3 ./dhib_env.py release
```

To build the latest development version from source:
To install the latest development version from source:
```bash
python3 -m pip install -r requirements_dhib_env.txt
python3 ./dhib_env.py dev
```
To see all options:

To create a venv for developing [deephaven-ib](https://github.com/deephaven-examples/deephaven-ib) in PyCharm: (This will not install deephaven-ib.)
```bash
python3 ./dhib_env.py --help
python3 ./dhib_env.py dev --install_dhib false
```

5) In the logs, take note of where the virtual environment was created. It will be in a directory like `./venv-<versiondetails>`.

### Activate the Virtual Environment
Expand Down
22 changes: 12 additions & 10 deletions dhib_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,8 @@ def cli():
@click.option('--ib_version', default=IB_VERSION_DEFAULT, help='The version of ibapi.')
@click.option('--dh_ib_version', default=None, help='The version of deephaven-ib.')
@click.option('--delete_venv', default=False, help='Whether to delete the virtual environment if it already exists.')
def dev(python: str, dh_version: str, dh_version_exact: str, ib_version: str, dh_ib_version: Optional[str], delete_venv: bool):
@click.option('--install_dhib', default=True, help='Whether to install deephaven-ib. If set to false, the resulting venv can be used to develop deephaven-ib in PyCharm or other development environments.')
def dev(python: str, dh_version: str, dh_version_exact: str, ib_version: str, dh_ib_version: Optional[str], delete_venv: bool, install_dhib: bool):
"""Create a development environment."""
logging.warning(f"Creating development environment: python={python} dh_version={dh_version}, dh_version_exact={dh_version_exact}, ib_version={ib_version}, dh_ib_version={dh_ib_version}, delete_vm_if_exists={delete_venv}")

Expand Down Expand Up @@ -401,15 +402,16 @@ def dev(python: str, dh_version: str, dh_version_exact: str, ib_version: str, dh

v.pip_install("deephaven-server", dh_version_pip)

if use_dev:
logging.warning(f"Building deephaven-ib from source: {dh_ib_version}")
dh_ib_wheel = DhIbWheel(dh_ib_version, dh_version, ib_version)
dh_ib_wheel.build(v)
dh_ib_wheel.install(v)
else:
logging.warning(f"Installing deephaven-ib from PyPI: {dh_ib_version}")
logging.warning(f"*** INSTALLED deephaven-ib MAY BE INCONSISTENT WITH INSTALLED DEPENDENCIES ***")
v.pip_install("deephaven-ib", f"=={dh_ib_version}")
if install_dhib:
if use_dev:
logging.warning(f"Building deephaven-ib from source: {dh_ib_version}")
dh_ib_wheel = DhIbWheel(dh_ib_version, dh_version, ib_version)
dh_ib_wheel.build(v)
dh_ib_wheel.install(v)
else:
logging.warning(f"Installing deephaven-ib from PyPI: {dh_ib_version}")
logging.warning(f"*** INSTALLED deephaven-ib MAY BE INCONSISTENT WITH INSTALLED DEPENDENCIES ***")
v.pip_install("deephaven-ib", f"=={dh_ib_version}")

success(v)

Expand Down

0 comments on commit 018d8f0

Please sign in to comment.