Skip to content

Commit

Permalink
feat(improved-templating): use cookiecutter's built-in booleans inste…
Browse files Browse the repository at this point in the history
…ad of "y" and "n"

also add mypy, uv, and some more "robust" error-checking code
  • Loading branch information
Karl Wooster committed Mar 12, 2024
1 parent 6523771 commit 6783de9
Show file tree
Hide file tree
Showing 16 changed files with 466 additions and 68 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -215,3 +215,7 @@ tags
.idea/

.pytest_cache/

# using uv means that requirements.txt can, nay should, be generated by user from requirements.in
# requirements.txt will *not* be platform-agnostic whereas requirements.in *will* be
requirements.txt
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ repos:
rev: v3.15.1
hooks:
- id: pyupgrade
args: [--py311-plus]
args: [--py312-plus]
exclude: hooks/

- repo: https://github.com/psf/black
Expand Down
10 changes: 9 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
{
"esbonio.sphinx.confDir": ""
"esbonio.sphinx.confDir": "",
"files.associations": {
"*.js": "jinja-javascript",
"javascript": "jinja-javascript",
"*.yml": "jinja-yaml",
"Dockerfile": "jinja-dockerfile",
"*.sh": "jinja-shell",
"shellscript": "jinja-shell",
},
}
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ production-ready Django projects quickly.

## Features

- For Django 4.2
- Works with Python 3.11
- For Django 5.0
- Works with Python 3.12
- Renders Django projects with 100% starting test coverage
- Twitter [Bootstrap](https://github.com/twbs/bootstrap) v5
- [12-Factor](https://12factor.net) based settings via [django-environ](https://github.com/joke2k/django-environ)
- Secure by default. We believe in SSL.
- Optimized development and production settings
- Registration via [django-allauth](https://github.com/pennersr/django-allauth)
- Comes with custom user model ready to go
- Optional basic ASGI setup for Websockets
- Optional basic ASGI setup for WebSockets
- Optional custom static build using Gulp or Webpack
- Send emails via [Anymail](https://github.com/anymail/django-anymail) (using [Mailgun](http://www.mailgun.com/) by default or Amazon SES if AWS is selected cloud provider, but switchable)
- Media storage using Amazon S3, Google Cloud Storage, Azure Storage or nginx
Expand Down Expand Up @@ -88,15 +88,15 @@ and then editing the results to include your name, email, and various configurat

First, get Cookiecutter. Trust me, it's awesome:

$ pip install "cookiecutter>=1.7.0"
$ pip install "cookiecutter"

Now run it against this repo:

$ cookiecutter https://github.com/cookiecutter/cookiecutter-django

You'll be prompted for some values. Provide them, then a Django project will be created for you.

**Warning**: After this point, change 'Daniel Greenfeld', 'pydanny', etc to your own information.
**Warning**: After this point, change 'Daniel Greenfeld', 'pydanny', etc. to your own information.

Answer the prompts with your own desired [options](http://cookiecutter-django.readthedocs.io/en/latest/project-generation-options.html). For example:

Expand Down Expand Up @@ -173,7 +173,7 @@ Answer the prompts with your own desired [options](http://cookiecutter-django.re
1 - None
2 - Travis
3 - Gitlab
4 - Github
4 - GitHub
Choose from 1, 2, 3, 4 [1]: 4
keep_local_envs_in_vcs [y]: y
debug [n]: n
Expand All @@ -196,6 +196,11 @@ Now take a look at your repo. Don't forget to carefully look at the generated RE
For local development, see the following:

- [Developing locally](http://cookiecutter-django.readthedocs.io/en/latest/developing-locally.html)
- Instead of `pip`, this uses [astral's](https://astral.sh/) [uv](https://github.com/astral-sh/uv) project
- Install `uv`: `pip install uv`
- Compile `requirements.in`: `uv pip compile requirements.in -o requirements.txt`
- This file is *not* platform-agnostic, so must be compiled for *your* platform
- Use the generated `requirements.txt` file normally with instructions for developing locally above
- [Developing locally using docker](http://cookiecutter-django.readthedocs.io/en/latest/developing-locally-docker.html)

## Community
Expand All @@ -220,7 +225,7 @@ Scattered throughout the Python and HTML of this project are places marked with

## For MySQL users

To get full MySQL support in addition to the default Postgresql, you can use this fork of the cookiecutter-django:
To get full MySQL support in addition to the default PostgreSQL, you can use this fork of the cookiecutter-django:
https://github.com/mabdullahadeel/cookiecutter-django-mysql

## Releases
Expand Down
2 changes: 1 addition & 1 deletion cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"use_drf": false,
"frontend_pipeline": ["None", "Django Compressor", "Gulp", "Webpack"],
"use_celery": false,
"email_testing": ["mailhog", "mailpit", "none"],
"email_testing": ["mailhog", "mailpit", "None"],
"use_sentry": false,
"use_whitenoise": false,
"use_heroku": false,
Expand Down
8 changes: 8 additions & 0 deletions out/binaryornot/check.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from _typeshed import Incomplete

from .helpers import get_starting_chunk as get_starting_chunk
from .helpers import is_binary_string as is_binary_string

logger: Incomplete

def is_binary(filename:str) -> bool: ...
25 changes: 25 additions & 0 deletions out/cookiecutter/exceptions.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from _typeshed import Incomplete

class CookiecutterException(Exception): ...
class NonTemplatedInputDirException(CookiecutterException): ...
class UnknownTemplateDirException(CookiecutterException): ...
class MissingProjectDir(CookiecutterException): ...
class ConfigDoesNotExistException(CookiecutterException): ...
class InvalidConfiguration(CookiecutterException): ...
class UnknownRepoType(CookiecutterException): ...
class VCSNotInstalled(CookiecutterException): ...
class ContextDecodingException(CookiecutterException): ...
class OutputDirExistsException(CookiecutterException): ...
class InvalidModeException(CookiecutterException): ...
class FailedHookException(CookiecutterException): ...

class UndefinedVariableInTemplate(CookiecutterException):
message: Incomplete
error: Incomplete
context: Incomplete
def __init__(self, message, error, context) -> None: ...

class UnknownExtension(CookiecutterException): ...
class RepositoryNotFound(CookiecutterException): ...
class RepositoryCloneFailed(CookiecutterException): ...
class InvalidZipRepository(CookiecutterException): ...
Loading

0 comments on commit 6783de9

Please sign in to comment.