We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Useful for globally or temporarily overriding defaults, e.g. those used for kwargs such as dtype, trim, cache, sort, rowvar, n_extra, etc.
dtype
trim
cache
sort
rowvar
n_extra
See polars.Config for a similar feature in polars with a clean API.
polars.Config
Setting:
lmo.config.set(sort='stable')
with lmo.config(sort='stable'): ...
or
@lmo.config.override(sort='stable') def spam(...): ...
lmo.config
class ConfigOptions(TypedDict, total=False): ...
_CONFIG: collections.ChainMap
TypedDict
_CONFIG
lmo.config.override(**options: *ConfigOptions)
lmo.config.set(*ConfigOptions)
So that e.g. LMO_SORT="stable" can be used to specifiy sort='stable' (supersedes the root config).
LMO_SORT="stable"
sort='stable'
pyproject.toml
Something like
[tool.lmo] sort = "stable"
It should have lower priorty than the environment variables.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Useful for globally or temporarily overriding defaults, e.g. those used for kwargs such as
dtype
,trim
,cache
,sort
,rowvar
,n_extra
, etc.See
polars.Config
for a similar feature in polars with a clean API.Usage
Global config:
Setting:
Local config
or
Implementation
lmo.config
namespace.class ConfigOptions(TypedDict, total=False): ...
._CONFIG: collections.ChainMap
for global config (although maybe an alternative or subclass is needed forTypedDict
support)._CONFIG
using default values.lmo.config.override(**options: *ConfigOptions)
contextmanager + decorator by having it push/pop from_CONFIG
.lmo.config.set(*ConfigOptions)
by replacing the root_CONFIG
, so that any potential locally overridden options aren't affectedBonus feature: Environment variables
So that e.g.
LMO_SORT="stable"
can be used to specifiysort='stable'
(supersedes the root config).Bonus feature:
pyproject.toml
Something like
It should have lower priorty than the environment variables.
The text was updated successfully, but these errors were encountered: