Code Monkey home page Code Monkey logo

openbb-cookiecutter's Introduction

OpenBB Platform Extensions Cookiecutter

Cookiecutter is a command-line utility that creates projects from templates.

This repo hosts the Cookiecutter template for setting up a new OpenBB Platform extension. This template helps in standardizing the structure of extensions and makes the setup process more efficient.

Template Structure

The Cookiecutter template prompts the user for information and then generates a new extension project based on that information. The information includes:

  • Your Name
  • Your Email
  • Extension Name
  • Package Name (the name of the extension's Python package)

Setup

Before using the Cookiecutter, ensure that you have Python installed on your system. Then, follow these steps to set up your environment:

  1. Create a new virtual environment.

    For Linux or MacOS systems:

    python3 -m venv venv
    source venv/bin/activate

    For Windows:

    python -m venv venv
    .\venv\Scripts\activate
  2. Install Cookiecutter and Poetry:

    pip install cookiecutter poetry

Usage

  1. Generate your new project:

    cookiecutter https://github.com/OpenBB-finance/openbb-cookiecutter --checkout develop
  2. Go into the generated project directory and install the project's dependencies:

    cd <project-name>
    poetry install
  3. Import obb and use your extension:

    from package_name.openbb import obb
    
    obb.<package_name>.<command>
    exit()

    On first launch, your extension will be automatically recognized and built by the OpenBB Platform v4. If you modify your extension, you can trigger the rebuild by using this command python -c "import package_name; package_name.build()"

    If your extension requires an API key you can pass it by doing the following:

    obb.user.credentials.<package_name>_<key_name> = <key_value>
  4. To launch the API, run:

    uvicorn openbb_core.api.rest_api:app --host 0.0.0.0 --port 8000 --reload

    Go to http://localhost:8000/docs to view the API documentation.

    In order to use any of the endpoints available, you'll need to get a valid authorization. You can do it in one of the following ways:

    • Using your OpenBB Hub account
    • Use the default user: openbb and password: openbb

Remember to deactivate the virtual environment when you're finished by running deactivate in your terminal.

Contributing

We welcome contributions to this template! Please feel free to open an issue or submit a pull request with your improvements.

Contacts

If you have any questions about the cookiecutter or anything OpenBB, feel free to email us at [email protected]

If you want to say hi, or are interested in partnering with us, feel free to reach us at [email protected]

Any of our social media platforms: openbb.co/links

openbb-cookiecutter's People

Contributors

hjoaquim avatar igorwounds avatar montezdesousa avatar piiq avatar the-praxs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

westendcompute

openbb-cookiecutter's Issues

Setting api key to new Extension.

image image image image

This is the extension im building but the setting a new api key is falling
When i call the function directly before setting the key it dosent work as expected and raises the value error missing key.

When i try setting the api key as the openbb-cookiecutter sugestt i get a error, what am i missing here igor.

image

Thanks for the help,
Best,
Cober

[BUG]: Setting up API Key

I have looked over #7, but have not been able to apply the solution to my use case.

I am building openbb-orats, and this requires an api_key.

I have followed along with the template tutorial, but am not having any luck in setting an api_key.

The package name: openbb-orats
Provider Name: orats

When I run the below code, I don't see any available credentials to set? The credentials field in Provider() is uncommented.

obb.user.credentials

# Credentials

I have tried to set the key, to no avail.

from openbb_orats import obb
import openbb_orats

openbb_orats.build()

obb.user.credentials.openbb_orats_api_key = "test"
obb.user.credentials.orats_api_key = "test"

[BUG]: Clarify the `provider` object name

I am building an openbb extension with the openbb-cookiecutter template.

When I run:

> from openbb_orats import obb

I get the error:

module 'openbb_orats.provider' has no attribute 'provider'

The CONTRIBUTING GUIDELINES explain that I should put the provider in the __init__.py file, but the cookiecutter template adds a whole modules for this.

Should I put the provider in the __init__.py file or should I keep the provider module?

EXTRA INFO:

[tool.poetry.plugins."openbb_provider_extension"]
openbb_orats = "openbb_orats.provider:orats_provider"
#provider.py module

orats_provider = Provider()

When I run:

> from openbb_orats.provider import orats_provider

This executes without issue. Any help would be appreciated!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.