-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- New Features - Command line tools for printing default Jinja and CSS files - Fixes - Config YAML now read with safe loader - Deprecations - Removed CDN theme links - Dependencies - Image content now supported without PIL
- Loading branch information
Showing
43 changed files
with
891 additions
and
685 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,3 +23,4 @@ exclude_lines = | |
ignore_errors = True | ||
omit = | ||
tests/* | ||
_cli.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# Scratch files for testing | ||
/scratch | ||
*scratch*.ipynb | ||
*scratch*.py | ||
image.jpg | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# Output Options | ||
|
||
## CSS and Jinja | ||
|
||
Customising the look and feel of **esparto** pages is best achieved through | ||
modifying or replacing the Jinja template and CSS style sheets. | ||
Alternatively, CSS and Jinja sources can be passed to `es.options` as global | ||
defaults, or passed to the `es.Page` constructor using the `es.OutputOptions` class. | ||
|
||
```python | ||
# Updating global defaults. | ||
es.options.esparto_css = "./esparto.css" | ||
es.options.jinja_template = "./esparto.html.jinja" | ||
``` | ||
|
||
```python | ||
# Using page level options. | ||
output_options = es.OutputOptions( | ||
esparto_css="./esparto.css", | ||
jinja_template="./esparto.html.jinja", | ||
) | ||
page = es.Page(output_options=output_options) | ||
``` | ||
|
||
Options can be saved and loaded from disk using class methods. | ||
If an `esparto-config.yaml` file is found in the working directory, or at | ||
`~/esparto-data/esparto-config.yaml`, it will be loaded automatically when | ||
the library is imported. | ||
|
||
```python | ||
# These options will be loaded automatically for sessions in the same directory. | ||
output_options.save("./esparto-config.yaml") | ||
|
||
# These will be loaded only if no yaml file is found in the working directory. | ||
output_options.save("~/esparto-data/esparto-config.yaml") | ||
``` | ||
|
||
## Printing Default Resources | ||
|
||
It's recommended to use the standard CSS and Jinja template files as a starting | ||
point for any changes. | ||
A command line interface is provided for printing the default resources. | ||
|
||
```bash | ||
# Print default esparto.css to `esparto.css`. | ||
python -m esparto print_esparto_css > esparto.css | ||
``` | ||
|
||
```bash | ||
# Print default jinja template to `esparto.html.jinja`. | ||
python -m esparto print_jinja_template > esparto.html.jinja | ||
``` | ||
|
||
```bash | ||
# Print default Bootstrap CSS to `bootstrap.css`. | ||
python -m esparto print_bootstrap_css > bootstrap.css | ||
``` | ||
|
||
```bash | ||
# Print default output options to `esparto-config.yaml`. | ||
python -m esparto print_default_options > esparto-config.yaml | ||
``` | ||
|
||
## More options | ||
|
||
For details on additional options please read the | ||
[documentation for the Options module.](/03-api-reference/options/) | ||
|
||
<br> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
# Quick Start | ||
|
||
A brief overview of the main API features. | ||
|
||
## Create a Page | ||
|
||
```python | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,13 +15,13 @@ | |
|
||
__author__ = """Dominic Thorn""" | ||
__email__ = "[email protected]" | ||
__version__ = "3.0.2" | ||
__version__ = "4.0.0" | ||
|
||
_MODULE_PATH: _Path = _Path(__file__).parent.absolute() | ||
|
||
|
||
_OPTIONAL_DEPENDENCIES: _Set[str] = { | ||
"PIL", | ||
"PIL", # Only used for type checking and conversion | ||
"IPython", | ||
"matplotlib", | ||
"pandas", | ||
|
@@ -34,8 +34,8 @@ | |
x.name for x in [_find_spec(dep) for dep in _OPTIONAL_DEPENDENCIES] if x | ||
} | ||
|
||
from esparto._cdnlinks import bootstrap_cdn_themes | ||
from esparto._content import ( | ||
from esparto._options import OutputOptions, options | ||
from esparto.design.content import ( | ||
DataFramePd, | ||
FigureBokeh, | ||
FigureMpl, | ||
|
@@ -44,7 +44,7 @@ | |
Markdown, | ||
RawHTML, | ||
) | ||
from esparto._layout import ( | ||
from esparto.design.layout import ( | ||
Card, | ||
CardRow, | ||
CardRowEqual, | ||
|
@@ -56,6 +56,3 @@ | |
Section, | ||
Spacer, | ||
) | ||
from esparto._options import OutputOptions, options | ||
|
||
options._autoload() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from esparto import _cli | ||
|
||
if __name__ == "__main__": | ||
_cli.main() |
Oops, something went wrong.