quantstats
quantstats copied to clipboard
Added theming
This is a rather large change in terms of the amount of code affected owing to it proving rather difficult to add this feature into things in a reasonable manner. The following changes have been made:
- collect all plotting functions in a single class, where
theme
is defined at instantiation - all uses of the
grayscale
keyword have been either replaced withtheme
or removed as appropriate - the
options
keyword has been removed fromqs.html()
- as well, the
download_filename
keyword has been replaces withhtml_filename
- type hinting was added to all code touched
- all non-conventional import statements have been made conventional
- the 'Known Issues' segment of the
README
has been removed as the issue is no longer present
To use theming, a the current default
and grayscale
themes have been provided in _plotting/themes.py
. Any user-defined theme can be be created by following the dictionary structure provided, noting that all keys must be present or the behavior
is to fallback to default
Not sure why you had to rename the imports. The _
prefix was there to indicate that this is a dependency module. Otherwise - I like the idea of using themes but cannot approve the PR as it.
Can you create a new PR with only the theming option and without any backward compatibility-breaking changes?
Hello!
The renaming was because underscore hiding all the module names is very unusual, and was making the code more difficult to read IMHO. As for adding this without the non-breaking changes, short answer is not really. The issue is that the functions as-is are set up in a manner that is not terribly amenable to a (consistent) theming scheme, as can be seen from how the grayscale
value is used over and over with varying if-then statements throughout. Putting the theme definition into a (rough) class as I have has fixed this issue, but forces the changes to the function signatures as I've done in core.py
and wrappers.py
; the user-level use of everything remains unchanged in terms of what functions are called and how the module is organized, while only the function signatures have changed.
I could, however, include deprecation warnings in said functions; that would be possible and reasonable.