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

Add settings module #1044

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

Conversation

soapy1
Copy link
Contributor

@soapy1 soapy1 commented Jan 9, 2025

Fixes #1005

Description

This PR introduces a settings module for interacting with conda store settings. It also adds some documentation and enforces rules for how settings get merged at each of the different levels of abstraction that setting apply to.

There are multiple levels which settings config can be applied to conda store.

  • deployment defaults (controlled by the config file)
  • global defaults (controlled by the admin console)
  • namespace defaults (controlled by the admin console)
  • environment default (controlled by the admin console)

The most specific settings config will take precedence over the more general setting.

The introduction of this settings object will allow for plugin authors to have better patterns for accessing settings. For example, consider the lock plugin which requires running a conda command

def _conda_command(self, conda_store) -> str:
        with conda_store.session_factory() as db:
            settings = conda_store.get_settings(db=db)
        return settings.conda_command

can now become

def _conda_command(self, conda_store, namespace=None, environment=None) -> str:
        return conda_store.get_setting(
            "conda_command", namespace=namespace, environment=environment
        ) or "mamba"

Pull request checklist

  • Did you test this change locally?
  • Did you update the documentation (if required)?
  • Did you add/update relevant tests for this change (if required)?

Copy link

netlify bot commented Jan 9, 2025

Deploy Preview for conda-store ready!

Name Link
🔨 Latest commit 9df6602
🔍 Latest deploy log https://app.netlify.com/sites/conda-store/deploys/678024c4eb92e30008d8cfde
😎 Deploy Preview https://deploy-preview-1044--conda-store.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Jan 9, 2025

Deploy Preview for conda-store canceled.

Name Link
🔨 Latest commit 1570e12
🔍 Latest deploy log https://app.netlify.com/sites/conda-store/deploys/67804a3d87a7620008bc5ce8

@soapy1 soapy1 force-pushed the settings-module branch 2 times, most recently from f404d18 to 0d92dc2 Compare January 9, 2025 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: New 🚦
Development

Successfully merging this pull request may close these issues.

Rethink how settings get applied to conda-store servers/workers
1 participant