core

Core conda notices logic.

Functions

retrieve_notices(...)

Function used for retrieving notices. This is called by the "notices" decorator as well

display_notices(→ None)

Prints the channel notices to std out.

notices(func)

Wrapper for "execute" entry points for subcommands.

get_channel_name_and_urls(→ list[tuple[ChannelUrl, ...)

Return a sequence of Channel URL and name tuples.

flatten_notice_responses(...)

filter_notices(...)

Perform filtering actions for the provided sequence of ChannelNotice objects.

is_channel_notices_enabled(→ bool)

Determines whether channel notices are enabled and therefore displayed when

is_channel_notices_cache_expired(→ bool)

Checks to see if the notices cache file we use to keep track of

Attributes

ChannelName

ChannelUrl

logger

ChannelName
ChannelUrl
logger
retrieve_notices(limit: int | None = None, always_show_viewed: bool = True, silent: bool = False) conda.notices.types.ChannelNoticeResultSet

Function used for retrieving notices. This is called by the "notices" decorator as well as the sub-command "notices"

Parameters
  • limit -- Limit the number of notices to show (defaults to None).

  • always_show_viewed -- Whether all notices should be shown, not only the unread ones (defaults to True).

  • silent -- Whether to use a spinner when fetching and caching notices.

display_notices(channel_notice_set: conda.notices.types.ChannelNoticeResultSet) None

Prints the channel notices to std out.

notices(func)

Wrapper for "execute" entry points for subcommands.

If channel notices need to be fetched, we do that first and then run the command normally. We then display these notices at the very end of the command output so that the user is more likely to see them.

This ordering was specifically done to address the following bug report:
Parameters

func -- Function to be decorated

get_channel_name_and_urls(channels: Sequence[Channel | MultiChannel]) list[tuple[ChannelUrl, ChannelName]]

Return a sequence of Channel URL and name tuples.

This function handles both Channel and MultiChannel object types.

flatten_notice_responses(channel_notice_responses: Sequence[conda.notices.types.ChannelNoticeResponse]) Sequence[conda.notices.types.ChannelNotice]
filter_notices(channel_notices: Sequence[conda.notices.types.ChannelNotice], limit: int | None = None, exclude: set[str] | None = None) Sequence[conda.notices.types.ChannelNotice]

Perform filtering actions for the provided sequence of ChannelNotice objects.

is_channel_notices_enabled(ctx: conda.base.context.Context) bool

Determines whether channel notices are enabled and therefore displayed when invoking the notices command decorator.

This only happens when:
  • offline is False

  • number_channel_notices is greater than 0

Parameters

ctx -- The conda context object

is_channel_notices_cache_expired() bool

Checks to see if the notices cache file we use to keep track of displayed notices is expired. This involves checking the mtime attribute of the file. Anything older than what is specified as the NOTICES_DECORATOR_DISPLAY_INTERVAL is considered expired.