Initialize a new Python project with recommended defaults, including:
- a
pyproject.tomlfile and relevant configuration, - recommended linters, formatters, spellcheckers, and test frameworks (all opt-out),
- a recommended type checker (opt-in),
- docstring style enforcement (opt-in),
- a recommended git hook framework (opt-in),
- CI services (opt-in),
- declared & installed dependencies via
uv add, and - any other relevant directories or tool-bespoke configuration files.
Supported options:
-
--archto add recommended architecture analysis tools (but the default is--no-arch) -
--docto add recommended documentation tools (default; or--no-docto opt-out) -
--formatto add recommended formatters (default; or--no-formatto opt-out) -
--lintto add recommended linters (default; or--no-lintto opt-out) -
--spellcheckto add a recommended spellchecker (default; or--no-spellcheckto opt-out) -
--testto add a recommended testing framework (default; or--no-testto opt-out) -
--typecheckto add a recommended type checker (but the default is--no-typecheck) -
--hookto add a recommended git hook framework (but the default is--no-hook) -
--docstyleto set a docstring style convention for the project.Possible values:
numpyfor NumPy docstring stylegooglefor Google docstring stylepep257for PEP 257 docstring style
-
--statusto set the development status of the project. Defaults toplanning.Possible values:
planningor1for "Development Status :: 1 - Planning"pre-alphaor2for "Development Status :: 2 - Pre-Alpha"alphaor3for "Development Status :: 3 - Alpha"betaor4for "Development Status :: 4 - Beta"productionor5for "Development Status :: 5 - Production/Stable"matureor6for "Development Status :: 6 - Mature"inactiveor7for "Development Status :: 7 - Inactive"
-
--offlineto disable network access and rely on caches -
--quietto suppress output -
--frozento leave the virtual environment and lockfile unchanged (i.e. do not install dependencies, nor update lockfiles) -
--backendto specify a package manager backend to use. The default is to auto-detect.Possible values:
autoto auto-detect the backend (default)uvto use the uv package managernoneto not use a package manager backend and display messages for some operations.
-
--build-backendto specify the build backend for the project. Defaults tohatch.Possible values:
Add recommended architecture analysis tools to the project (namely, Import Linter), including:
- declared & installed dependencies via
uv add, - relevant configuration, and
- any other relevant directories or tool-bespoke configuration files.
Note if pyproject.toml is not present, it will be created, since this is required for declaring dependencies via uv add.
Supported options:
-
--removeto remove the tool instead of adding it -
--howto only print how to use the tool, with no other side effects -
--offlineto disable network access and rely on caches -
--frozento leave the virtual environment and lockfile unchanged -
--quietto suppress output -
--backendto specify a package manager backend to use. The default is to auto-detect.Possible values:
autoto auto-detect the backend (default)uvto use the uv package managernoneto not use a package manager backend and display messages for some operations.
See usethis tool for more information.
Add recommended documentation tools to the project (namely, MkDocs), including:
- declared & installed dependencies via
uv add, - relevant
pyproject.tomlconfiguration, and - any other relevant directories or tool-bespoke configuration files.
Note if pyproject.toml is not present, it will be created, since this is required for declaring dependencies via uv add.
Supported options:
--removeto remove the tool instead of adding it--howto only print how to use the tool, with no other side effects--offlineto disable network access and rely on caches--frozento leave the virtual environment and lockfile unchanged--quietto suppress output
See usethis tool for more information.
Add recommended formatters to the project (namely, Ruff and pyproject-fmt), including:
- declared & installed dependencies via
uv add, - relevant
pyproject.tomlconfiguration, and - any other relevant directories or tool-bespoke configuration files.
Note if pyproject.toml is not present, it will be created, since this is required for declaring dependencies via uv add.
Supported options:
-
--removeto remove the tool instead of adding it -
--howto only print how to use the tool, with no other side effects -
--offlineto disable network access and rely on caches -
--frozento leave the virtual environment and lockfile unchanged -
--quietto suppress output -
--backendto specify a package manager backend to use. The default is to auto-detect.Possible values:
autoto auto-detect the backend (default)uvto use the uv package managernoneto not use a package manager backend and display messages for some operations.
See usethis tool for more information.
Add a recommended git hook framework to the project (namely, pre-commit), including:
- declared & installed dependencies via
uv add, - relevant configuration, and
- any other relevant directories or tool-bespoke configuration files.
Note if pyproject.toml is not present, it will be created, since this is required for declaring dependencies via uv add.
Supported options:
-
--removeto remove the tool instead of adding it -
--howto only print how to use the tool, with no other side effects -
--offlineto disable network access and rely on caches -
--frozento leave the virtual environment and lockfile unchanged -
--quietto suppress output -
--backendto specify a package manager backend to use. The default is to auto-detect.Possible values:
autoto auto-detect the backend (default)uvto use the uv package managernoneto not use a package manager backend and display messages for some operations.
See usethis tool for more information.
Add recommended linters to the project (namely, Ruff and deptry), including:
- declared & installed dependencies with
uv add, - relevant
pyproject.tomlconfiguration, and - any other relevant directories or tool-bespoke configuration files.
Note if pyproject.toml is not present, it will be created, since this is required for declaring dependencies with uv add.
Supported options:
-
--removeto remove the tool instead of adding it -
--howto only print how to use the tool, with no other side effects -
--offlineto disable network access and rely on caches -
--frozento leave the virtual environment and lockfile unchanged -
--quietto suppress output -
--backendto specify a package manager backend to use. The default is to auto-detect.Possible values:
autoto auto-detect the backend (default)uvto use the uv package managernoneto not use a package manager backend and display messages for some operations.
See usethis tool for more information.
Add a recommended spellchecker to the project (namely, codespell), including:
- declared & installed dependencies with
uv add, - relevant
pyproject.tomlconfiguration, and - any other relevant directories or tool-bespoke configuration files.
Note if pyproject.toml is not present, it will be created, since this is required for declaring dependencies with uv add.
Supported options:
--removeto remove the tool instead of adding it--howto only print how to use the tool, with no other side effects--offlineto disable network access and rely on caches--frozento leave the virtual environment and lockfile unchanged--quietto suppress output--backendto specify a package manager backend to use. The default is to auto-detect. Possible values:autoto auto-detect the backend (default)uvto use the uv package managernoneto not use a package manager backend and display messages for some operations.
See usethis tool for more information.
Add a recommended testing framework to the project (namely pytest), including:
- declared & installed dependencies with
uv add, - relevant
pyproject.tomlconfiguration, and - any other relevant directories or tool-bespoke configuration files.
Note if pyproject.toml is not present, it will be created, since this is required for declaring dependencies with uv add.
Supported options:
--removeto remove the tool instead of adding it--howto only print how to use the tool, with no other side effects--offlineto disable network access and rely on caches--frozento leave the virtual environment and lockfile unchanged--quietto suppress output--backendto specify a package manager backend to use. The default is to auto-detect. Possible values:autoto auto-detect the backend (default)uvto use the uv package managernoneto not use a package manager backend and display messages for some operations.
See usethis tool for more information.
Add a recommended type checker to the project (namely, ty), including:
- declared & installed dependencies with
uv add, - relevant configuration, and
- any other relevant directories or tool-bespoke configuration files.
Note if pyproject.toml is not present, it will be created, since this is required for declaring dependencies with uv add.
Supported options:
-
--removeto remove the tool instead of adding it -
--howto only print how to use the tool, with no other side effects -
--offlineto disable network access and rely on caches -
--frozento leave the virtual environment and lockfile unchanged -
--quietto suppress output -
--backendto specify a package manager backend to use. The default is to auto-detect.Possible values:
autoto auto-detect the backend (default)uvto use the uv package managernoneto not use a package manager backend and display messages for some operations.
See usethis tool for more information.
Add a new tool to a Python project, including:
- declared & installed dependencies with
uv add, - relevant
pyproject.tomlconfiguration, - any other relevant directories or tool-bespoke configuration files, and
.pre-commit-config.yamlconfiguration if usingpre-commit.
Note if pyproject.toml is not present, it will be created, since this is required for
declaring dependencies with uv add.
usethis tool codespell- Use the codespell spellchecker: detect common spelling mistakes.usethis tool deptry- Use the deptry linter: avoid missing or superfluous dependency declarations.usethis tool import-linter- Use Import Linter: enforce a self-imposed architecture on imports.usethis tool pre-commit- Use the pre-commit framework to manage and maintain Git hooks. Note that this will also install all the hooks to Git.usethis tool pyproject-fmt- Use the pyproject-fmt formatter: opinionated formatting of 'pyproject.toml' files.usethis tool ruff- Use Ruff: an extremely fast Python linter and code formatter.usethis tool ty- Use ty: an extremely fast Python type checker.
usethis tool coverage.py- Use Coverage.py: a code coverage measurement tool.usethis tool pytest- Use the pytest testing framework.
usethis tool mkdocs- Use MkDocs: Generate project documentation sites with Markdown.
usethis tool pyproject.toml- Use a pyproject.toml file to configure the project.usethis tool requirements.txt- Use a requirements.txt file exported from the uv lockfile.
Supported options:
-
--removeto remove the tool instead of adding it -
--howto only print how to use the tool, with no other side effects -
--no-hookto skip adding or modifying git hook configuration (e.g. pre-commit) -
--offlineto disable network access and rely on caches -
--frozento leave the virtual environment and lockfile unchanged -
--quietto suppress output -
--backendto specify a package manager backend to use. The default is to auto-detect.Possible values:
autoto auto-detect the backend (default)uvto use the uv package managernoneto not use a package manager backend and display messages for some operations.
For usethis tool ruff, in addition to the above options, you can also specify:
--linterto add or remove specifically the linter component of Ruff (default; or--no-linterto opt-out)--formatterto add or remove specifically the formatter component of Ruff (default; or--no-formatterto opt-out)
Add badges to the README file.
Currently supported badges:
usethis badge bitbucket-usethis badge pre-commit-usethis badge pypi-usethis badge ruff-usethis badge socket-usethis badge ty-usethis badge usethis-usethis badge uv-
Supported options:
--showto show the badge URL instead of adding (or removing) it--removeto remove the badge instead of adding it--offlineto disable network access and rely on caches--quietto suppress output
Add a README.md file to the project.
Supported options:
-
--badgesto also add badges to the README.md file -
--quietto suppress output -
--backendto specify a package manager backend to use. The default is to auto-detect.Possible values:
autoto auto-detect the backend (default)uvto use the uv package managernoneto not use a package manager backend and display messages for some operations.
Set new author information for the project.
Required options:
--namefor the new author's name
Other supported options:
-
--emailto set the author email address -
--overwriteto overwrite all existing author information -
--quietto suppress output -
--backendto specify a package manager backend to use. The default is to auto-detect.Possible values:
autoto auto-detect the backend (default)uvto use the uv package managernoneto not use a package manager backend and display messages for some operations.
Set a docstring style convention for the project, and enforce it with Ruff.
Defaults to the Google docstring style.
Possible style options:
numpyfor NumPy docstring stylegooglefor Google docstring stylepep257for PEP 257 docstring style
Example:
usethis docstyle google
Supported options:
-
--offlineto disable network access and rely on caches -
--quietto suppress output -
--frozento leave the virtual environment and lockfile unchanged (i.e. do not install dependencies, nor update lockfiles) -
--backendto specify a package manager backend to use. The default is to auto-detect.Possible values:
autoto auto-detect the backend (default)uvto use the uv package managernoneto not use a package manager backend and display messages for some operations.
Add (or manage configuration) of Ruff and Deptry rules in pyproject.toml.
See the Ruff documentation for a list of available rules, and the Deptry documentation for a list of available rules.
Example:
usethis rule RUF001
Supported options:
-
--removeto remove the rule selection or ignore status. -
--ignoreto add the rule to the ignore list (or remove it if --remove is specified). -
--offlineto disable network access and rely on caches -
--quietto suppress output -
--backendto specify a package manager backend to use. The default is to auto-detect.Possible values:
autoto auto-detect the backend (default)uvto use the uv package managernoneto not use a package manager backend and display messages for some operations.
Set the development status of the project via trove classifiers.
Possible values (required):
usethis status planningorusethis status 1for "Development Status :: 1 - Planning"usethis status pre-alphaorusethis status 2for "Development Status :: 2 - Pre-Alpha"usethis status alphaorusethis status 3for "Development Status :: 3 - Alpha"usethis status betaorusethis status 4for "Development Status :: 4 - Beta"usethis status productionorusethis status 5for "Development Status :: 5 - Production/Stable"usethis status matureorusethis status 6for "Development Status :: 6 - Mature"usethis status inactiveorusethis status 7for "Development Status :: 7 - Inactive"
Supported options:
--badgesto add an associated badge to the README file--quietto suppress output
Display a table of all available tools and their current usage status.
Display the current version of usethis.
Show a piece of information about the project.
Currently supported subcommands:
usethis show backendto show the inferred project manager backend, e.g. 'uv' or 'none'. This is the default backend used, i.e. when--backend=autois specified.usethis show nameto show the name of the project.usethis show sonarqubeto show appropriate contents of asonar-project.propertiesfile for SonarQube analysis.
Show the contents of a sonar-project.properties file for SonarQube analysis.
If a sonar-project.properties file already exists in the project root, its contents are returned as-is. In this case, the --project-key option and tool.usethis.sonarqube.project-key in pyproject.toml are both ignored.
If no sonar-project.properties file exists, the contents are constructed from pyproject.toml configuration. In this case, a project key is required:
- If
--project-keyis provided, it is used. - Otherwise,
tool.usethis.sonarqube.project-keyfrompyproject.tomlis used.
Additional configuration in pyproject.toml:
tool.usethis.sonarqube.verbose(bool, defaultfalse) — setssonar.verbose.tool.usethis.sonarqube.exclusions(list of strings, default[]) — setssonar.exclusions.tool.coverage.xml.output(string, required) — setssonar.python.coverage.reportPaths.
Supported options:
--output-fileto write the output to a file instead of stdout.
Display or open the PyPI landing page associated with another project.
Example:
usethis browse pypi numpy
Supported options:
--browserto open the link in the browser automatically.