Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ You could consider [this template](https://github.com/pawamoy/copier-uv) or [thi

If you're using Cookiecutter, then you can update to a latest version of a template using a tool like [cruft](https://github.com/cruft/cruft). Copier has inbuilt support for template updating. Another template-style option which provides updating is [jaraco/skeleton](https://blog.jaraco.com/skeleton/), which is a specific, git-based template rather than a general templating system.

If you're not interested in templating automations, then [configurator](https://github.com/jamesbraza/configurator) provides a list of useful tooling and configuration to consider for your Python projects.
If you're not interested in templating automations, then [configurator](https://github.com/jamesbraza/configurator) provides a list of useful tooling and configuration to consider for your Python projects. If you're adopting a specific framework like Django, FastAPI, Dagster, or Flask, [this list](https://usethis.readthedocs.io/en/stable/frameworks) gives options for initializing new projects via CLI.

## 🚀 Development

Expand Down
43 changes: 43 additions & 0 deletions docs/frameworks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Using Frameworks with usethis

If you are adopting a specific framework like Django, FastAPI, or Dagster, the following approaches may be useful to you. They require that you have `uv` installed. Please [open an issue](https://github.com/usethis-python/usethis-python/issues) is you use a framework which is not listed below.

## Django

[Django](https://docs.djangoproject.com/en/5.2/ref/django-admin/#startproject) has a built-in initialization command. It is recommended that you run the following sequence of commands to initialize a new Django project with usethis.

You should replace `myproject` with the name of your project, and run these commands from a new, empty directory (usually sharing your project name and set as the git repository root).

```bash
uvx --from django django-admin startproject myproject .
uv init --bare
uv add django
usethis init
```

You will be able to run the server with `uv run manage.py runserver`.

## FastAPI

[FastAPI](https://fastapi.tiangolo.com/) has an official CLI tool for initializing new projects called [`fastapi-new`](https://github.com/fastapi/fastapi-new) which you can use alongside usethis.

You should replace `myproject` with the name of your project, and run these commands from a new, empty directory (usually sharing your project name and set as the git repository root).

```bash
uvx fastapi-new myproject .
uvx usethis init
```

You will then be able to run the server with `uv run fastapi dev`.

## Dagster

[Dagster](https://docs.dagster.io/) has an official CLI tool for initializing new projects called [`create-dagster`](https://docs.dagster.io/api/clis/create-dagster) which you can use alongside usethis.

You should run these commands from a new, empty directory (usually sharing your project name and set as the git repository root).

```bash
uvx create-dagster project .
# At this point you will be prompted whether you want to use uv; answer 'y'.
uvx usethis init
```
2 changes: 1 addition & 1 deletion docs/similar-projects.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ You can still use usethis as a part of a templates using [hooks](https://cookiec

If you're using Cookiecutter, then you can update to a latest version of a template using a tool like [cruft](https://github.com/cruft/cruft). Copier has inbuilt support for template updating. Another template-style option which provides updating is [jaraco/skeleton](https://blog.jaraco.com/skeleton/), which is a specific, git-based template rather than a general templating system.

If you're not interested in templating automations, then [configurator](https://github.com/jamesbraza/configurator) provides a list of useful tooling and configuration to consider for your Python projects.
If you're not interested in templating automations, then [configurator](https://github.com/jamesbraza/configurator) provides a list of useful tooling and configuration to consider for your Python projects. If you're adopting a specific framework like Django, FastAPI, Dagster, or Flask, [this list](frameworks.md) gives options for initializing new projects via CLI.
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ nav:
- CLI Reference:
- Overview: cli/overview.md
- Reference: cli/reference.md
- With Other Frameworks: frameworks.md
- Similar Projects: similar-projects.md
- FAQ: faq.md
- License: about-license.md
Expand Down
7 changes: 6 additions & 1 deletion tests/docs/test_readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ def test_assemble_readme_from_docs(usethis_dev_dir: Path):
"](https://usethis.readthedocs.io/en/stable/cli/reference)",
)
)
parts.append(_get_doc_file(usethis_dev_dir / "docs" / "similar-projects.md"))
parts.append(
_get_doc_file(usethis_dev_dir / "docs" / "similar-projects.md").replace(
"](frameworks.md)",
"](https://usethis.readthedocs.io/en/stable/frameworks)",
)
)
parts.append(_get_doc_file(usethis_dev_dir / "docs" / "about-license.md"))

content = (
Expand Down