Skip to content
New issue

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

Unifying code base for config and no config #81

Open
aradhakrishnanGFDL opened this issue Oct 30, 2024 · 0 comments
Open

Unifying code base for config and no config #81

aradhakrishnanGFDL opened this issue Oct 30, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@aradhakrishnanGFDL
Copy link
Collaborator

The --config and the default no config option uses different code base for parsing headers. We need to converge the code base and get rid of builderconfig.py and perhaps internally use the default config that applies to most of frepp output. We discussed this over an email thread but logging an issue here as this becomes important to resurrect so maintenance and troubleshooting becomes easier.

Pasting email thread with user suggestion and this implementation approach is worth checking out. It solves the above issue and also the way users could check out a particular config that fits their use-case, without having to clone the repo or access something outside of catalogbuilder conda package.

The configurations live in a resources directory in the package tree. See here.

When the script loads the config file, it uses the package metadata to figure out where this directory actually lives on the user's system:

import importlib_resources
config_path = importlib_resources.files("gfdlnb.resources").joinpath("config.yaml")

The resource directory is declared in the package configuration (pyporoject.toml):

[tool.setuptools.package-data]
gfdlnb = ["resources/config.yaml","notebooks/ocean/*.ipynb"]

The advantage here is that the default configuration YAML file is always defined relative to the package installation. The means that when you distribute it via conda or PyPi, there will be predictable behavior.

@aradhakrishnanGFDL aradhakrishnanGFDL added the enhancement New feature or request label Oct 30, 2024
@aradhakrishnanGFDL aradhakrishnanGFDL self-assigned this Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant