Skip to content

Conversation

@AlbertDeFusco
Copy link
Contributor

@AlbertDeFusco AlbertDeFusco commented Dec 5, 2025

New cli commands are added in sites subcommand, see below.

❯ anaconda sites
                                                                                                          
 Usage: anaconda sites [OPTIONS] COMMAND [ARGS]...                                                        
                                                                                                          
 Manage your Anaconda site configuration                                                                  
                                                                                                          
╭─ Options ──────────────────────────────────────────────────────────────────────────────────────────────╮
│ --help  -h        Show this message and exit.                                                          │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ─────────────────────────────────────────────────────────────────────────────────────────────╮
│ list     List configured sites by name and domain.                                                     │
│ show     Show the site configuration for the default site or look up by the provided name or domain.   │
│ add      Add new site configuration to config.toml                                                     │
│ modify   Modify site configuration in config.toml                                                      │
│ remove   Remove site configuration by name or domain.                                                  │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────╯

CLI

A few important points here on the CLI. When running show and list commands the env vars, secrets, and condarc configuration is always loaded and reported. But when writing values using anaconda sites set these sources are ignored to prevent secrets and conda configuration being written to the config.toml.

Several fields are hidden with anaconda sites show [site or domain] and can be displayed with --show-hidden. These same fields are also marked as hidden for the add and modify commands but can be provided, i.e. anaconda sites add --name "my_site" --domain "my.domain" --client-id=foo

By default CLI commands will show the proposed diff of changes and ask for confirmation. To automatically accept the changes use -y or --yes. To only show the diff and not ask for confirmation use --dry-run.

Here's an example of adding a new site and setting it as default, but keeping the out-of-the-box 'anaconda.com' site. The existing use_device_flow = true configuration in the config.toml, that is applied to all sites, is untouched.

Screenshot 2026-01-07 at 13 20 03

AnacondaAuthSite improvements

There is a slight cosmetic change to AnacondaAuthSite. The site field, which was set as default to anaconda.com now follows the domain field unless explicitly set. This allows the site object to remember its name.

config = AnacondaAuthSite(domain='foo.bar')
assert config.site == 'foo.bar'

config_with_site_name = AnacondaAuthSite(domain='foo.bar', site='foobar')
assert config.site == 'foobar'

When calling model_dump() on an AnacondaAuthSite the site field will be excluded. This ensures that the [plugin.auth] table in the config.toml does not have site = when configuration updates are written. All site names belong in the [sites.<>] table names.

@jmesa89 jmesa89 requested review from jmesa89 and mattkram December 8, 2025 19:06
is_default = CHECK_MARK if name == sites_config.default_site else ""
table.add_row(name, site.domain, is_default)

console.print(table)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be nice to also include a prompt like "to view site details, use anaconda sites show. Or something like that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants