From 16be4bf265c33e392bd9b0caea8af1c93119f5d5 Mon Sep 17 00:00:00 2001 From: Volodymyr Pivoshenko Date: Sat, 1 Jul 2023 23:12:41 +0100 Subject: [PATCH 1/7] fix(poetry): update specification to follow the new version --- src/poetry.ts | 828 ++++++++++++++++++++++++++++---------------------- 1 file changed, 467 insertions(+), 361 deletions(-) diff --git a/src/poetry.ts b/src/poetry.ts index ce8a244b317..34ca54ef5da 100644 --- a/src/poetry.ts +++ b/src/poetry.ts @@ -1,46 +1,64 @@ const help: Fig.Option = { name: ["-h", "--help"], - description: "Display this help message", + description: "Display help information.", }; const quiet: Fig.Option = { name: ["-q", "--quiet"], - description: "Do not output any message", + description: "Do not output any message.", }; const verbose: Fig.Option = { name: ["-v", "--verbose"], - description: "Increase the verbosity of messages", + description: "Increase the verbosity of messages.", }; const vverbose: Fig.Option = { name: "-vv", - description: "More verbose output", + description: "More verbose output.", }; const vvverbose: Fig.Option = { name: "-vvv", - description: "Most verbose output for debug", + description: "Debug output.", }; const version: Fig.Option = { name: ["-V", "--version"], - description: "Display this application version", + description: "Display this application version.", }; const ansi: Fig.Option = { name: "--ansi", - description: "Force ANSI output", + description: "Force ANSI output.", }; const noAnsi: Fig.Option = { name: "--no-ansi", - description: "Disable ANSI output", + description: "Disable ANSI output.", }; const noInteraction: Fig.Option = { name: ["-n", "--no-interaction"], - description: "Do not ask any interactive question", + description: "Do not ask any interactive question.", +}; + +const noPlugins: Fig.Option = { + name: ["--no-plugins"], + description: "Disables plugins.", +}; + +const noCache: Fig.Option = { + name: ["--no-cache"], + description: "Disables poetry source caches.", +}; + +const directory: Fig.Option = { + name: ["--directory"], + description: "The working directory for the poetry command.", + args: { + name: "directory", + }, }; const globalOptions: Fig.Option[] = [ @@ -52,547 +70,635 @@ const globalOptions: Fig.Option[] = [ ansi, noAnsi, noInteraction, + noPlugins, + noCache, + directory, ]; const completionSpec: Fig.Spec = { name: "poetry", - description: "Python package manager", + description: + "poetry is a tool for dependency management and packaging in Python.", subcommands: [ { name: "about", - description: "Show information about Poetry", - options: [...globalOptions], + description: "Shows information about poetry.", + options: [], + args: [], }, { name: "add", - description: "Adds a new dependency to pyproject.toml", - args: { - name: "dependency", - description: "Package to add", - }, + description: "Adds a new dependency to pyproject.toml.", options: [ - ...globalOptions, + { name: "--group", description: "The group to add the dependency to." }, { - name: ["-D", "--dev"], - description: "Add as a development dependency", + name: "--dev", + description: + "Add as a development dependency. (Deprecated) Use --group=dev instead.", + }, + { + name: "--editable", + description: "Add vcs/path dependencies as editable.", + }, + { + name: "--extras", + description: "Extras to activate for the dependency.", + }, + { name: "--optional", description: "Add as an optional dependency." }, + { + name: "--python", + description: + "Python version for which the dependency must be installed.", }, { - name: ["-E", "--extras"], - description: "Extras to activate for the dependency", - args: { - name: "extras", - description: "Extras", - }, + name: "--platform", + description: "Platforms for which the dependency must be installed.", }, { - name: "--optional", - description: "Add as an optional dependency", + name: "--source", + description: "Name of the source to use to install the package.", }, + { name: "--allow-prereleases", description: "Accept prereleases." }, { name: "--dry-run", description: - "Output the operations but do not execute anything (implicitly enables --verbose)", + "Output the operations but do not execute anything (implicitly enables --verbose).", }, { name: "--lock", - description: "Do not perform operations (only update the lockfile)", + description: "Do not perform operations (only update the lockfile).", }, ], + args: [{ name: "name", description: "The packages to add." }], }, { name: "build", - description: "Builds a package, as a tarball and a wheel by default", + description: "Builds a package, as a tarball and a wheel by default.", options: [ - ...globalOptions, - { - name: ["-f", "--format"], - description: "Limit the format to either sdist or wheel", - args: { - name: "format", - suggestions: [ - { - name: "sdist", - description: "Use sdist format", - }, - { - name: "wheel", - description: "Use wheel format", - }, - ], - }, + { + name: "--format", + description: "Limit the format to either sdist or wheel.", }, ], + args: [], }, { name: "check", - description: "Checks the validity of the pyproject.toml file", - options: [...globalOptions], + description: "Checks the validity of the pyproject.toml file.", + options: [], + args: [], }, { name: "config", - description: "Manages configuration settings", + description: "Manages configuration settings.", options: [ - ...globalOptions, - { - name: "--list", - description: "List configuration settings", - }, - { - name: "--unset", - description: "Unset configuration setting", - args: { - name: "key", - description: "Setting key to remove", - }, - }, + { name: "--list", description: "List configuration settings." }, + { name: "--unset", description: "Unset configuration setting." }, { name: "--local", - description: "Set/Get from the project's local configuration", + description: "Set/Get from the project's local configuration.", }, ], args: [ - { - name: "key", - description: "Setting key", - suggestions: [ - { - name: "cache-dir", - description: "The path to the cache directory used by Poetry", - }, - { - name: "virtualenvs.create", - description: - "Create a new virtualenv if one doesn't already exist", - }, - { - name: "virtualenvs.in-project", - description: - "Create the virtualenv inside the project's root directory", - }, - { - name: "virtualenvs.path", - description: - "Directory where virtual environments will be created", - }, - { - name: "repositories.{name}", - description: "Set a new alternative repository", - insertValue: "repositories.", - }, - ], - }, - { - name: "value", - description: "Setting value", - }, + { name: "key", description: "Setting key." }, + { name: "value", description: "Setting value." }, ], }, { - name: "debug", - description: "Debug various elements of Poetry", - options: [...globalOptions], + name: "init", + description: + "Creates a basic pyproject.toml file in the current directory.", + options: [ + { name: "--name", description: "Name of the package." }, + { name: "--description", description: "Description of the package." }, + { name: "--author", description: "Author name of the package." }, + { name: "--python", description: "Compatible Python versions." }, + { + name: "--dependency", + description: + "Package to require, with an optional version constraint, e.g. requests:^2.10.0 or requests=2.11.1.", + }, + { + name: "--dev-dependency", + description: + "Package to require for development, with an optional version constraint, e.g. requests:^2.10.0 or requests=2.11.1.", + }, + { name: "--license", description: "License of the package." }, + ], + args: [], }, { - name: "env", - description: "Interact with Poetry's project environments", - subcommands: [ + name: "install", + description: "Installs the project dependencies.", + options: [ + { name: "--without", description: "The dependency groups to ignore." }, + { + name: "--with", + description: "The optional dependency groups to include.", + }, + { + name: "--only", + description: "The only dependency groups to include.", + }, + { + name: "--no-dev", + description: + "Do not install the development dependencies. (Deprecated)", + }, + { + name: "--sync", + description: + "Synchronize the environment with the locked packages and the specified groups.", + }, + { + name: "--no-root", + description: "Do not install the root package (the current project).", + }, + { + name: "--no-directory", + description: + "Do not install any directory path dependencies; useful to install dependencies without source code, e.g. for caching of Docker layers)", + }, + { + name: "--dry-run", + description: + "Output the operations but do not execute anything (implicitly enables --verbose).", + }, + { + name: "--remove-untracked", + description: + "Removes packages not present in the lock file. (Deprecated)", + }, + { + name: "--extras", + description: "Extra sets of dependencies to install.", + }, { - name: "info", - description: "Displays information about the current environment", - options: [ - { - name: ["-p", "--path"], - description: "Only desplay the environment's path", - }, - ], + name: "--all-extras", + description: "Install all extra dependencies.", }, + { name: "--only-root", description: "Exclude all dependencies." }, { - name: "list", + name: "--compile", description: - "Lists all virtualenvs associated with the current project", - options: [ - { - name: "--full-path", - description: "Output the full paths of the virtualenvs", - }, - ], + "Compile Python source files to bytecode. (This option has no effect if modern-installation is disabled because the old installer always compiles.)", }, + ], + args: [], + }, + { + name: "lock", + description: "Locks the project dependencies.", + options: [ { - name: "remove", + name: "--no-update", + description: "Do not update locked versions, only refresh lock file.", + }, + { + name: "--check", description: - "Removes a specific virtualenv associated with the project", - args: { - name: "python", - description: "The python executable to remove the virtualenv for", - }, + "Check that the poetry.lock file corresponds to the current version of pyproject.toml.", }, + ], + args: [], + }, + { + name: "new", + description: "Creates a new Python project at .", + options: [ + { name: "--name", description: "Set the resulting package name." }, + { name: "--src", description: "Use the src layout for the project." }, { - name: "use", + name: "--readme", description: - "Activates or creates a new virtualenv for the current project", - args: { - name: "python", - description: "The python executable to use", - }, + "Specify the readme file format. One of md (default) or rst", }, ], - options: [...globalOptions], + args: [ + { name: "path", description: "The path to create the project at." }, + ], }, { - name: "export", - description: "Exports the lock file to alternative formats", + name: "publish", + description: "Publishes a package to a remote repository.", options: [ - ...globalOptions, { - name: ["-f", "--format"], - description: "Format to export to", - args: { - name: "format", - description: "Export format", - suggestions: ["requirements.txt"], - }, + name: "--repository", + description: "The repository to publish the package to.", + }, + { + name: "--username", + description: "The username to access the repository.", }, { - name: ["-o", "--output"], - description: "The name of the output file", - args: { - name: "filename", - description: "Output file name", - template: "filepaths", - }, + name: "--password", + description: "The password to access the repository.", }, { - name: "--without-hashes", - description: "Exclude hashes from the exported file", + name: "--cert", + description: "Certificate authority to access the repository.", + }, + { + name: "--client-cert", + description: "Client certificate to access the repository.", + }, + { + name: "--build", + description: "Build the package before publishing.", + }, + { + name: "--dry-run", + description: "Perform all actions except upload the package.", + }, + { + name: "--skip-existing", + description: + "Ignore errors from files already existing in the repository.", + }, + ], + args: [], + }, + { + name: "remove", + description: "Removes a package from the project dependencies.", + options: [ + { + name: "--group", + description: "The group to remove the dependency from.", }, { name: "--dev", - description: "Include development dependencies", + description: + "Remove a package from the development dependencies. (Deprecated) Use --group=dev instead.", }, { - name: ["-E", "--extras"], - description: "Extra sets of dependencies to include", - args: { - name: "extras", - description: "Extras", - }, + name: "--dry-run", + description: + "Output the operations but do not execute anything (implicitly enables --verbose).", + }, + { + name: "--lock", + description: "Do not perform operations (only update the lockfile).", }, + ], + args: [{ name: "packages", description: "The packages to remove." }], + }, + { + name: "run", + description: "Runs a command in the appropriate environment.", + options: [], + args: [ { - name: "--with-credentials", - description: "Include credentials for extra indices", + name: "args", + description: "The command and arguments/options to run.", }, ], }, { - name: "help", - description: "Display the manual of a command", + name: "search", + description: "Searches for packages on remote repositories.", + options: [], + args: [{ name: "tokens", description: "The tokens to search for." }], }, { - name: "init", - description: - "Creates a basic pyproject.toml file in the current directory", + name: "shell", + description: "Spawns a shell within the virtual environment.", + options: [], + args: [], + }, + { + name: "show", + description: "Shows information about packages.", options: [ - ...globalOptions, + { name: "--without", description: "The dependency groups to ignore." }, { - name: "--name", - description: "Name of the package", - args: { - name: "name", - }, + name: "--with", + description: "The optional dependency groups to include.", }, { - name: "--description", - description: "Description of the package", - args: { - name: "description", - }, + name: "--only", + description: "The only dependency groups to include.", }, { - name: "--author", - description: "Author name of the package", - args: { - name: "author", - }, + name: "--no-dev", + description: "Do not list the development dependencies. (Deprecated)", }, + { name: "--tree", description: "List the dependencies as a tree." }, { - name: "--python", - description: "Compatible Python versions", - args: { - name: "python version", - }, + name: "--why", + description: + "When showing the full list, or a --tree for a single package, also display why it's included.", }, + { name: "--latest", description: "Show the latest version." }, { - name: "--dependency", + name: "--outdated", description: - "Package to require, with an optional version constraint", - args: { - name: "dependency", - }, + "Show the latest version but only for packages that are outdated.", }, { - name: "--dev-dependency", + name: "--all", description: - "Package to require for development, with an optional version constraint", - args: { - name: "dev dependency", - }, + "Show all packages (even those not compatible with current system).", }, { - name: ["-l", "--license"], - description: "License of the package", - args: { - name: "license", - }, + name: "--top-level", + description: "Show only top-level dependencies.", }, ], + args: [{ name: "package", description: "The package to inspect" }], }, { - name: "install", - description: "Installs the project dependencies", + name: "update", + description: + "Update the dependencies as according to the pyproject.toml file.", options: [ - ...globalOptions, + { name: "--without", description: "The dependency groups to ignore." }, { - name: "--no-dev", - description: "Do not install the development dependencies", + name: "--with", + description: "The optional dependency groups to include.", }, { - name: "--no-root", - description: "Do not install the root package", + name: "--only", + description: "The only dependency groups to include.", }, { - name: "--dry-run", - description: "Output the operations but do not execute anything", + name: "--no-dev", + description: + "Do not update the development dependencies. (Deprecated)", }, { - name: "--remove-untracked", - description: "Removes packages not present in the lock file", + name: "--dry-run", + description: + "Output the operations but do not execute anything (implicitly enables --verbose).", }, { - name: ["-E", "--extras"], - description: "Extra sets of dependencies to install", - args: { - name: "extras", - description: "Extras", - }, + name: "--lock", + description: "Do not perform operations (only update the lockfile).", }, ], + args: [{ name: "packages", description: "The packages to update" }], }, { - name: "lock", - description: "Locks the project dependencies", + name: "version", + description: + "Shows the version of the project or bumps it when a valid bump rule is provided.", options: [ - ...globalOptions, + { name: "--short", description: "Output the version number only" }, + { name: "--dry-run", description: "Do not update pyproject.toml file" }, + ], + args: [ { - name: "--no-update", - description: "Do not update locked versions, only refresh lock file", + name: "version", + description: "The version number or the rule to update the version.", }, ], }, { - name: "new", - description: "Creates a new Python project at specified path", + name: "cache clear", + description: "Clears a poetry cache by name.", + options: [ + { name: "--all", description: "Clear all entries in the cache." }, + ], + args: [{ name: "cache", description: "The name of the cache to clear." }], + }, + { + name: "cache list", + description: "List poetry's caches.", + options: [], + args: [], + }, + { + name: "debug info", + description: "Shows debug information.", + options: [], + args: [], + }, + { + name: "debug resolve", + description: "Debugs dependency resolution.", options: [ - ...globalOptions, { - name: "--name", - description: "Set the resulting package name", - args: { - name: "package name", - }, + name: "--extras", + description: "Extras to activate for the dependency.", }, { - name: "--src", - description: "Use the src layout for the project", + name: "--python", + description: "Python version(s) to use for resolution.", + }, + { name: "--tree", description: "Display the dependency tree." }, + { + name: "--install", + description: "Show what would be installed for the current system.", }, ], - args: { - name: "path", - description: "The path to create the project at", - }, + args: [{ name: "package", description: "The packages to resolve." }], }, { - name: "publish", - description: "Publishes a package to a remote repository", + name: "env info", + description: "Displays information about the current environment.", options: [ - ...globalOptions, + { name: "--path", description: "Only display the environment's path." }, { - name: ["-r", "--repository"], - description: "The repository to publish the package to", - args: { - name: "repository", - }, + name: "--executable", + description: "Only display the environment's python executable path.", }, + ], + args: [], + }, + { + name: "env list", + description: "Lists all virtualenvs associated with the current project.", + options: [ { - name: ["-u", "--username"], - description: "The username to access the repository", - args: { - name: "username", - }, + name: "--full-path", + description: "Output the full paths of the virtualenvs.", }, + ], + args: [], + }, + { + name: "env remove", + description: "Remove virtual environments associated with the project.", + options: [ { - name: ["-p", "--password"], - description: "The password to access the repository", - args: { - name: "password", - }, + name: "--all", + description: + "Remove all managed virtual environments associated with the project.", }, + ], + args: [ { - name: "--cert", - description: "Certificate authority to access the repository", - args: { - name: "certificate authority", - }, + name: "python", + description: + "The python executables associated with, or names of the virtual environments which are to be removed.", }, + ], + }, + { + name: "env use", + description: + "Activates or creates a new virtualenv for the current project.", + options: [], + args: [{ name: "python", description: "The python executable to use." }], + }, + { + name: "self add", + description: "Add additional packages to poetry's runtime environment.", + options: [ { - name: "--client-cert", - description: "Client certificate to access the repository", - args: { - name: "client certificate", - }, + name: "--editable", + description: "Add vcs/path dependencies as editable.", }, { - name: "--build", - description: "Build the package before publishing", + name: "--extras", + description: "Extras to activate for the dependency.", + }, + { + name: "--source", + description: "Name of the source to use to install the package.", }, + { name: "--allow-prereleases", description: "Accept prereleases." }, { name: "--dry-run", - description: "Perform all actions except upload the package", + description: + "Output the operations but do not execute anything (implicitly enables --verbose).", }, ], + args: [{ name: "name", description: "The packages to add." }], }, { - name: "remove", - description: "Removes a package from the project dependencies", + name: "self install", + description: + "Install locked packages (incl. addons) required by this poetry installation.", options: [ - ...globalOptions, { - name: ["-D", "--dev"], - description: "Remove a package from the development dependencies", + name: "--sync", + description: + "Synchronize the environment with the locked packages and the specified groups.", }, { name: "--dry-run", - description: "Output the operations but do not execute anything", + description: + "Output the operations but do not execute anything (implicitly enables --verbose).", }, ], - args: { - name: "dependency", - description: "Package to remove", - }, + args: [], }, { - name: "run", - description: "Runs a command in the appropriate environment", - args: { - name: "command or script", - }, - }, - { - name: "search", - description: "Searches for packages on remote repositories", - options: [...globalOptions], - args: { - name: "token", - description: "The tokens to search for", - }, - }, - { - name: "self", - description: "Interact with Poetry directly", - options: [...globalOptions], - subcommands: [ - { - name: "update", - description: "Updates Poetry to the latest version", - options: [ - ...globalOptions, - { - name: "--preview", - description: "Install prereleases", - }, - ], - args: { - name: "version", - description: "The version to update to", - }, + name: "self lock", + description: "Lock the poetry installation's system requirements.", + options: [ + { + name: "--no-update", + description: "Do not update locked versions, only refresh lock file.", + }, + { + name: "--check", + description: + "Check that the poetry.lock file corresponds to the current version of pyproject.toml.", }, ], + args: [], }, { - name: "shell", - description: "Spawns a shell within the virtual environment", - options: [...globalOptions], + name: "self remove", + description: + "Remove additional packages from poetry's runtime environment.", + options: [ + { + name: "--dry-run", + description: + "Output the operations but do not execute anything (implicitly enables --verbose).", + }, + ], + args: [{ name: "packages", description: "The packages to remove." }], }, { - name: "show", - description: "Shows information about packages", + name: "self update", + description: "Updates poetry to the latest version.", options: [ - ...globalOptions, { - name: "--no-dev", - description: "Do not list the development dependencies", + name: "--preview", + description: "Allow the installation of pre-release versions.", }, { - name: ["-t", "--tree"], - description: "List the dependencies as a tree", + name: "--dry-run", + description: + "Output the operations but do not execute anything (implicitly enables --verbose).", }, + ], + args: [{ name: "version", description: "The version to update to." }], + }, + { + name: "self show", + description: "Show packages from poetry's runtime environment.", + options: [ { - name: ["-l", "--latest"], - description: "Show the latest version", + name: "--addons", + description: "List only add-on packages installed.", }, + { name: "--tree", description: "List the dependencies as a tree." }, + { name: "--latest", description: "Show the latest version." }, { - name: ["-o", "--outdated"], + name: "--outdated", description: - "Show the latest version but only for packages that are outdated", - }, - { - name: ["-a", "--all"], - description: "Show all packages", + "Show the latest version but only for packages that are outdated.", }, ], - args: { - name: "dependency", - description: "Package to inspect", - }, + args: [{ name: "package", description: "The package to inspect" }], }, { - name: "update", - description: - "Update the dependencies as according to the pyproject.toml file", + name: "self show plugins", + description: "Shows information about the currently installed plugins.", + options: [], + args: [], + }, + { + name: "source add", + description: "Add source configuration for project.", options: [ - ...globalOptions, { - name: "--no-dev", - description: "Do not update the development dependencies", + name: "--default", + description: + "Set this source as the default (disable PyPI). A default source will also be the fallback source if you add other sources. (Deprecated, use --priority)", }, { - name: "--dry-run", - description: "Output the operations but do not execute anything", + name: "--secondary", + description: + "Set this source as secondary. (Deprecated, use --priority)", }, { - name: "--lock", - description: "Do not perform operations", + name: "--priority", + description: + "Set the priority of this source. One of: default, primary, secondary, supplemental, explicit. Defaults to primary.", + }, + ], + args: [ + { name: "name", description: "Source repository name." }, + { + name: "url", + description: + "Source repository URL. Required, except for PyPI, for which it is not allowed.", }, ], - args: { - name: "dependency", - description: "Package to update", - }, }, { - name: "version", - description: - "Shows the version of the project or bumps it when a valid bump rule is provided", - options: [ - ...globalOptions, + name: "source remove", + description: "Remove source configured for the project.", + options: [], + args: [{ name: "name", description: "Source repository name." }], + }, + { + name: "source show", + description: "Show information about sources configured for the project.", + options: [], + args: [ { - name: ["-s", "--short"], - description: "Output the version number only", + name: "source", + description: + "Source(s) to show information for. Defaults to showing all sources.", }, ], - args: { - name: "version", - description: "The version number or the rule to update the version", - }, }, ], options: [...globalOptions], From ee7bdf013b1fa58322e6f1547b2721d1f1c6d1b6 Mon Sep 17 00:00:00 2001 From: Volodymyr Pivoshenko Date: Sat, 1 Jul 2023 23:20:26 +0100 Subject: [PATCH 2/7] style(poetry): refactor code to resolve linter warnings --- src/poetry.ts | 389 +++++++++++++++++++++++--------------------------- 1 file changed, 179 insertions(+), 210 deletions(-) diff --git a/src/poetry.ts b/src/poetry.ts index 34ca54ef5da..8fec14339d6 100644 --- a/src/poetry.ts +++ b/src/poetry.ts @@ -1,61 +1,61 @@ const help: Fig.Option = { name: ["-h", "--help"], - description: "Display help information.", + description: "Display help information", }; const quiet: Fig.Option = { name: ["-q", "--quiet"], - description: "Do not output any message.", + description: "Do not output any message", }; const verbose: Fig.Option = { name: ["-v", "--verbose"], - description: "Increase the verbosity of messages.", + description: "Increase the verbosity of messages", }; const vverbose: Fig.Option = { name: "-vv", - description: "More verbose output.", + description: "More verbose output", }; const vvverbose: Fig.Option = { name: "-vvv", - description: "Debug output.", + description: "Debug output", }; const version: Fig.Option = { name: ["-V", "--version"], - description: "Display this application version.", + description: "Display this application version", }; const ansi: Fig.Option = { name: "--ansi", - description: "Force ANSI output.", + description: "Force ANSI output", }; const noAnsi: Fig.Option = { name: "--no-ansi", - description: "Disable ANSI output.", + description: "Disable ANSI output", }; const noInteraction: Fig.Option = { name: ["-n", "--no-interaction"], - description: "Do not ask any interactive question.", + description: "Do not ask any interactive question", }; const noPlugins: Fig.Option = { - name: ["--no-plugins"], - description: "Disables plugins.", + name: "--no-plugins", + description: "Disables plugins", }; const noCache: Fig.Option = { - name: ["--no-cache"], - description: "Disables poetry source caches.", + name: "--no-cache", + description: "Disables poetry source caches", }; const directory: Fig.Option = { - name: ["--directory"], - description: "The working directory for the poetry command.", + name: "--directory", + description: "The working directory for the poetry command", args: { name: "directory", }, @@ -78,127 +78,121 @@ const globalOptions: Fig.Option[] = [ const completionSpec: Fig.Spec = { name: "poetry", description: - "poetry is a tool for dependency management and packaging in Python.", + "Poetry is a tool for dependency management and packaging in Python", subcommands: [ { name: "about", - description: "Shows information about poetry.", - options: [], - args: [], + description: "Shows information about poetry", }, { name: "add", - description: "Adds a new dependency to pyproject.toml.", + description: "Adds a new dependency to pyproject.toml", options: [ - { name: "--group", description: "The group to add the dependency to." }, + { name: "--group", description: "The group to add the dependency to" }, { name: "--dev", description: - "Add as a development dependency. (Deprecated) Use --group=dev instead.", + "Add as a development dependency. (Deprecated) Use --group=dev instead", }, { name: "--editable", - description: "Add vcs/path dependencies as editable.", + description: "Add vcs/path dependencies as editable", }, { name: "--extras", - description: "Extras to activate for the dependency.", + description: "Extras to activate for the dependency", }, - { name: "--optional", description: "Add as an optional dependency." }, + { name: "--optional", description: "Add as an optional dependency" }, { name: "--python", description: - "Python version for which the dependency must be installed.", + "Python version for which the dependency must be installed", }, { name: "--platform", - description: "Platforms for which the dependency must be installed.", + description: "Platforms for which the dependency must be installed", }, { name: "--source", - description: "Name of the source to use to install the package.", + description: "Name of the source to use to install the package", }, - { name: "--allow-prereleases", description: "Accept prereleases." }, + { name: "--allow-prereleases", description: "Accept prereleases" }, { name: "--dry-run", description: - "Output the operations but do not execute anything (implicitly enables --verbose).", + "Output the operations but do not execute anything (implicitly enables --verbose)", }, { name: "--lock", - description: "Do not perform operations (only update the lockfile).", + description: "Do not perform operations (only update the lockfile)", }, ], - args: [{ name: "name", description: "The packages to add." }], + args: { name: "name", description: "The packages to add" }, }, { name: "build", - description: "Builds a package, as a tarball and a wheel by default.", + description: "Builds a package, as a tarball and a wheel by default", options: [ { name: "--format", - description: "Limit the format to either sdist or wheel.", + description: "Limit the format to either sdist or wheel", }, ], - args: [], }, { name: "check", - description: "Checks the validity of the pyproject.toml file.", - options: [], - args: [], + description: "Checks the validity of the pyproject.toml file", }, { name: "config", - description: "Manages configuration settings.", + description: "Manages configuration settings", options: [ - { name: "--list", description: "List configuration settings." }, - { name: "--unset", description: "Unset configuration setting." }, + { name: "--list", description: "List configuration settings" }, + { name: "--unset", description: "Unset configuration setting" }, { name: "--local", - description: "Set/Get from the project's local configuration.", + description: "Set/Get from the project's local configuration", }, ], args: [ - { name: "key", description: "Setting key." }, - { name: "value", description: "Setting value." }, + { name: "key", description: "Setting key" }, + { name: "value", description: "Setting value" }, ], }, { name: "init", description: - "Creates a basic pyproject.toml file in the current directory.", + "Creates a basic pyproject.toml file in the current directory", options: [ - { name: "--name", description: "Name of the package." }, - { name: "--description", description: "Description of the package." }, - { name: "--author", description: "Author name of the package." }, - { name: "--python", description: "Compatible Python versions." }, + { name: "--name", description: "Name of the package" }, + { name: "--description", description: "Description of the package" }, + { name: "--author", description: "Author name of the package" }, + { name: "--python", description: "Compatible Python versions" }, { name: "--dependency", description: - "Package to require, with an optional version constraint, e.g. requests:^2.10.0 or requests=2.11.1.", + "Package to require, with an optional version constraint, e.g. requests:^2.10.0 or requests=2.11.1", }, { name: "--dev-dependency", description: - "Package to require for development, with an optional version constraint, e.g. requests:^2.10.0 or requests=2.11.1.", + "Package to require for development, with an optional version constraint, e.g. requests:^2.10.0 or requests=2.11.1", }, - { name: "--license", description: "License of the package." }, + { name: "--license", description: "License of the package" }, ], - args: [], }, { name: "install", - description: "Installs the project dependencies.", + description: "Installs the project dependencies", options: [ - { name: "--without", description: "The dependency groups to ignore." }, + { name: "--without", description: "The dependency groups to ignore" }, { name: "--with", - description: "The optional dependency groups to include.", + description: "The optional dependency groups to include", }, { name: "--only", - description: "The only dependency groups to include.", + description: "The only dependency groups to include", }, { name: "--no-dev", @@ -208,11 +202,11 @@ const completionSpec: Fig.Spec = { { name: "--sync", description: - "Synchronize the environment with the locked packages and the specified groups.", + "Synchronize the environment with the locked packages and the specified groups", }, { name: "--no-root", - description: "Do not install the root package (the current project).", + description: "Do not install the root package (the current project)", }, { name: "--no-directory", @@ -222,7 +216,7 @@ const completionSpec: Fig.Spec = { { name: "--dry-run", description: - "Output the operations but do not execute anything (implicitly enables --verbose).", + "Output the operations but do not execute anything (implicitly enables --verbose)", }, { name: "--remove-untracked", @@ -231,195 +225,186 @@ const completionSpec: Fig.Spec = { }, { name: "--extras", - description: "Extra sets of dependencies to install.", + description: "Extra sets of dependencies to install", }, { name: "--all-extras", - description: "Install all extra dependencies.", + description: "Install all extra dependencies", }, - { name: "--only-root", description: "Exclude all dependencies." }, + { name: "--only-root", description: "Exclude all dependencies" }, { name: "--compile", description: "Compile Python source files to bytecode. (This option has no effect if modern-installation is disabled because the old installer always compiles.)", }, ], - args: [], }, { name: "lock", - description: "Locks the project dependencies.", + description: "Locks the project dependencies", options: [ { name: "--no-update", - description: "Do not update locked versions, only refresh lock file.", + description: "Do not update locked versions, only refresh lock file", }, { name: "--check", description: - "Check that the poetry.lock file corresponds to the current version of pyproject.toml.", + "Check that the poetry.lock file corresponds to the current version of pyproject.toml", }, ], - args: [], }, { name: "new", - description: "Creates a new Python project at .", + description: "Creates a new Python project at ", options: [ - { name: "--name", description: "Set the resulting package name." }, - { name: "--src", description: "Use the src layout for the project." }, + { name: "--name", description: "Set the resulting package name" }, + { name: "--src", description: "Use the src layout for the project" }, { name: "--readme", description: "Specify the readme file format. One of md (default) or rst", }, ], - args: [ - { name: "path", description: "The path to create the project at." }, - ], + args: { name: "path", description: "The path to create the project at" }, }, { name: "publish", - description: "Publishes a package to a remote repository.", + description: "Publishes a package to a remote repository", options: [ { name: "--repository", - description: "The repository to publish the package to.", + description: "The repository to publish the package to", }, { name: "--username", - description: "The username to access the repository.", + description: "The username to access the repository", }, { name: "--password", - description: "The password to access the repository.", + description: "The password to access the repository", }, { name: "--cert", - description: "Certificate authority to access the repository.", + description: "Certificate authority to access the repository", }, { name: "--client-cert", - description: "Client certificate to access the repository.", + description: "Client certificate to access the repository", }, { name: "--build", - description: "Build the package before publishing.", + description: "Build the package before publishing", }, { name: "--dry-run", - description: "Perform all actions except upload the package.", + description: "Perform all actions except upload the package", }, { name: "--skip-existing", description: - "Ignore errors from files already existing in the repository.", + "Ignore errors from files already existing in the repository", }, ], - args: [], }, { name: "remove", - description: "Removes a package from the project dependencies.", + description: "Removes a package from the project dependencies", options: [ { name: "--group", - description: "The group to remove the dependency from.", + description: "The group to remove the dependency from", }, { name: "--dev", description: - "Remove a package from the development dependencies. (Deprecated) Use --group=dev instead.", + "Remove a package from the development dependencies. (Deprecated) Use --group=dev instead", }, { name: "--dry-run", description: - "Output the operations but do not execute anything (implicitly enables --verbose).", + "Output the operations but do not execute anything (implicitly enables --verbose)", }, { name: "--lock", - description: "Do not perform operations (only update the lockfile).", + description: "Do not perform operations (only update the lockfile)", }, ], - args: [{ name: "packages", description: "The packages to remove." }], + args: { name: "packages", description: "The packages to remove" }, }, { name: "run", - description: "Runs a command in the appropriate environment.", - options: [], - args: [ - { - name: "args", - description: "The command and arguments/options to run.", - }, - ], + description: "Runs a command in the appropriate environment", + + args: { + name: "args", + description: "The command and arguments/options to run", + }, }, { name: "search", - description: "Searches for packages on remote repositories.", - options: [], - args: [{ name: "tokens", description: "The tokens to search for." }], + description: "Searches for packages on remote repositories", + + args: { name: "tokens", description: "The tokens to search for" }, }, { name: "shell", - description: "Spawns a shell within the virtual environment.", - options: [], - args: [], + description: "Spawns a shell within the virtual environment", }, { name: "show", - description: "Shows information about packages.", + description: "Shows information about packages", options: [ - { name: "--without", description: "The dependency groups to ignore." }, + { name: "--without", description: "The dependency groups to ignore" }, { name: "--with", - description: "The optional dependency groups to include.", + description: "The optional dependency groups to include", }, { name: "--only", - description: "The only dependency groups to include.", + description: "The only dependency groups to include", }, { name: "--no-dev", description: "Do not list the development dependencies. (Deprecated)", }, - { name: "--tree", description: "List the dependencies as a tree." }, + { name: "--tree", description: "List the dependencies as a tree" }, { name: "--why", description: - "When showing the full list, or a --tree for a single package, also display why it's included.", + "When showing the full list, or a --tree for a single package, also display why it's included", }, - { name: "--latest", description: "Show the latest version." }, + { name: "--latest", description: "Show the latest version" }, { name: "--outdated", description: - "Show the latest version but only for packages that are outdated.", + "Show the latest version but only for packages that are outdated", }, { name: "--all", description: - "Show all packages (even those not compatible with current system).", + "Show all packages (even those not compatible with current system)", }, { name: "--top-level", - description: "Show only top-level dependencies.", + description: "Show only top-level dependencies", }, ], - args: [{ name: "package", description: "The package to inspect" }], + args: { name: "package", description: "The package to inspect" }, }, { name: "update", description: - "Update the dependencies as according to the pyproject.toml file.", + "Update the dependencies as according to the pyproject.toml file", options: [ - { name: "--without", description: "The dependency groups to ignore." }, + { name: "--without", description: "The dependency groups to ignore" }, { name: "--with", - description: "The optional dependency groups to include.", + description: "The optional dependency groups to include", }, { name: "--only", - description: "The only dependency groups to include.", + description: "The only dependency groups to include", }, { name: "--no-dev", @@ -429,233 +414,219 @@ const completionSpec: Fig.Spec = { { name: "--dry-run", description: - "Output the operations but do not execute anything (implicitly enables --verbose).", + "Output the operations but do not execute anything (implicitly enables --verbose)", }, { name: "--lock", - description: "Do not perform operations (only update the lockfile).", + description: "Do not perform operations (only update the lockfile)", }, ], - args: [{ name: "packages", description: "The packages to update" }], + args: { name: "packages", description: "The packages to update" }, }, { name: "version", description: - "Shows the version of the project or bumps it when a valid bump rule is provided.", + "Shows the version of the project or bumps it when a valid bump rule is provided", options: [ { name: "--short", description: "Output the version number only" }, { name: "--dry-run", description: "Do not update pyproject.toml file" }, ], - args: [ - { - name: "version", - description: "The version number or the rule to update the version.", - }, - ], + args: { + name: "version", + description: "The version number or the rule to update the version", + }, }, { name: "cache clear", - description: "Clears a poetry cache by name.", + description: "Clears a poetry cache by name", options: [ - { name: "--all", description: "Clear all entries in the cache." }, + { name: "--all", description: "Clear all entries in the cache" }, ], - args: [{ name: "cache", description: "The name of the cache to clear." }], + args: { name: "cache", description: "The name of the cache to clear" }, }, { name: "cache list", - description: "List poetry's caches.", - options: [], - args: [], + description: "List poetry's caches", }, { name: "debug info", - description: "Shows debug information.", - options: [], - args: [], + description: "Shows debug information", }, { name: "debug resolve", - description: "Debugs dependency resolution.", + description: "Debugs dependency resolution", options: [ { name: "--extras", - description: "Extras to activate for the dependency.", + description: "Extras to activate for the dependency", }, { name: "--python", - description: "Python version(s) to use for resolution.", + description: "Python version(s) to use for resolution", }, - { name: "--tree", description: "Display the dependency tree." }, + { name: "--tree", description: "Display the dependency tree" }, { name: "--install", - description: "Show what would be installed for the current system.", + description: "Show what would be installed for the current system", }, ], - args: [{ name: "package", description: "The packages to resolve." }], + args: { name: "package", description: "The packages to resolve" }, }, { name: "env info", - description: "Displays information about the current environment.", + description: "Displays information about the current environment", options: [ - { name: "--path", description: "Only display the environment's path." }, + { name: "--path", description: "Only display the environment's path" }, { name: "--executable", - description: "Only display the environment's python executable path.", + description: "Only display the environment's python executable path", }, ], - args: [], }, { name: "env list", - description: "Lists all virtualenvs associated with the current project.", + description: "Lists all virtualenvs associated with the current project", options: [ { name: "--full-path", - description: "Output the full paths of the virtualenvs.", + description: "Output the full paths of the virtualenvs", }, ], - args: [], }, { name: "env remove", - description: "Remove virtual environments associated with the project.", + description: "Remove virtual environments associated with the project", options: [ { name: "--all", description: - "Remove all managed virtual environments associated with the project.", - }, - ], - args: [ - { - name: "python", - description: - "The python executables associated with, or names of the virtual environments which are to be removed.", + "Remove all managed virtual environments associated with the project", }, ], + args: { + name: "python", + description: + "The python executables associated with, or names of the virtual environments which are to be removed", + }, }, { name: "env use", description: - "Activates or creates a new virtualenv for the current project.", - options: [], - args: [{ name: "python", description: "The python executable to use." }], + "Activates or creates a new virtualenv for the current project", + + args: { name: "python", description: "The python executable to use" }, }, { name: "self add", - description: "Add additional packages to poetry's runtime environment.", + description: "Add additional packages to poetry's runtime environment", options: [ { name: "--editable", - description: "Add vcs/path dependencies as editable.", + description: "Add vcs/path dependencies as editable", }, { name: "--extras", - description: "Extras to activate for the dependency.", + description: "Extras to activate for the dependency", }, { name: "--source", - description: "Name of the source to use to install the package.", + description: "Name of the source to use to install the package", }, - { name: "--allow-prereleases", description: "Accept prereleases." }, + { name: "--allow-prereleases", description: "Accept prereleases" }, { name: "--dry-run", description: - "Output the operations but do not execute anything (implicitly enables --verbose).", + "Output the operations but do not execute anything (implicitly enables --verbose)", }, ], - args: [{ name: "name", description: "The packages to add." }], + args: { name: "name", description: "The packages to add" }, }, { name: "self install", description: - "Install locked packages (incl. addons) required by this poetry installation.", + "Install locked packages (incl. addons) required by this poetry installation", options: [ { name: "--sync", description: - "Synchronize the environment with the locked packages and the specified groups.", + "Synchronize the environment with the locked packages and the specified groups", }, { name: "--dry-run", description: - "Output the operations but do not execute anything (implicitly enables --verbose).", + "Output the operations but do not execute anything (implicitly enables --verbose)", }, ], - args: [], }, { name: "self lock", - description: "Lock the poetry installation's system requirements.", + description: "Lock the poetry installation's system requirements", options: [ { name: "--no-update", - description: "Do not update locked versions, only refresh lock file.", + description: "Do not update locked versions, only refresh lock file", }, { name: "--check", description: - "Check that the poetry.lock file corresponds to the current version of pyproject.toml.", + "Check that the poetry.lock file corresponds to the current version of pyproject.toml", }, ], - args: [], }, { name: "self remove", description: - "Remove additional packages from poetry's runtime environment.", + "Remove additional packages from poetry's runtime environment", options: [ { name: "--dry-run", description: - "Output the operations but do not execute anything (implicitly enables --verbose).", + "Output the operations but do not execute anything (implicitly enables --verbose)", }, ], - args: [{ name: "packages", description: "The packages to remove." }], + args: { name: "packages", description: "The packages to remove" }, }, { name: "self update", - description: "Updates poetry to the latest version.", + description: "Updates poetry to the latest version", options: [ { name: "--preview", - description: "Allow the installation of pre-release versions.", + description: "Allow the installation of pre-release versions", }, { name: "--dry-run", description: - "Output the operations but do not execute anything (implicitly enables --verbose).", + "Output the operations but do not execute anything (implicitly enables --verbose)", }, ], - args: [{ name: "version", description: "The version to update to." }], + args: { name: "version", description: "The version to update to" }, }, { name: "self show", - description: "Show packages from poetry's runtime environment.", + description: "Show packages from poetry's runtime environment", options: [ { name: "--addons", - description: "List only add-on packages installed.", + description: "List only add-on packages installed", }, - { name: "--tree", description: "List the dependencies as a tree." }, - { name: "--latest", description: "Show the latest version." }, + { name: "--tree", description: "List the dependencies as a tree" }, + { name: "--latest", description: "Show the latest version" }, { name: "--outdated", description: - "Show the latest version but only for packages that are outdated.", + "Show the latest version but only for packages that are outdated", }, ], - args: [{ name: "package", description: "The package to inspect" }], + args: { name: "package", description: "The package to inspect" }, }, { name: "self show plugins", - description: "Shows information about the currently installed plugins.", - options: [], - args: [], + description: "Shows information about the currently installed plugins", }, { name: "source add", - description: "Add source configuration for project.", + description: "Add source configuration for project", options: [ { name: "--default", @@ -670,35 +641,33 @@ const completionSpec: Fig.Spec = { { name: "--priority", description: - "Set the priority of this source. One of: default, primary, secondary, supplemental, explicit. Defaults to primary.", + "Set the priority of this source. One of: default, primary, secondary, supplemental, explicit. Defaults to primary", }, ], args: [ - { name: "name", description: "Source repository name." }, + { name: "name", description: "Source repository name" }, { name: "url", description: - "Source repository URL. Required, except for PyPI, for which it is not allowed.", + "Source repository URL. Required, except for PyPI, for which it is not allowed", }, ], }, { name: "source remove", - description: "Remove source configured for the project.", - options: [], - args: [{ name: "name", description: "Source repository name." }], + description: "Remove source configured for the project", + + args: { name: "name", description: "Source repository name" }, }, { name: "source show", - description: "Show information about sources configured for the project.", - options: [], - args: [ - { - name: "source", - description: - "Source(s) to show information for. Defaults to showing all sources.", - }, - ], + description: "Show information about sources configured for the project", + + args: { + name: "source", + description: + "Source(s) to show information for. Defaults to showing all sources", + }, }, ], options: [...globalOptions], From 7304ccaeedf03af9c73b4bf9a27df784571bf67c Mon Sep 17 00:00:00 2001 From: Volodymyr Pivoshenko Date: Sat, 1 Jul 2023 23:22:49 +0100 Subject: [PATCH 3/7] fix(poetry): update global options --- src/poetry.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/poetry.ts b/src/poetry.ts index 8fec14339d6..fd52edfa83f 100644 --- a/src/poetry.ts +++ b/src/poetry.ts @@ -73,6 +73,7 @@ const globalOptions: Fig.Option[] = [ noPlugins, noCache, directory, + quiet, ]; const completionSpec: Fig.Spec = { From 3aebd81653d53aa4544e5af20f4f042011ea5c68 Mon Sep 17 00:00:00 2001 From: Volodymyr Pivoshenko Date: Sun, 2 Jul 2023 16:56:13 +0100 Subject: [PATCH 4/7] fix(poetry): update sub-commands --- src/poetry.ts | 553 ++++++++++++++++++++++++++++---------------------- 1 file changed, 310 insertions(+), 243 deletions(-) diff --git a/src/poetry.ts b/src/poetry.ts index fd52edfa83f..8736fadf870 100644 --- a/src/poetry.ts +++ b/src/poetry.ts @@ -84,11 +84,13 @@ const completionSpec: Fig.Spec = { { name: "about", description: "Shows information about poetry", + options: [...globalOptions], }, { name: "add", description: "Adds a new dependency to pyproject.toml", options: [ + ...globalOptions, { name: "--group", description: "The group to add the dependency to" }, { name: "--dev", @@ -134,20 +136,47 @@ const completionSpec: Fig.Spec = { name: "build", description: "Builds a package, as a tarball and a wheel by default", options: [ + ...globalOptions, { name: "--format", description: "Limit the format to either sdist or wheel", }, ], }, + { + name: "cache", + description: + "The cache command regroups sub commands to interact with poetry's cache", + subcommands: [ + { + name: "clear", + description: "Clears a poetry cache by name", + options: [ + ...globalOptions, + { name: "--all", description: "Clear all entries in the cache" }, + ], + args: { + name: "cache", + description: "The name of the cache to clear", + }, + }, + { + name: "list", + description: "List poetry's caches", + options: [...globalOptions], + }, + ], + }, { name: "check", description: "Checks the validity of the pyproject.toml file", + options: [...globalOptions], }, { name: "config", description: "Manages configuration settings", options: [ + ...globalOptions, { name: "--list", description: "List configuration settings" }, { name: "--unset", description: "Unset configuration setting" }, { @@ -160,11 +189,106 @@ const completionSpec: Fig.Spec = { { name: "value", description: "Setting value" }, ], }, + { + name: "debug", + description: + "The debug command regroups sub commands to interact with debug session", + subcommands: [ + { + name: "info", + description: "Shows debug information", + options: [...globalOptions], + }, + { + name: "resolve", + description: "Debugs dependency resolution", + options: [ + ...globalOptions, + { + name: "--extras", + description: "Extras to activate for the dependency", + }, + { + name: "--python", + description: "Python version(s) to use for resolution", + }, + { name: "--tree", description: "Display the dependency tree" }, + { + name: "--install", + description: + "Show what would be installed for the current system", + }, + ], + args: { name: "package", description: "The packages to resolve" }, + }, + ], + }, + { + name: "env", + description: + "The env command regroups sub commands to interact with the virtualenvs associated with a specific project", + subcommands: [ + { + name: "info", + description: "Displays information about the current environment", + options: [ + ...globalOptions, + { + name: "--path", + description: "Only display the environment's path", + }, + { + name: "--executable", + description: + "Only display the environment's python executable path", + }, + ], + }, + { + name: "list", + description: + "Lists all virtualenvs associated with the current project", + options: [ + ...globalOptions, + { + name: "--full-path", + description: "Output the full paths of the virtualenvs", + }, + ], + }, + { + name: "remove", + description: + "Remove virtual environments associated with the project", + options: [ + ...globalOptions, + { + name: "--all", + description: + "Remove all managed virtual environments associated with the project", + }, + ], + args: { + name: "python", + description: + "The python executables associated with, or names of the virtual environments which are to be removed", + }, + }, + { + name: "use", + description: + "Activates or creates a new virtualenv for the current project", + options: [...globalOptions], + args: { name: "python", description: "The python executable to use" }, + }, + ], + }, { name: "init", description: "Creates a basic pyproject.toml file in the current directory", options: [ + ...globalOptions, { name: "--name", description: "Name of the package" }, { name: "--description", description: "Description of the package" }, { name: "--author", description: "Author name of the package" }, @@ -186,6 +310,7 @@ const completionSpec: Fig.Spec = { name: "install", description: "Installs the project dependencies", options: [ + ...globalOptions, { name: "--without", description: "The dependency groups to ignore" }, { name: "--with", @@ -228,10 +353,7 @@ const completionSpec: Fig.Spec = { name: "--extras", description: "Extra sets of dependencies to install", }, - { - name: "--all-extras", - description: "Install all extra dependencies", - }, + { name: "--all-extras", description: "Install all extra dependencies" }, { name: "--only-root", description: "Exclude all dependencies" }, { name: "--compile", @@ -244,6 +366,7 @@ const completionSpec: Fig.Spec = { name: "lock", description: "Locks the project dependencies", options: [ + ...globalOptions, { name: "--no-update", description: "Do not update locked versions, only refresh lock file", @@ -259,6 +382,7 @@ const completionSpec: Fig.Spec = { name: "new", description: "Creates a new Python project at ", options: [ + ...globalOptions, { name: "--name", description: "Set the resulting package name" }, { name: "--src", description: "Use the src layout for the project" }, { @@ -273,6 +397,7 @@ const completionSpec: Fig.Spec = { name: "publish", description: "Publishes a package to a remote repository", options: [ + ...globalOptions, { name: "--repository", description: "The repository to publish the package to", @@ -293,10 +418,7 @@ const completionSpec: Fig.Spec = { name: "--client-cert", description: "Client certificate to access the repository", }, - { - name: "--build", - description: "Build the package before publishing", - }, + { name: "--build", description: "Build the package before publishing" }, { name: "--dry-run", description: "Perform all actions except upload the package", @@ -312,6 +434,7 @@ const completionSpec: Fig.Spec = { name: "remove", description: "Removes a package from the project dependencies", options: [ + ...globalOptions, { name: "--group", description: "The group to remove the dependency from", @@ -336,7 +459,7 @@ const completionSpec: Fig.Spec = { { name: "run", description: "Runs a command in the appropriate environment", - + options: [...globalOptions], args: { name: "args", description: "The command and arguments/options to run", @@ -345,17 +468,138 @@ const completionSpec: Fig.Spec = { { name: "search", description: "Searches for packages on remote repositories", - + options: [...globalOptions], args: { name: "tokens", description: "The tokens to search for" }, }, + { + name: "self", + description: + "The self namespace regroups sub commands to manage the poetry installation itself", + subcommands: [ + { + name: "add", + description: + "Add additional packages to poetry's runtime environment", + options: [ + ...globalOptions, + { + name: "--editable", + description: "Add vcs/path dependencies as editable", + }, + { + name: "--extras", + description: "Extras to activate for the dependency", + }, + { + name: "--source", + description: "Name of the source to use to install the package", + }, + { name: "--allow-prereleases", description: "Accept prereleases" }, + { + name: "--dry-run", + description: + "Output the operations but do not execute anything (implicitly enables --verbose)", + }, + ], + args: { name: "name", description: "The packages to add" }, + }, + { + name: "install", + description: + "Install locked packages (incl. addons) required by this poetry installation", + options: [ + ...globalOptions, + { + name: "--sync", + description: + "Synchronize the environment with the locked packages and the specified groups", + }, + { + name: "--dry-run", + description: + "Output the operations but do not execute anything (implicitly enables --verbose)", + }, + ], + }, + { + name: "lock", + description: "Lock the poetry installation's system requirements", + options: [ + ...globalOptions, + { + name: "--no-update", + description: + "Do not update locked versions, only refresh lock file", + }, + { + name: "--check", + description: + "Check that the poetry.lock file corresponds to the current version of pyproject.toml", + }, + ], + }, + { + name: "remove", + description: + "Remove additional packages from poetry's runtime environment", + options: [ + ...globalOptions, + { + name: "--dry-run", + description: + "Output the operations but do not execute anything (implicitly enables --verbose)", + }, + ], + args: { name: "packages", description: "The packages to remove" }, + }, + { + name: "show", + description: "Show packages from poetry's runtime environment", + options: [ + ...globalOptions, + { + name: "--addons", + description: "List only add-on packages installed", + }, + { name: "--tree", description: "List the dependencies as a tree" }, + { name: "--latest", description: "Show the latest version" }, + { + name: "--outdated", + description: + "Show the latest version but only for packages that are outdated", + }, + ], + args: { name: "package", description: "The package to inspect" }, + }, + { + name: "update", + description: "Updates poetry to the latest version", + options: [ + ...globalOptions, + { + name: "--preview", + description: "Allow the installation of pre-release versions", + }, + { + name: "--dry-run", + description: + "Output the operations but do not execute anything (implicitly enables --verbose)", + }, + ], + args: { name: "version", description: "The version to update to" }, + }, + ], + }, { name: "shell", description: "Spawns a shell within the virtual environment", + options: [...globalOptions], }, { name: "show", description: "Shows information about packages", options: [ + ...globalOptions, { name: "--without", description: "The dependency groups to ignore" }, { name: "--with", @@ -393,11 +637,66 @@ const completionSpec: Fig.Spec = { ], args: { name: "package", description: "The package to inspect" }, }, + { + name: "source", + description: + "The source namespace regroups sub commands to manage repository sources for a poetry project", + subcommands: [ + { + name: "add", + description: "Add source configuration for project", + options: [ + ...globalOptions, + { + name: "--default", + description: + "Set this source as the default (disable PyPI). A default source will also be the fallback source if you add other sources. (Deprecated, use --priority)", + }, + { + name: "--secondary", + description: + "Set this source as secondary. (Deprecated, use --priority)", + }, + { + name: "--priority", + description: + "Set the priority of this source. One of: default, primary, secondary, supplemental, explicit. Defaults to primary", + }, + ], + args: [ + { name: "name", description: "Source repository name" }, + { + name: "url", + description: + "Source repository URL. Required, except for PyPI, for which it is not allowed", + }, + ], + }, + { + name: "remove", + description: "Remove source configured for the project", + options: [...globalOptions], + args: { name: "name", description: "Source repository name" }, + }, + { + name: "show", + description: + "Show information about sources configured for the project", + options: [...globalOptions], + args: { + name: "source", + description: + "Source(s) to show information for. Defaults to showing all sources", + }, + }, + ], + }, { name: "update", description: "Update the dependencies as according to the pyproject.toml file", options: [ + ...globalOptions, { name: "--without", description: "The dependency groups to ignore" }, { name: "--with", @@ -429,6 +728,7 @@ const completionSpec: Fig.Spec = { description: "Shows the version of the project or bumps it when a valid bump rule is provided", options: [ + ...globalOptions, { name: "--short", description: "Output the version number only" }, { name: "--dry-run", description: "Do not update pyproject.toml file" }, ], @@ -437,239 +737,6 @@ const completionSpec: Fig.Spec = { description: "The version number or the rule to update the version", }, }, - { - name: "cache clear", - description: "Clears a poetry cache by name", - options: [ - { name: "--all", description: "Clear all entries in the cache" }, - ], - args: { name: "cache", description: "The name of the cache to clear" }, - }, - { - name: "cache list", - description: "List poetry's caches", - }, - { - name: "debug info", - description: "Shows debug information", - }, - { - name: "debug resolve", - description: "Debugs dependency resolution", - options: [ - { - name: "--extras", - description: "Extras to activate for the dependency", - }, - { - name: "--python", - description: "Python version(s) to use for resolution", - }, - { name: "--tree", description: "Display the dependency tree" }, - { - name: "--install", - description: "Show what would be installed for the current system", - }, - ], - args: { name: "package", description: "The packages to resolve" }, - }, - { - name: "env info", - description: "Displays information about the current environment", - options: [ - { name: "--path", description: "Only display the environment's path" }, - { - name: "--executable", - description: "Only display the environment's python executable path", - }, - ], - }, - { - name: "env list", - description: "Lists all virtualenvs associated with the current project", - options: [ - { - name: "--full-path", - description: "Output the full paths of the virtualenvs", - }, - ], - }, - { - name: "env remove", - description: "Remove virtual environments associated with the project", - options: [ - { - name: "--all", - description: - "Remove all managed virtual environments associated with the project", - }, - ], - args: { - name: "python", - description: - "The python executables associated with, or names of the virtual environments which are to be removed", - }, - }, - { - name: "env use", - description: - "Activates or creates a new virtualenv for the current project", - - args: { name: "python", description: "The python executable to use" }, - }, - { - name: "self add", - description: "Add additional packages to poetry's runtime environment", - options: [ - { - name: "--editable", - description: "Add vcs/path dependencies as editable", - }, - { - name: "--extras", - description: "Extras to activate for the dependency", - }, - { - name: "--source", - description: "Name of the source to use to install the package", - }, - { name: "--allow-prereleases", description: "Accept prereleases" }, - { - name: "--dry-run", - description: - "Output the operations but do not execute anything (implicitly enables --verbose)", - }, - ], - args: { name: "name", description: "The packages to add" }, - }, - { - name: "self install", - description: - "Install locked packages (incl. addons) required by this poetry installation", - options: [ - { - name: "--sync", - description: - "Synchronize the environment with the locked packages and the specified groups", - }, - { - name: "--dry-run", - description: - "Output the operations but do not execute anything (implicitly enables --verbose)", - }, - ], - }, - { - name: "self lock", - description: "Lock the poetry installation's system requirements", - options: [ - { - name: "--no-update", - description: "Do not update locked versions, only refresh lock file", - }, - { - name: "--check", - description: - "Check that the poetry.lock file corresponds to the current version of pyproject.toml", - }, - ], - }, - { - name: "self remove", - description: - "Remove additional packages from poetry's runtime environment", - options: [ - { - name: "--dry-run", - description: - "Output the operations but do not execute anything (implicitly enables --verbose)", - }, - ], - args: { name: "packages", description: "The packages to remove" }, - }, - { - name: "self update", - description: "Updates poetry to the latest version", - options: [ - { - name: "--preview", - description: "Allow the installation of pre-release versions", - }, - { - name: "--dry-run", - description: - "Output the operations but do not execute anything (implicitly enables --verbose)", - }, - ], - args: { name: "version", description: "The version to update to" }, - }, - { - name: "self show", - description: "Show packages from poetry's runtime environment", - options: [ - { - name: "--addons", - description: "List only add-on packages installed", - }, - { name: "--tree", description: "List the dependencies as a tree" }, - { name: "--latest", description: "Show the latest version" }, - { - name: "--outdated", - description: - "Show the latest version but only for packages that are outdated", - }, - ], - args: { name: "package", description: "The package to inspect" }, - }, - { - name: "self show plugins", - description: "Shows information about the currently installed plugins", - }, - { - name: "source add", - description: "Add source configuration for project", - options: [ - { - name: "--default", - description: - "Set this source as the default (disable PyPI). A default source will also be the fallback source if you add other sources. (Deprecated, use --priority)", - }, - { - name: "--secondary", - description: - "Set this source as secondary. (Deprecated, use --priority)", - }, - { - name: "--priority", - description: - "Set the priority of this source. One of: default, primary, secondary, supplemental, explicit. Defaults to primary", - }, - ], - args: [ - { name: "name", description: "Source repository name" }, - { - name: "url", - description: - "Source repository URL. Required, except for PyPI, for which it is not allowed", - }, - ], - }, - { - name: "source remove", - description: "Remove source configured for the project", - - args: { name: "name", description: "Source repository name" }, - }, - { - name: "source show", - description: "Show information about sources configured for the project", - - args: { - name: "source", - description: - "Source(s) to show information for. Defaults to showing all sources", - }, - }, ], options: [...globalOptions], // Only uncomment if poetry takes an argument From e4fcfd91c7e26ded403f07e690a8ab05300007d1 Mon Sep 17 00:00:00 2001 From: Volodymyr Pivoshenko <40499728+volopivoshenko@users.noreply.github.com> Date: Wed, 16 Aug 2023 10:34:26 +0000 Subject: [PATCH 5/7] docs: update list of contributors --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 08724836327..383888779e5 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -282,6 +282,15 @@ "contributions": [ "code" ] + }, + { + "login": "volopivoshenko", + "name": "Volodymyr Pivoshenko", + "avatar_url": "https://avatars.githubusercontent.com/u/40499728?v=4", + "profile": "https://github.com/volopivoshenko", + "contributions": [ + "code" + ] } ] } From cfab6ff58a383f72641d2d457081b7d15f37738c Mon Sep 17 00:00:00 2001 From: Volodymyr Pivoshenko Date: Sun, 20 Aug 2023 12:33:39 +0100 Subject: [PATCH 6/7] feat: add `mypy` spec --- src/mypy.ts | 407 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 407 insertions(+) create mode 100644 src/mypy.ts diff --git a/src/mypy.ts b/src/mypy.ts new file mode 100644 index 00000000000..e3c2eba5af5 --- /dev/null +++ b/src/mypy.ts @@ -0,0 +1,407 @@ +const completionSpec: Fig.Spec = { + name: "mypy", + description: "Mypy is a static type checker for Python", + options: [ + { + name: "--module", + description: "Asks mypy to type check the provided module", + }, + { + name: "--package", + description: "Asks mypy to type check the provided package", + }, + { + name: "--command", + description: "Asks mypy to type check the provided string as a program", + }, + { + name: "--exclude", + description: + "A regular expression that matches file names, directory names and paths which mypy should ignore while recursively discovering files to check", + }, + { name: "--help", description: "Show help message and exit" }, + { name: "--verbose", description: "More verbose messages" }, + { + name: "--version", + description: "Show program's version number and exit", + }, + { + name: "--config-file", + description: + "This flag makes mypy read configuration settings from the given file", + }, + { + name: "--warn-unused-configs", + description: + "This flag makes mypy warn about unused [mypy-] config file sections", + }, + { + name: "--explicit-package-bases", + description: + "This flag tells mypy that top-level packages will be based in either the current directory, or a member of the MYPYPATH environment variable", + }, + { + name: "--ignore-missing-imports", + description: "This flag makes mypy ignore all missing imports", + }, + { + name: "silent", + description: + "This flag adjusts how mypy follows imported modules that were not explicitly passed in via the command line", + }, + { + name: "--python-executable", + description: + "This flag will have mypy collect type information from PEP561 compliant packages installed for the Python executable EXECUTABLE", + }, + { + name: "--no-site-packages", + description: + "This flag will disable searching for PEP561 compliant packages", + }, + { + name: "--no-silence-site-packages", + description: + "By default, mypy will suppress any error messages generated within PEP561 compliant packages", + }, + { + name: "--fast-module-lookup", + description: + "The default logic used to scan through search paths to resolve imports has a quadratic worse-case behavior in some cases, which is for instance triggered by a large number of folders sharing", + }, + { + name: "--no-namespace-packages", + description: + "This flag disables import discovery of namespace packages (see PEP420)", + }, + { + name: "--python-version", + description: + "This flag will make mypy type check your code as if it were run under Python version X", + }, + { + name: "--platform", + description: + "This flag will make mypy type check your code as if it were run under the given operating system", + }, + { + name: "--always-true", + description: + "This flag will treat all variables named NAME as compile-time constants that are always true", + }, + { + name: "--always-false", + description: + "This flag will treat all variables named NAME as compile-time constants that are always false", + }, + { + name: "--disallow-any-unimported", + description: + "This flag disallows usage of types that come from unfollowed imports (such types become aliases for Any)", + }, + { + name: "--disallow-any-expr", + description: + "This flag disallows all expressions in the module that have type Any", + }, + { + name: "--disallow-any-decorated", + description: + "This flag disallows functions that have Any in their signature after decorator transformation", + }, + { + name: "--disallow-any-explicit", + description: + "This flag disallows explicit Any in type positions such as type annotations and generic type parameters", + }, + { + name: "--disallow-any-generics", + description: + "This flag disallows usage of generic types that do not specify explicit type parameters", + }, + { + name: "--disallow-subclassing-any", + description: + "This flag reports an error whenever a class subclasses a value of type Any", + }, + { + name: "--disallow-untyped-calls", + description: + "This flag reports an error whenever a function with type annotations calls a function defined without annotations", + }, + { + name: "--untyped-calls-exclude", + description: + "This flag allows to selectively disable option--disallow-untyped-calls for functions and methods defined in specific packages, modules, or classes", + }, + { + name: "--disallow-untyped-defs", + description: + "This flag reports an error whenever it encounters a function definition without type annotations or with incomplete type annotations", + }, + { + name: "--disallow-incomplete-defs", + description: + "This flag reports an error whenever it encounters a partly annotated function definition, while still allowing entirely unannotated definitions", + }, + { + name: "--check-untyped-defs", + description: + "This flag is less severe than the previous two options -- it type checks the body of every function, regardless of whether it has type annotations", + }, + { + name: "--disallow-untyped-decorators", + description: + "This flag reports an error whenever a function with type annotations is decorated with a decorator without annotations", + }, + { + name: "--implicit-optional", + description: + "This flag causes mypy to treat arguments with a None default value as having an implicit pydata~typing", + }, + { + name: "--no-strict-optional", + description: "This flag disables strict checking of pydata~typing", + }, + { + name: "--warn-redundant-casts", + description: + "This flag will make mypy report an error whenever your code uses an unnecessary cast that can safely be removed", + }, + { + name: "--warn-unused-ignores", + description: + "This flag will make mypy report an error whenever your code uses a # type ignore comment on a line that is not actually generating an error message", + }, + { + name: "--no-warn-no-return", + description: + "By default, mypy will generate errors when a function is missing return statements in some execution paths", + }, + { + name: "--warn-return-any", + description: + "This flag causes mypy to generate a warning when returning a value with type Any from a function declared with a non-Any return type", + }, + { + name: "--warn-unreachable", + description: + "This flag will make mypy report an error whenever it encounters code determined to be unreachable or redundant after performing type analysis", + }, + { + name: "--allow-untyped-globals", + description: + "This flag causes mypy to suppress errors caused by not being able to fully infer the types of global and class variables", + }, + { + name: "--allow-redefinition", + description: + "By default, mypy won't allow a variable to be redefined with an unrelated type", + }, + { + name: "--local-partial-types", + description: + "In mypy, the most common cases for partial types are variables initialized using None, but without explicit Optional annotations", + }, + { + name: "--no-implicit-reexport", + description: + "By default, imported values to a module are treated as exported and mypy allows other modules to import them", + }, + { + name: "--strict-equality", + description: + "By default, mypy allows always-false comparisons like 42 == 'no'", + }, + { + name: "--extra-checks", + description: + "This flag enables additional checks that are technically correct but may be impractical in real code", + }, + { + name: "--strict", + description: "This flag mode enables all optional error checking flags", + }, + { + name: "--disable-error-code", + description: + "This flag allows disabling one or multiple error codes globally", + }, + { + name: "--enable-error-code", + description: + "This flag allows enabling one or multiple error codes globally", + }, + { + name: "--show-error-context", + description: + "This flag will precede all errors with 'note' messages explaining the context of the error", + }, + { + name: "--show-column-numbers", + description: "This flag will add column offsets to error messages", + }, + { + name: "--show-error-end", + description: + "This flag will make mypy show not just that start position where an error was detected, but also the end position of the relevant expression", + }, + { + name: "--hide-error-codes", + description: + "This flag will hide the error code [] from error messages", + }, + { + name: "--pretty", + description: + "Use visually nicer output in error messages use soft word wrap, show source code snippets, and show error location markers", + }, + { + name: "--no-color-output", + description: + "This flag will disable color output in error messages, enabled by default", + }, + { + name: "--no-error-summary", + description: "This flag will disable error summary", + }, + { + name: "--show-absolute-path", + description: "Show absolute paths to files", + }, + { + name: "--soft-error-limit", + description: + "This flag will adjust the limit after which mypy will (sometimes) disable reporting most additional errors", + }, + { + name: "--no-incremental", + description: + "This flag disables incremental mode mypy will no longer reference the cache when re-run", + }, + { + name: "--cache-dir", + description: + "By default, mypy stores all cache data inside of a folder named", + }, + { + name: "--sqlite-cache", + description: "Use an SQLite_ database to store the cache", + }, + { + name: "--cache-fine-grained", + description: + "Include fine-grained dependency information in the cache for the mypy daemon", + }, + { + name: "--skip-version-check", + description: + "By default, mypy will ignore cache data generated by a different version of mypy", + }, + { + name: "--skip-cache-mtime-checks", + description: "Skip cache internal consistency checks based on mtime", + }, + { + name: "--pdb", + description: + "This flag will invoke the Python debugger when mypy encounters a fatal error", + }, + { + name: "--tb", + description: + "If set, this flag will display a full traceback when mypy encounters a fatal error", + }, + { + name: "--raise-exceptions", + description: "Raise exception on fatal error", + }, + { + name: "--custom-typing-module", + description: + "This flag lets you use a custom module as a substitute for the pymodtyping module", + }, + { + name: "--custom-typeshed-dir", + description: + "This flag specifies the directory where mypy looks for standard library typeshed stubs, instead of the typeshed that ships with mypy", + }, + { + name: "--warn-incomplete-stub", + description: + "This flag modifies both the option--disallow-untyped-defs and option--disallow-incomplete-defs flags so they also report errors if stubs in typeshed are missing type annotations or has incomplete annotations", + }, + { + name: "--shadow-file", + description: + "When mypy is asked to type check SOURCE_FILE, this flag makes mypy read from and type check the contents of SHADOW_FILE instead", + }, + { + name: "--any-exprs-report", + description: + "Causes mypy to generate a text file report documenting how many expressions of type Any are present within your codebase", + }, + { + name: "--cobertura-xml-report", + description: + "Causes mypy to generate a Cobertura XML type checking coverage report", + }, + { + name: "--html-report", + description: + "Causes mypy to generate an HTML type checking coverage report", + }, + { + name: "--linecount-report", + description: + "Causes mypy to generate a text file report documenting the functions and lines that are typed and untyped within your codebase", + }, + { + name: "--linecoverage-report", + description: + "Causes mypy to generate a JSON file that maps each source file's absolute filename to a list of line numbers that belong to typed functions in that file", + }, + { + name: "--lineprecision-report", + description: + "Causes mypy to generate a flat text file report with per-module statistics of how many lines are typechecked etc", + }, + { + name: "--txt-report", + description: + "Causes mypy to generate a text file type checking coverage report", + }, + { + name: "--xml-report", + description: + "Causes mypy to generate an XML type checking coverage report", + }, + { + name: "--install-types", + description: + "This flag causes mypy to install known missing stub packages for third-party libraries using pip", + }, + { + name: "--non-interactive", + description: + "When used together with option--install-types , this causes mypy to install all suggested stub packages using pip without asking for confirmation, and then continues to perform type checking using the installed stubs, if some files or modules are provided to type check", + }, + { + name: "--junit-xml", + description: + "Causes mypy to generate a JUnit XML test result document with type checking results", + }, + { + name: "--find-occurrences", + description: + "This flag will make mypy print out all usages of a class member based on static type information", + }, + { + name: "--scripts-are-modules", + description: + "This flag will give command line arguments that appear to be scripts", + }, + ], +}; + +export default completionSpec; From 40fab23d1378f7be4ad875c346aa20a0fbaf2bc7 Mon Sep 17 00:00:00 2001 From: Volodymyr Pivoshenko Date: Fri, 19 Apr 2024 09:13:28 +0100 Subject: [PATCH 7/7] chore: update contributors list --- .all-contributorsrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 383888779e5..f31ef68a4f7 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -284,10 +284,10 @@ ] }, { - "login": "volopivoshenko", + "login": "pivoshenko", "name": "Volodymyr Pivoshenko", "avatar_url": "https://avatars.githubusercontent.com/u/40499728?v=4", - "profile": "https://github.com/volopivoshenko", + "profile": "https://github.com/pivoshenko", "contributions": [ "code" ]