Skip to content

Commit

Permalink
Updated based on new version of cookiecutter-django-package
Browse files Browse the repository at this point in the history
  • Loading branch information
jacklinke committed May 22, 2024
1 parent 49f7185 commit b0f1626
Show file tree
Hide file tree
Showing 21 changed files with 1,963 additions and 780 deletions.
8 changes: 4 additions & 4 deletions .cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
"_output_dir": "/home/watervize/omenapps_packages",
"_template": "./cookiecutter-django-package/",
"author": "Jack Linke",
"copyright_year": "2023",
"copyright_year": "2024",
"development_status": "Development Status :: 1 - Planning",
"docker_compose_python_version": "3.11",
"docker_compose_python_version": "3.12",
"email": "[email protected]",
"github_owner": "OmenApps",
"github_owner": "jacklinke",
"github_user": "jacklinke",
"license": "MIT",
"package_description": "A Django package that ...",
"package_name": "cookiecutter_django_package_instance",
"project_name": "cookiecutter-django-package-instance",
"use_playwright": "y",
"use_postgres": "y",
"version": "2023.10.1"
"version": "2024.05.1"
}
17 changes: 9 additions & 8 deletions .github/workflows/constraints.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
pip==23.3.1
pipx==1.2.1
nox==2023.4.22
pip==24.0
pipx==1.5.0
nox==2024.4.15
nox-poetry==1.0.3
playwright==1.39.0
poetry==1.6.1
pytest==7.4.2
pytest-cov==4.1.0
pytest-django==4.5.2
playwright==1.44.0
poetry==1.8.3
poetry-plugin-export==1.8.0
pytest==8.2.1
pytest-cov==5.0.0
pytest-django==4.8.0
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
fetch-depth: 2

- name: Set up Python
uses: actions/setup-python@v4.7.1
uses: actions/setup-python@v5.1.0
with:
python-version: "3.11"
python-version: "3.12"

- name: Upgrade pip
run: |
Expand Down Expand Up @@ -56,21 +56,21 @@ jobs:
- name: Publish package on PyPI
if: steps.check-version.outputs.tag
uses: pypa/[email protected].10
uses: pypa/[email protected].14
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}

- name: Publish package on TestPyPI
if: "! steps.check-version.outputs.tag"
uses: pypa/[email protected].10
uses: pypa/[email protected].14
with:
user: __token__
password: ${{ secrets.TEST_PYPI_TOKEN }}
repository-url: https://test.pypi.org/legacy/

- name: Publish the release notes
uses: release-drafter/release-drafter@v5.25.0
uses: release-drafter/release-drafter@v6.0.0
with:
publish: ${{ steps.check-version.outputs.tag != '' }}
tag: ${{ steps.check-version.outputs.tag }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,22 @@ jobs:
run: docker compose exec django_test nox -r --force-color

- name: Upload documentation
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: docs
path: docs/_build

- name: Combine coverage data and display human readable report
run: |
docker compose exec django_test nox --session "coverage(django='4.2')"
docker compose exec django_test nox --session "coverage(django='5.0')"
- name: Create coverage report and copy to artifacts
run: |
docker compose exec django_test nox --session "coverage(django='4.2')" -- xml
docker compose exec django_test nox --session "coverage(django='5.0')" -- xml
docker compose exec django_test cat coverage.xml > coverage.xml
- name: Upload coverage report
uses: codecov/codecov-action@v3.1.4
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

Expand Down
4 changes: 2 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
os: ubuntu-24.04
tools:
python: "3.11"
python: "3.12"

sphinx:
configuration: docs/conf.py
Expand Down
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [Unreleased]

## [2023.10.1]
## [2024.05.1]

Initial release!

Expand All @@ -15,4 +15,4 @@ Initial release!
- TBD

[unreleased]: https://github.com/jacklinke/cookiecutter_django_package_instance/compare/HEAD...HEAD
[2023.10.1]: https://github.com/jacklinke/cookiecutter_django_package_instance/releases/tag/2023.10.1
[2024.05.1]: https://github.com/jacklinke/cookiecutter_django_package_instance/releases/tag/2024.05.1
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright © 2023 Jack Linke
Copyright © 2024 Jack Linke

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
[![License](https://img.shields.io/pypi/l/cookiecutter-django-package-instance)][license]

[![Read the documentation at https://cookiecutter-django-package-instance.readthedocs.io/](https://img.shields.io/readthedocs/cookiecutter-django-package-instance/latest.svg?label=Read%20the%20Docs)][read the docs]
[![Tests](https://github.com/OmenApps/cookiecutter-django-package-instance/actions/workflows/tests.yml/badge.svg)][tests]
[![Codecov](https://codecov.io/gh/OmenApps/cookiecutter-django-package-instance/branch/main/graph/badge.svg)][codecov]
[![Tests](https://github.com/jacklinke/cookiecutter-django-package-instance/actions/workflows/tests.yml/badge.svg)][tests]
[![Codecov](https://codecov.io/gh/jacklinke/cookiecutter-django-package-instance/branch/main/graph/badge.svg)][codecov]

[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)][pre-commit]
[![Black](https://img.shields.io/badge/code%20style-black-000000.svg)][black]
Expand Down
49 changes: 29 additions & 20 deletions compose/django/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
FROM mcr.microsoft.com/playwright:v1.39.0-jammy
FROM mcr.microsoft.com/playwright:v1.44.0-jammy

ARG BUILD_ENVIRONMENT=local
ARG APP_HOME=/app
ARG DEBIAN_FRONTEND=noninteractive
ARG MULTIPLE_PYTHON # Set to True if you want to use multiple Python versions

ARG PYTHON_3_9=3.9.18
ARG PYTHON_3_10=3.10.13
ARG PYTHON_3_11=3.11.6
ARG PYTHON_3_12=3.12.0
ARG PYTHON_3_9=3.9.19
ARG PYTHON_3_10=3.10.14
ARG PYTHON_3_11=3.11.9
ARG PYTHON_3_12=3.12.3

ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE 1
ENV COMPOSE_DOCKER_CLI_BUILD 1
ENV DOCKER_BUILDKIT 1
ENV BUILD_ENV ${BUILD_ENVIRONMENT}

WORKDIR ${APP_HOME}

# Install apt packages
RUN apt-get update
RUN apt-get install -y \
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt update \
&& apt-get --no-install-recommends install -y \
# Some basic tools and libraries
bash curl wget git make \
build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev \
Expand All @@ -39,7 +43,7 @@ RUN if [ "$MULTIPLE_PYTHON" = "True" ] ; then \
pyenv install ${PYTHON_3_10}; \
pyenv install ${PYTHON_3_9}; \
else \
pyenv install 3.11; \
pyenv install 3.12; \
fi

# Initialize pyenv
Expand All @@ -52,34 +56,39 @@ RUN apt-get update

# Make Python version(s) accessible in the project and install Python venv
RUN if [ "$MULTIPLE_PYTHON" = "True" ] ; then \
apt-get install -y python3.11-venv python3.9-venv python3.10-venv python3.12-venv; \
pyenv local ${PYTHON_3_11} ${PYTHON_3_9} ${PYTHON_3_10} ${PYTHON_3_12}; \
apt-get install -y python3.12-venv python3.9-venv python3.10-venv python3.11-venv; \
pyenv local ${PYTHON_3_12} ${PYTHON_3_9} ${PYTHON_3_10} ${PYTHON_3_11}; \
else \
apt-get install -y python3.11-venv; \
pyenv local 3.11; \
apt-get install -y python3.12-venv; \
pyenv local 3.12; \
fi

# Ensure pip is installed
RUN apt-get install -y python3-pip
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get --no-install-recommends install -y \
python3-pip

# Install Poetry
RUN pip install poetry

# Copy application files
COPY noxfile.py manage.py poetry.lock pyproject.toml ${APP_HOME}
# Copy poetry files
COPY poetry.lock pyproject.toml ${APP_HOME}

# Install dependencies:
RUN poetry config virtualenvs.create false \
&& poetry install --with dev --no-interaction --no-ansi --no-root

# Copy remaining project files
COPY noxfile.py manage.py ${APP_HOME}
COPY .darglint .editorconfig .flake8 .gitignore .pre-commit-config.yaml .prettierignore .readthedocs.yml bandit.yml ${APP_HOME}
COPY CHANGELOG.md CODE_OF_CONDUCT.md CONTRIBUTING.md LICENSE README.md ${APP_HOME}

COPY ./docs/ ${APP_HOME}/docs
COPY ./example_project/ ${APP_HOME}/example_project/
COPY ./tests/ ${APP_HOME}/tests/
COPY ./src/ ${APP_HOME}/
COPY ./src/ ${APP_HOME}/src/

# Install dependencies:
RUN poetry config virtualenvs.create false \
&& poetry install --with dev --no-interaction --no-ansi --no-root

# Rehash pyenv shims
RUN pyenv rehash

Expand Down
3 changes: 1 addition & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3"

volumes:
local_postgres_data:

Expand All @@ -12,6 +10,7 @@ services:
container_name: django_test
depends_on:
- postgres_test

env_file:
- ./compose/django/.django
ports:
Expand Down
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"""Sphinx configuration."""

project = "cookiecutter-django-package-instance"
author = "Jack Linke"
copyright = "2023, Jack Linke"
copyright = "2024, Jack Linke"
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
Expand Down
8 changes: 4 additions & 4 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
furo==2023.9.10
sphinx==7.2.6
sphinx-click==5.0.1
myst_parser==2.0.0
furo==2024.5.6
sphinx==7.3.7
sphinx-click==6.0.0
myst-parser==3.0.1
2 changes: 1 addition & 1 deletion example_project/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/
https://docs.djangoproject.com/en/5.0/howto/deployment/asgi/
"""

import os
Expand Down
5 changes: 1 addition & 4 deletions example_project/example/tests.py
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
from django.test import TestCase # noqa


# Create your tests here.
"""Tests for cookiecutter_django_package_instance example application."""
18 changes: 9 additions & 9 deletions example_project/settings.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""Django settings for core project.
For more information on this file, see
https://docs.djangoproject.com/en/4.2/topics/settings/
https://docs.djangoproject.com/en/5.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.2/ref/settings/
https://docs.djangoproject.com/en/5.0/ref/settings/
"""

from pathlib import Path
Expand All @@ -15,7 +15,7 @@
BASE_DIR = Path(__file__).resolve().parent.parent

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!

Expand All @@ -25,7 +25,7 @@

DEBUG = True

ALLOWED_HOSTS = ["0.0.0.0", "127.0.0.1"] # nosec
ALLOWED_HOSTS = ["*"] # nosec

# Application definition

Expand Down Expand Up @@ -72,7 +72,7 @@
ASGI_APPLICATION = "example_project.asgi.application"

# Database
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
# https://docs.djangoproject.com/en/5.0/ref/settings/#databases

DATABASES = {
"default": {
Expand All @@ -86,7 +86,7 @@
}

# Password validation
# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators
# https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
Expand All @@ -104,7 +104,7 @@
]

# Internationalization
# https://docs.djangoproject.com/en/4.2/topics/i18n/
# https://docs.djangoproject.com/en/5.0/topics/i18n/

LANGUAGE_CODE = "en-us"

Expand All @@ -115,11 +115,11 @@
USE_TZ = True

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.2/howto/static-files/
# https://docs.djangoproject.com/en/5.0/howto/static-files/

STATIC_URL = "static/"

# Default primary key field type
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
2 changes: 1 addition & 1 deletion example_project/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

"""
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/4.2/topics/http/urls/
https://docs.djangoproject.com/en/5.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
Expand Down
2 changes: 1 addition & 1 deletion example_project/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/
https://docs.djangoproject.com/en/5.0/howto/deployment/wsgi/
"""

import os
Expand Down
Loading

0 comments on commit b0f1626

Please sign in to comment.