Commit Graph

5 Commits

Author SHA1 Message Date
teh_coderer
8a70c6205d Feature/ Pywry login (#5115)
* Update .gitignore

* init

* Update backend.py

* Update main.tsx

* Update no_import.py

* Update session_controller.py

* indents

* adjust window size

* update keys

* re-add save session for pywry login

* pop response keys on rename

* walrus remember

* use session username for profile

* implement logout clearing of cookies

* don't display welcome when logging in from `account` menu

* Update session_model.py

* Update session_model.py

* customdata handler for charts

* fix remember key

* only slice data if chandlestick trace in data

* Update profile_model.py

* Update streamlit_run.py

* Update plotly.html

* test

* Update loggers.py

* updates

* Update session_controller.py

* Update session_controller.py

* no longer need to call_hub for logout

* tests

* Update test_session_controller.py

* Update profile_model.py

* bump pywry, fix numbers passed as strings tables

* update plotly frontend packages

* formatting

* Update backend.py

* Update backend.py

* change to prod

* return on image export

---------

Co-authored-by: James Maslek <jmaslek11@gmail.com>
2023-06-20 17:47:38 +00:00
montezdesousa
b6b42afd71 Hub | Add colors, sources sync (#4546)
* fix show version

* update login prompt and account

* update set preference

* fix account controller

* block login/logout if not called from account

* change conditions to start terminal

* fix required args account model

* add not to login command

* pylint

* accounte controller messages

* set default user when logout

* logout then show menu

* remove unused functions

* fix logging bug

* ruff

* fix account unittests

* fix session unittests

* refactor colors preference

* no theme, no party

* add colors sync

* dynamic theme

* add comment

* add colors to settings

* ruff

* linting

* update menu desc

* adjust keys sync flag

* write to dotenv sync flag

* english

* fix pull command

* fix edge cases

* handle some errors

* small bug

* change func name

* pylint

* no light

* colors preview

* ruff

* fix login logout preferences

* ruff

* delete folder

* pylint

* default, custom, hub

* fix clear

* docstring

* add preference exceptions

* set only rich style

* request theme only if hub

* linting

* change guest msg

* add option to update chart style on the fly

* apply style

* rollback to old terminal style

* fix console theme

* remove print

* remove hub rich style

* ruff

* mypy

* black

* Hub | Add sources sync (#4565)

* Add sources model

* adapt session model

* fetch sources dict

* rename local funcs

* set sources inside current user

* set sources inside current user

* generate sources dict from hub

* fix dict generator

* send request to hub

* fix conflict

* revert datasources to develop head

* fix docstring

* avoid invalid patch types

* add default option to sources

* fix small bug on sources

* ruff

* black

* remove (

* mypy failing only on git

* ignore mypy

* pylint

* fix settings controller

* Tests: fix keys model writing to .env

* fix keys controller test writing to .env

* ruff

* Test: fix account controller

* Test: fix account controller pull

* Tests: fix launch terminal

* Test: add sources to user object

* Tests: fix clear cmd tests

* ruff

* revert core/sdk changes

* TerminalStyle docstring

* upload config docstring

* remove comment

* remove unecessary pylint disable

* revert openbb_terminal/sdk changes

* Terminal style docstring

* docstring

* remove unecessary changes

* add TODO

* add other todo

* Tests: prevent sync from being written in .env

* change clear msg

* display sources source on menu

* update settings controller

* display keys source

* black

* sync not needed for pull

* remove sync from apply configs

* change func name for consistency

* Update test_keys_model.py

* save rich style in user folder

* search recursively inside styles

* set hub theme by default

* remove debug print

* allow any plot style

* comment plotstyle sync for now

* fix sources set terminal to hub

* ruff

* rewrite cassettes

* remove repeated settings

* rewrite expected
2023-03-27 16:59:36 +00:00
montezdesousa
475ebb5acd [WIP] Migrate user, feature flags and configurations to dataclass (#4309)
* implement user and change is guest

* replace User methods

* move remaining functions to user

* fix bug

* portfolio test

* fix tests

* fix tests

* uncomment skip

* ruff

* start credentials model implementation

* change deault structure

* refacto quandl

* change default struct and file names

* bug

* start using global user

* add comments

* move update flair

* change cfg references in keys model

* reddit & fmp

* refactore additional keys

* remaing config keys

* remove unsude imports and fix hub keys

* ruff

* fix line too long

* unblock unittests

* fix keys model tests

* remove os patch

* fix account controller tests

* fix account controller tests

* fix account model

* account fixed

* fix user tests

* User Model

* User Model

* User Model

* Move session folder

* User Model : grouping the models

* User Model : fix bugs

* Config Plot + bug fix

* User Model : Refactoring plots

* Feature flags

* Remove dup

* clean comments a fix some vars

* fix feature flags controller

* refactor obbff from settings controller

* refactor a bunch of obbff variables

* fix bug blocking terminal

* fix integration tests

* refactor controllers with obbff

* refactor remaining ffs

* remove comments

* log not started

* mispelled variable

* set current user on local model

* User Model : moving files + updating

* User Preferences

* User : Refactor is_guest function + bug fix

* User : refactor is_guest function

* Fix conftest.py

* remove lost obbffs

* typo on fileoverwrite

* Plot config: move variables and start plot dpi

* User : tests

* refactor plot dpi references

* remove plot dpi imports

* refactor some config terminal leftover

* /account/sync : fix bug

* remove configs reload

* start path refactor

* installation paths vs user paths

* remove cfg_plot

* Tests : User Refactoring

* user prefix only for preferences

* user prefix only for preferences

* move user paths

* remove comment

* update apply remote configs

* fix tz not updating

* save some copys

* small fix

* create interface for credentials and preferences

* wrong docstrings fixed

* ruff core

* fix some pref setting

* login is better

* ruff

* ruff

* remove Literal

* add small comment

* Tests : User Refactoring

* Credentials Model : add DataBento

* Fix helper_funcs

* Fixing code

* Tests : fixing

* User Model : freezing the models

* Fixed Income + Databento

* Tests : fixing keys

* black

* ruff

* Tests : user model

* Tests : user model

* Fix linting

* Fix linting

* Linting

* Linting

* Fixing code and tests

* Fix tests

* mypy

* SDK

* Clean ruff cache

* Fix syntax issue

* Update fred_view

* Black

* Linting

* Update code

* Update tests

* Linting

* Linting

* Tests

* Black

* Linting

* Linting

* Mock os.listdir to avoid looking for file that doesnt exist

* Mock options paths

* lint

* Tests : fix

* Code : update

* Tests + Linting

* Tests

* Ruff

* Code : update

* Tests

* Code : update

* Fix workflow

* Code : update

---------

Co-authored-by: Chavithra PARANA <chavithra@gmail.com>
Co-authored-by: luqazino@gmail.com <luqazino@gmail.com>
Co-authored-by: James Maslek <jmaslek11@gmail.com>
2023-03-05 00:37:19 +01:00
montezdesousa
825b8955df Set guest by default and put authentication behind environment variable (#4197)
* small bug

* small bug on routines list

* guest as default

* limit logout to users2

* simpler this way

* add logout

* move logout to account & add env var

* put authentication under env var

* fix tests

* remove login

* remove openbb vars on login

* ruff

* revert .toml

* Delete Icon

* Update .env

* fix sdk guest not loading keys

* ruff

* remove press enter & --login

* ruff

* move env load

* load env

* move dot env loading to terminal.py

* fix user sdk login mixing .env with user

* now it works

* fix reset

* fix tests

* ruff

* Login on the SDK using the OpenBB Personal Access Token (#4206)

* openbb key on keys menu

* adding sdk endpoints

* adding login via token to the sdk

* base url

* rename to personal access token

* added docstrings and examples

* openbb is special

* removing extra break line

* making keys working with the personal access token

* resolve conflicting tests

* Revert "resolve conflicting tests"

This reverts commit 2fca2c0ec3.

* using custom requests

* tests

* tests

* tests

* using process_session_response instead

* rewriting some tests

* Fix sdk guest not loading keys (#4207)

* fix sdk guest not loading keys

* ruff

* remove comment

* tests

---------

Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com>
Co-authored-by: Diogo Sousa <montezdesousa@gmail.com>
Co-authored-by: James Maslek <jmaslek11@gmail.com>

* test record mode vcr none

* remove yes from tests yml

* specify modules to reload

* try disable check api

* UPdate spec file

* Small stocks bug

* avoid reloading in test mode

* will this work?

* skip session tests

* try with env var as well

* mock sdk reload

* pylint

* bump poetry on python 3.8

* adapt to python 3.8

* adapt to python 3.8 remaining tests

* Tests : update cassettes

* Fix linting

* Makes login conditions simpler

* Tests : txt

---------

Co-authored-by: James Maslek <jmaslek11@gmail.com>
Co-authored-by: Chavithra <chavithra@gmail.com>
Co-authored-by: Henrique Joaquim <h.joaquim@campus.fct.unl.pt>
2023-02-14 09:56:03 +00:00
montezdesousa
5953be0a42 Terminal authentication + keys/settings/routines (#4015)
* import order

* pylint

* no login, go to prompt

* add logout and whoami

* clear before prompt

* black

* these are unecessary

* error

* improve login prompt message

* login does not follow the controller pattern, so will name it differently

* nop

* move logout and change to results

* change return obj

* ruff

* pyupgrade

* remove user from statics

* message

* fetch configs at start

* remove unecessary func

* unecessary dataclass

* change user vars

* change login flow

* remote logout should not be used

* simplify

* fix double exit logout bug

* wrong exception

* apply keys

* change controller

* mypy

* save if no internet

* pylint

* logout everywhere

* breaking changes: move to local/hub models

* unused import

* fix logout bug

* whoami in guest mode

* add todo

* small bug guest allowed

* limit flair length

* fix bug on user pull

* logout working

* handle no connection

* logout user when logout

* remove keys push

* split logger funcs

* commant apply configs for now

* account to session

* rename user

* clear sounds better

* breaking changes: splitting guest from logged users

* pull imports up

* delete session model

* move logout func

* add ability to save and apply keys from remote

* no sensitive keys

* add support for feature flags

* unecessary print

* allow settings from differnt modules

* change setff to static

* change way to set ff

* fix bug in applying configs

* simplify obbff application

* bug on setting configs

* allow text ff

* obbff in settings

* add upload to cfg_plot 1

* data sources + backend

* this solves circular import?

* move create_session to model

* rever logs changes, not needed for now

* sync optionally

* outline account controller interface

* don't sync when guest

* block guest on installer

* or not and

* start routines

* fix bug on ff, settings

* is installer

* implementing chavi suggestions

* fix colors on installer prompt

* Logging login (#4046)

* basic logging for the login

* removing unused import

* hacking the logs custom filter to not filter the email

* black

* cooping with the new changes

* removing redundant method

* ruff

* ruff

* mypy

* SDK login (#4051)

* sdk login

* adding to the trail map

* minor fix

* improve sdk expirience

* adapting to new changes

* add docstrings

* block guest from account

* change guest msg

* change guest messages

* add sync on/off

* display onoff

* missing paragraph

* fix glitch on logout

* add sys clear

* filtering password

* filtering the email from user

* avoid writing to multiple log files if a user logs out

* fix bug, guest allowed in installer without connection

* log user on the sdk

* split login from lauch

* add clear and change messages on account

* docstrings

* start pull cmd

* change account menu description

* Fix login bug and decouple some logic (#4056)

* fix bug, guest allowed in installer without connection

* split login from lauch

* improvements on the sdk login

---------

Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt>

* sync fix

* change account controller description

* ruff

* add help on account cmds

* update clear prompt

* fix email not in jwt

* remove jwt from requiremnts

* pull command output

* remove character

* pull cmd when no data

* add space below whoami

* fix log filenotfound exception

* changed arg name

* delete .hist on logout

* add asteriscs to password

* pylint

* uncomment rich config

* show only diffs on pull

* black#

* warn when no changes#

* pull msg was switched

* apply diff only

* breaking?: strbool change

* reduce some code

* add timeout to hub requests

* black

* add remote logout

* success msg only if success

* remove colors in prompt

* update docstrings

* keep timeout outside funcs

* update clear

* clear and patch

* delete session

* routine upload

* move .his file to .openbb folder

* change apply configs

* refactor logout

* remove mixed portfolio changes

* fix bug in lock file

* fix bug pwidth, pheight are floats

* fix sources command & add choices

* refactor timezone setting

* userdata

* fix flair

* need to cast paths

* cast on diff

* fix flair default

* save session test

* get session

* data

* test remove

* test remove with assert

* add bad test cases

* add exception cases to unittests

* test remove cli hist file

* black

* test apply configs

* test apply with sync flag

* test create session, session model

* login tests, session model

* some tests for the hub_model

* test logout user

* black

* test clear vars, reload

* test create session

* update user-json to user

* update user class

* add user tests

* tests sdk session

* tests for hub_model

* start account controller tsts

* unused import

* tests account controller: clear, pull

* tests for session_controller

* logout success bugfix

* add integration test for account

* black

* move routine related commands to other PR

* test for the user input

* completed tests for session controller

* convert to hist to str)

* fix import errors

* ruff

* ruff tests

* fix qa

* add help to settings cmds

* ruff

* fix pull keys bug

* point to dev

* account model tests

* black

* ruff

* fix for empty feature settings

* ruff

* don't display config msg if wrong token

* general msgs

* remove print

* ruff

* fix sources not updated real time

* missing return doc

* add guest if no email

* Routine remote storage (#4143)

* add upload routine command

* remove prints

* point to local again

* add commands

* add delete

* add download command and upload 409

* list comprehension

* add download & save plus upload fixe

* add user uuid folder

* add list command

* ruff

* en.yml detail

* provide choices to delete & download

* add choices to upload

* change menu text

* starting adding unit tests

* bad english

* Update test_print_help.txt

* genearl msgs

* remove print

* add docstrings

* add unit tests to account controller

* change parser

* fix routine upload test

* add to be implemented tests hub

* add to be implemented tests local

* add total pages to title

* split list into model and view

* add docstring

* print msg if character

* add local model tests

* hub tests routines

* fix test

* point to dev and glob

* fix small bug on upload

* missing return

* log decorators missing

* black

* ruff

* change prompt display

* rewrite test

* rewrite expected

* rewrite call

* try passing git action

* change .yml everywhere

---------

Co-authored-by: Henrique Joaquim <h.joaquim@campus.fct.unl.pt>
Co-authored-by: James Maslek <jmaslek11@gmail.com>
2023-02-09 13:35:44 +00:00