Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Conda Installer #6604

Merged
merged 66 commits into from
Aug 20, 2024
Merged

Conversation

deeleeramone
Copy link
Contributor

@deeleeramone deeleeramone commented Aug 1, 2024

Replacement for #6593

This PR adds more launch scripts, and makes the requirements.txt evergreen by removing all versions and scoping only to Platform + Jupyter Notebook.

Environment ships with fully-loaded, and isolated, Python 3.12 environment within a dedicated Conda installation.

From the main README.md file:

OpenBB Platform

Thanks for installing the OpenBB Platform. To get the most out of your experience, we recommend reviewing the contents of this document.

If you have never used Python before, don't worry, your first time is just a double-click away. The sections below outline everything you need to know for getting started.

What Did I Install?

This is a kitted out development container for Pythonic, open source, financial research. It has everything you need to get started immediately.

Included, is a complete installation of the OpenBB Platform and CLI, along with Conda and Jupyter Notebook, in an isolated Python 3.12 Conda environment.

If you already have an installation of Conda or Anaconda, the version in this folder will not rely on, interfere, or share base environment paths with, existing versions.

Tools for managing, updating, and building environments allow you to take full control of your installation, as well as quickly spin up new containers within this project folder.

To get started using right away, open one of the shortcuts described below.

If you want to build your own end points, connections, and features, try installing the example extensions

Shortcuts

At the root of the installation folder (where this document is) are shortcuts for launchers and to key file locations.

  • Bash (Windows: CMD): Opens a command line shell with the base Conda environment activated. Activate the OpenBB environment with:
    • Mac/Linux: source activate obb
    • Windows: conda activate obb
  • Environments: Shortcut to the root "envs" folder, where the obb and any created environments are stored.
    • "widgets.json" is located in the "assets" subdirectory.
  • openbb-api: Opens a Terminal window and launches the OpenBB API, with optional prompts to login with your OpenBB Hub PAT.
  • openbb-cli: Opens a Terminal window and launches the OpenBB CLI (formerly OpenBB Terminal).
  • openbb-ipython: Opens a Terminal window and starts an IPython session with the OpenBB Platform package imported.
  • openbb-notebook: Opens a Terminal window, starts the Jupyter development server, and opens a browser window with the Notebook application.
  • OpenBBUserData: Shortcut to the OpenBBUserData folder. Files exported from CLI are saved here.
  • Settings: Shortcut to the ~/.openbb_platform location where .env files and user_settings.json are stored.
    • If you cannot see the ".env" file, set Finder/Explorer to display hidden/system files.
  • Update: Opens a Terminal window and updates the OpenBB Platform environment (obb) and packages.

Command Line Entry Points

There are several command line entry points available when either:

  • The OpenBB Platform environment (obb) is active.
  • The "openbb_platform" package has been installed in the active Python environment, including when --no-deps or --only-root flags were used to install.

OpenBB Entry Points

  • openbb: Launches the OpenBB CLI.
  • openbb-api: Launches the API and accepts select arguments.
    • All args/kwargs available to uvicorn run are exposed.
    • --login: True/False. Defeats the login prompt when False.
    • --no-build: Skips building "widgets.json"
    • To launch the API with no input prompts enter: `openbb-api --login False --no-build
  • openbb-build: Runs the build script that generates the static assets for the OpenBB Pythobn interface.
    • Run this after installing/uninstalling/updating OpenBB extensions
    • Automatically run when openbb-update is run.
  • openbb-update: Updates the environment packages defined in pyproject.toml and poetry.lock and rebuilds the OpenBB Python interface.
    • Location: "/extensions/openbb_platform"
    • Passes all args/kwargs to poetry install.

Installed Folder Structure

At the root of the installation (where this document is), there will be two folders:

  • conda (Windows: This is named after the last folder path if the default was not used)
  • extensions

Conda

This is the folder where Conda is installed and all environment data (site-packages, etc.) is stored. The "Environments" shortcuts takes you to the root of the "envs" folder.

Extensions

This folder contains two subfolders:

examples

Contains empty example extensions for the three types of OpenBB Platform extensions:

  • Router
  • Provider
  • OBBject

To install all three examples in the OpenBB Platform environment, open the Bash/CMD shortcut and enter:

source activate obb  # CMD: conda activate obb
cd extensions/examples
python install_examples.py

openbb_platform

This is a meta package for installing and managing OpenBB Platform installation within any Python environment.
Poetry is used to update and resolve any dependencies that are defined in the pyproject.toml file.

The poetry.lock file is updated every time the Update shortcut is run.

There are several configurations available, via combinations of --with, --without, and --only parameters, when running poetry install.

Choices are:

  • main
  • openbb-all
  • cli
  • notebook

Each parameter will accept multiple items, but --without takes priority for solving for the environment.

Uninstallation

Mac/Linux users can uninstall by deleting the folder, while Windows users can run the Uninstall shortcut.

The leftover artifacts will include:

  • Global configuration files stored by Poetry, PIP, Conda, and Jupyter.
  • Third-party Python package caches and .env files.
  • Folders:
    • ~/.openbb_platform
    • ~/OpenBBUserData

Windows users will also need to remove the parent folder where it was originally installed, after running Uninstall.

Your OpenBB Hub account can be deleted, along with all associated data, from the Account page in my.openbb.co

Additional Information

Conda Install vs. PIP Install vs. Poetry Install

The three ways to install packages may appear to accomplish the same objectives - installing Python packages - but each has a distinctly different purpose.

An easy way to think about the difference is, both pip and poetry require an existing Python installation; conda installs Python so that you can run pip install poetry.

In general, you use:

  • conda
    • When a new environment has been created. Packages here can be included in the creation command, conda create.
    • When the specific package is only distributed through Conda or the conda-forge channel.
    • When changing the version of Python used within the environment.
  • pip
    • When installing/uninstalling packages to the activated Python environment.
    • Resort to conda install only if packages fail to install or wheels cannot be built.
  • poetry
    • Installing a local Python package.
    • Syncing all package dependencies according to provided specs in pyproject.toml and poetry.lock files.
    • Building and distributing Python packages.

Conda is for container management, Poetry resolves the project's dependencies and provides build/distribution tools, while pip is for installing from PyPI

Documentation Resources

OpenBB

External

@github-actions github-actions bot added the v4 PRs for v4 label Aug 5, 2024
@piiq
Copy link
Contributor

piiq commented Aug 6, 2024

Is this a replacement for #6587 ?

If not - please update the target branch so that it's easier to review and we can merge it

@deeleeramone deeleeramone changed the base branch from develop to feature/conda-distribution August 7, 2024 00:48
deeleeramone and others added 27 commits August 9, 2024 11:26
#6626)

* fix Pandas FutureWarning in derivatives.futures.curve

* black
… Mandatory (#6625)

* add validators to enforce mandatory symbols in providers where required

* linter

* fmp 3.9 test cassette

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>
Copy link
Contributor

@piiq piiq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've went through this PR with @deeleeramone and identified a few spots where some improvements should be made. We agreed to merge this PR into the target branch and work on those improvements in the target

@piiq piiq merged commit 900d3cb into feature/conda-distribution Aug 20, 2024
5 checks passed
@piiq piiq deleted the feature/conda-installer branch August 20, 2024 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement platform OpenBB Platform v4 PRs for v4
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants