Settings
Starplot uses an instance of a dataclass
to maintain a few global settings:
- Data download path
- DuckDB extension path
- SVG text rendering method
You can override these values in two ways: through code or through environment variables.
Code
To set values through code, just import the settings object:
from starplot import settings
settings.svg_text_type = "element"
# Create your plot and enjoy your editable text :)
Environment Variables
To set values through environment variables, just add the STARPLOT_
prefix to the setting name (and uppercase the entire name):
starplot.config.Settings
dataclass
download_path
class-attribute
instance-attribute
download_path: Path = field(
default_factory=_get_path("STARPLOT_DOWNLOAD_PATH", DATA_PATH / "downloads")
)
Path for downloaded data, including the Big Sky catalog, ephemeris files, etc.
Default = <starplot_source_path>/data/library/downloads/
duckdb_extension_path
class-attribute
instance-attribute
duckdb_extension_path: Path = field(
default_factory=_get_path(
"STARPLOT_DUCKDB_EXTENSION_PATH", DATA_PATH / "duckdb-extensions"
)
)
Path for the DuckDB spatial extension, which is required for the data backend.
Default = <starplot_source_path>/data/library/duckdb-extensions/
svg_text_type
class-attribute
instance-attribute
Method for rendering text in SVG exports:
-
"path"
(default) will render all text as paths. This will increase the filesize, but allow all viewers to see the font correctly (even if they don't have the font installed on their system). -
"element"
will render all text as an SVG<text>
element, which means the text will be editable in graphic design applications but the text may render in a system default font if the original font isn't available. Important: when using the "element" method, text borders will be turned OFF.
__init__
__init__(
download_path: Path = _get_path(
"STARPLOT_DOWNLOAD_PATH", DATA_PATH / "downloads"
)(),
duckdb_extension_path: Path = _get_path(
"STARPLOT_DUCKDB_EXTENSION_PATH", DATA_PATH / "duckdb-extensions"
)(),
svg_text_type: SvgTextType = lambda: get("STARPLOT_SVG_TEXT_TYPE", PATH)(),
) -> None