Absorption database abstraction, Dynaconf migration #397
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Experimental, do not merge!
This PR brings two major changes:
Transition of configuration to Dynaconf
The new configuration framework is based on Dynaconf. We retain the main features of the previous system based on environ-config:
In addition, the new system brings the following new features:
The interface, although very similar to the previous one, has changed a little and requires some adaptations:
The primary access point is now named
eradiate.config.settings
. This data structure implements a mapping interface, but also still allows attribute access. Access is also case insensitive. Therefore, access such asbecomes one of
The
SOURCE_DIR
variable is no longer a setting, but an environment variable only. It is configured exclusively through theERADIATE_SOURCE_DIR
environment variable and accessed aseradiate.config.SOURCE_DIR
in Python.A new
ERADIATE_ENV
environment variable is now available. The intent is to allow the user to specify the type of environment they are running Eradiate in (e.g. development, production, testing, etc.) to fine-tune some behaviour dynamically. This feature is not used yet.Addition of an abstraction to handle large molecular absorption databases
This is the main topic of this PR. We introduce a new
AbsorptionDatabase
hierarchy to provide efficient access to our absorption coefficient databases. This new handling component solidifies the ad-hoc data structures we had been using before. The main limitations we suffered were:The resulting components provide now great flexibility to balance convenience, performance and memory usage:
In addition, data handling is much more convenient:
AbsorptionDatabase.from_directory()
andAbsorptionDatabase.from_name()
constructors.MolecularAtmosphere(absorption_data="monotropa")
. Prior interface still works, but emits a deprecation warning and will be removed in a future version.The new system does however not do well with our data handling strategy: files have to be on the hard drive prior for the database to load gracefully. This means that built-in databases will not behave well if the data is not downloaded in advance. To address this issue, the CLI entry point
eradiate data fetch
can now be used to download files making up a database. For instance:eradiate data fetch komodo monotropa
Other minor updates
.eradiate_downloads
directory, either located at the Eradiate source root ifERADIATE_SOURCE_DIR
is specified, or in the current working directory in a production setup.To do / caveats:
download_dir
setting is missing.Checklist
main
branch