pychoco¶
Minimal choco command for use on non-Windows platforms.
Commands¶
choco¶
Minimal choco command.
Usage
choco [OPTIONS] COMMAND [ARGS]...
apikey¶
Manage API keys.
Usage
choco apikey [OPTIONS] COMMAND [ARGS]...
add¶
Add an API key for a source.
Usage
choco apikey add [OPTIONS]
Options
- -d, --debug¶
Enable debug logging.
- -k, --key <API_KEY>¶
Required API key.
- -s, --source <SOURCE_URL>¶
Required Source URI.
- -p, --path <PATH>¶
Storage file.
list¶
List sources associated with API keys. Does not display the API key values.
Usage
choco apikey list [OPTIONS]
Options
- -d, --debug¶
Enable debug logging.
- -p, --path <PATH>¶
Storage file.
config¶
Manage configuration.
Usage
choco config [OPTIONS] COMMAND [ARGS]...
set¶
Set a configuration value.
Usage
choco config set [OPTIONS]
Options
- -d, --debug¶
Enable debug logging.
- -v, --value <VALUE>¶
Required Value to set.
- -p, --path <PATH>¶
Storage file.
new¶
Create a new package.
Usage
choco new [OPTIONS] NAME
Options
- -d, --debug¶
Enable debug logging.
Arguments
- NAME¶
Required argument
pack¶
Create a package file for distribution.
Usage
choco pack [OPTIONS] [WORK_DIR]
Options
- -d, --debug¶
Enable debug logging.
Arguments
- WORK_DIR¶
Optional argument
push¶
Push a package to a source.
Usage
choco push [OPTIONS] PACKAGE
Options
- -d, --debug¶
Enable debug logging.
- -s, --source <URL>¶
Source to upload to.
- --config-path <PATH>¶
Configuration storage file.
- --api-keys-path <PATH>¶
API keys storage file.
Arguments
- PACKAGE¶
Required argument
search¶
Search a source.
Usage
choco search [OPTIONS] TERMS
Options
- --by-id-only¶
Only return packages where the id contains the search filter.
- --by-tag-only, --by-tags-only¶
Only return packages where the search filter matches on the tags.
- --id-starts-with¶
Only return packages where the id starts with the search filter.
- --idonly, --id-only¶
Only return Package IDs in the list results.
- --order-by-popularity¶
Sort package results by popularity.
- --page <page>¶
The “page” of results to return.
- --page-size <page_size>¶
Amount of packages to return in each page of results.
- --pre, --prerelease¶
Include prereleases.
- -a, --all, --allversions, --all-versions¶
Include results from all versions.
- -d, --debug¶
Enable debug logging.
- -e, --exact¶
Only return packages with this exact name.
- -p, --password <password>¶
Password.
- -s, --source <URL>¶
Source to search.
- -u, --user <user>¶
User name.
Arguments
- TERMS¶
Required argument
Library¶
Client.
-
choco.client.Auth =
tuple[str, str] | niquests.auth.HTTPBasicAuth¶ Authentication details.
-
class choco.client.ChocolateyClient(config: Config =
{'pychoco': {'defaultPushSource': 'https://push.chocolatey.org'}}, api_keys: Mapping[str, str] | None =None)¶ Chocolatey client.
Anything that involves interactions with the server will be in this class.
-
async push(package: Path, source: str | None =
None, auth: Auth | None =None) None¶ Push a package to a source.
-
async search(terms: str, *, auth: Auth | None =
None, all_versions: bool =False, by_id_only: bool =False, by_tag_only: bool =False, exact: bool =False, id_starts_with: bool =False, include_prerelease: bool =False, order_by_popularity: bool =False, page: int | None =None, page_size: int =30, source: str | None =None) AsyncIterator[SearchResult]¶ Search packages. Returns a deduplicated async iterator of results.
- Yields:¶
SearchResult
-
async push(package: Path, source: str | None =
Persistent configuration.
-
async choco.config.read_all(config_path: Path | str | None =
None, api_keys_path: Path | str | None =None) tuple[Config, dict[str, str] | None]¶ Read both configuration and API keys from the specified paths or defaults.
-
async choco.config.read_api_keys(path: Path | str | None =
None) dict[str, str]¶ Read API keys stored in given path or the default path.
-
async choco.config.read_config(path: Path | str | None =
None) Config¶ Read configuration from the given path or the default path.
-
async choco.config.write_api_keys(api_keys: Mapping[str, str], path: Path | str | None =
None) None¶ Write API keys dictionary to the given path or the default path.
-
async choco.config.write_config(config: Config, path: Path | str | None =
None) None¶ Write configuration to the given path or the default path.
Packaging-related functions.
Utility functions.
- choco.utils.append_dir_to_zip_recursive(root: Path, z: zipfile.ZipFile) None¶
Append a directory recursively to a zip file.
- Parameters:¶
- root : Path¶
The root directory to append.
- z : zipfile.ZipFile¶
The zip file to append to.
-
choco.utils.entry_to_search_result(entry: Element, ns: Mapping[str, str] =
{'': 'http://www.w3.org/2005/Atom', 'd': 'http://schemas.microsoft.com/ado/2007/08/dataservices', 'm': 'http://schemas.microsoft.com/ado/2007/08/dataservices/metadata'}) SearchResult¶ Convert an
<entry>to aSearchResultdict.
-
choco.utils.tag_text_or(tag: Element | None, default: str | None =
None) str | None¶ Return text from a tag or the default value specified.
Constants¶
Constants.
- choco.constants.CHOCOLATEY_UNINSTALL_PS1¶
Uninstall PowerShell template.
- choco.constants.CONTENT_TYPES_XML¶
Used in creating the
[Content_Types].xmlfile.
- choco.constants.FEED_AUTHOR_TAG¶
Feed
authortag.
- choco.constants.FEED_ENTRY_TAG¶
Feed
entrytag.
- choco.constants.FEED_ID_TAG¶
Feed
idtag.
- choco.constants.FEED_NAMESPACES¶
Namespaces used in parsing package feeds.
- choco.constants.FEED_SUMMARY_TAG¶
Feed
summarytag.
- choco.constants.FEED_TITLE_TAG¶
Feed
titletag.
- choco.constants.FEED_UPDATED_TAG¶
Feed
updatedtag.
- choco.constants.METADATA_DESCRIPTION_TAG¶
Feed
d:Descriptiontag.
- choco.constants.METADATA_DOCS_URL_TAG¶
Feed
d:DocsUrltag.
- choco.constants.METADATA_DOWNLOAD_COUNT_TAG¶
Feed
d:DownloadCounttag.
- choco.constants.METADATA_GALLERY_DETAILS_URL_TAG¶
Feed
d:GalleryDetailsUrltag.
- choco.constants.METADATA_IS_APPROVED_TAG¶
Feed
d:IsApprovedtag.
- choco.constants.METADATA_IS_DOWNLOAD_CACHE_AVAILABLE_TAG¶
Feed
d:IsDownloadCacheAvailabletag.
- choco.constants.METADATA_LICENSE_URL_TAG¶
Feed
d:LicenseUrltag.
- choco.constants.METADATA_PACKAGE_APPROVED_DATE_TAG¶
Feed
d:PackageApprovedDatetag.
- choco.constants.METADATA_PACKAGE_SOURCE_URL_TAG¶
Feed
d:PackageSourceUrltag.
- choco.constants.METADATA_PACKAGE_STATUS_TAG¶
Feed
d:PackageStatustag.
- choco.constants.METADATA_PACKAGE_TEST_RESULT_STATUS_DATE_TAG¶
Feed
d:PackageTestResultStatusDatetag.
- choco.constants.METADATA_PACKAGE_TEST_RESULT_STATUS_TAG¶
Feed
d:PackageTestResultStatustag.
- choco.constants.METADATA_PROJECT_URL_TAG¶
Feed
d:ProjectUrltag.
- choco.constants.METADATA_PUBLISHED_TAG¶
Feed
d:Publishedtag.
- choco.constants.METADATA_RELEASE_NOTES_TAG¶
Feed
d:ReleaseNotestag.
- choco.constants.METADATA_SUMMARY_TAG¶
Feed
d:Summarytag.
- choco.constants.METADATA_TAGS_TAG¶
Feed
d:Tagstag.
- choco.constants.METADATA_VERSION_DOWNLOAD_COUNT_TAG¶
Feed
d:VersionDownloadCounttag.
- choco.constants.METADATA_VERSION_TAG¶
Feed
d:Versiontag.
- choco.constants.NUSPEC_FIELD_AUTHORS¶
Nuspec authors tag.
- choco.constants.NUSPEC_FIELD_DESCRIPTION¶
Nuspec description tag.
- choco.constants.NUSPEC_FIELD_ID¶
Nuspec id tag.
- choco.constants.NUSPEC_FIELD_TAGS¶
Nuspec tags tag.
- choco.constants.NUSPEC_FIELD_VERSION¶
Nuspec version tag.
- choco.constants.OBJECT_REF_NOT_SET_ERROR_MESSAGE¶
Error message for object reference not set as seen from chocolatey.org when using the search API.
- choco.constants.PYCHOCO_API_KEYS_TOML_PATH¶
Where pychoco’s API key list is stored.
- choco.constants.PYCHOCO_TOML_PATH¶
Where pychoco’s main configuration file is by default.
- choco.constants.VALID_NAME_RE¶
Valid name for a package regular expression.
Templates¶
Template instances.
- choco.templates.CHOCOLATEY_INSTALL_PS1_TEMPLATE¶
Chocolatey PowerShell install template.
- choco.templates.NUSPEC_TEMPLATE¶
Used in construction of the Nuspec file.
- choco.templates.PSMDCP_XML_TEMPLATE¶
Used in construction of
packages/services/metadata/core-properties/{id}.psmdcp.
- choco.templates.RELS_XML_TEMPLATE¶
Used in construction of
_rels/.relsfile.
- choco.templates.SEARCH_RESULT_TEMPLATE¶
Search result template.
Typing¶
Typing helpers.
- class choco.typing.Config¶
Configuration dictionary after de-serialisation.
- choco.typing.ConfigKey¶
Available keys for
ChocolateyClient.config_set.alias of
Literal[‘defaultPushSource’]
- class choco.typing.SearchResult¶
Represents a package search result.
- testing_status : TestingStatus¶
Testing status.