Skip to content

Commit 374e453

Browse files
authored
Initial commit
0 parents  commit 374e453

26 files changed

+854
-0
lines changed

.editorconfig

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 4
6+
end_of_line = lf
7+
insert_final_newline = true
8+
trim_trailing_whitespace = true
9+
10+
[*.{scss,sass}]
11+
indent_size = 2
12+
13+
[*.{yml,yaml}]
14+
indent_size = 2
15+
16+
[Makefile]
17+
indent_style = tab

.github/workflows/ci.yml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Run CI
2+
3+
# Run this workflow every time a new commit pushed to your repository
4+
on:
5+
push:
6+
branches:
7+
- main
8+
tags:
9+
- '*'
10+
pull_request:
11+
workflow_dispatch:
12+
13+
jobs:
14+
tests:
15+
runs-on: ubuntu-latest
16+
17+
name: Test the creation of a Django project from the template
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: actions/setup-python@v5
22+
with:
23+
python-version: '3.10'
24+
25+
- name: Install Django 4.2
26+
run: pip install django~=4.2.0
27+
28+
- name: Run the startproject command
29+
run: |
30+
mkdir tmp
31+
django-admin startproject \
32+
--template . \
33+
--extension=py-tpl,rst,gitignore,in,ini,cfg,toml,yml,yaml \
34+
--name LICENSE \
35+
-x tmp \
36+
-x .github \
37+
defaultapp tmp/
38+
39+
- name: Run basic checks (following README instructions)
40+
run: |
41+
pip install -e .[tests]
42+
django-admin check
43+
pytest
44+
env:
45+
PYTHONPATH: .
46+
DJANGO_SETTINGS_MODULE: testapp.settings
47+
working-directory: tmp
48+
49+
- name: Run dummy package build
50+
run: |
51+
pip install build
52+
python -m build
53+
working-directory: tmp

.gitignore

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
*.egg-info/
24+
.installed.cfg
25+
*.egg
26+
MANIFEST
27+
28+
# PyInstaller
29+
# Usually these files are written by a python script from a template
30+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
31+
*.manifest
32+
*.spec
33+
34+
# Installer logs
35+
pip-log.txt
36+
pip-delete-this-directory.txt
37+
38+
# Unit test / coverage reports
39+
htmlcov/
40+
.tox/
41+
.coverage
42+
.coverage.*
43+
.cache
44+
nosetests.xml
45+
coverage.xml
46+
*.cover
47+
.hypothesis/
48+
.pytest_cache/
49+
50+
# Translations
51+
*.mo
52+
*.pot
53+
54+
# Django stuff:
55+
*.log
56+
local_settings.py
57+
db.sqlite3
58+
59+
# Flask stuff:
60+
instance/
61+
.webassets-cache
62+
63+
# Scrapy stuff:
64+
.scrapy
65+
66+
# Sphinx documentation
67+
docs/_build/
68+
69+
# PyBuilder
70+
target/
71+
72+
# Jupyter Notebook
73+
.ipynb_checkpoints
74+
75+
# pyenv
76+
.python-version
77+
78+
# celery beat schedule file
79+
celerybeat-schedule
80+
81+
# SageMath parsed files
82+
*.sage.py
83+
84+
# Environments
85+
.env
86+
.venv
87+
env/
88+
venv/
89+
ENV/
90+
env.bak/
91+
venv.bak/
92+
93+
# Spyder project settings
94+
.spyderproject
95+
.spyproject
96+
97+
# Rope project settings
98+
.ropeproject
99+
100+
# mkdocs documentation
101+
/site
102+
103+
# mypy
104+
.mypy_cache/

.readthedocs.yaml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# .readthedocs.yaml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
version: 2
6+
7+
build:
8+
os: ubuntu-22.04
9+
tools:
10+
python: "3.10"
11+
12+
sphinx:
13+
configuration: docs/conf.py
14+
15+
python:
16+
install:
17+
- method: pip
18+
path: .
19+
extra_requirements:
20+
- docs

LICENSE

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright {% now "Y" %} Maykin Media
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

MANIFEST.in

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
include *.rst
2+
include LICENSE
3+
include {{ project_name }}/py.typed
4+
recursive-include {{ project_name }} *.html
5+
recursive-include {{ project_name }} *.txt
6+
recursive-include {{ project_name }} *.po
7+
global-exclude __pycache__
8+
global-exclude *.py[co]

README.rst

+135
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
{% comment %}
2+
===============
3+
Getting started
4+
===============
5+
6+
Below you'll find the steps to create a 3rd-party Django app from scratch,
7+
using the Maykin Media starting template. The ``<project_root>`` is typically
8+
placed in your home directory.
9+
10+
.. code-block:: bash
11+
12+
mkdir <project_root>
13+
cd <project_root>
14+
15+
Create the virtual environment that holds your copy of Python and relevant
16+
libraries:
17+
18+
.. code-block:: bash
19+
20+
virtualenv env or virtualenv --python=/usr/bin/python3.10 env
21+
source env/bin/activate
22+
pip install django~=4.2.0
23+
24+
Start a new Django project, named ``<project_name>``, using the template. This
25+
will be your Python import path.
26+
27+
.. code-block:: bash
28+
29+
django-admin startproject \
30+
--template=https://github.com/maykinmedia/default-app/archive/main.zip \
31+
--extension=py-tpl,rst,gitignore,in,ini,cfg,toml,yml,yaml \
32+
-x .github \
33+
--name LICENSE \
34+
<project_name> .
35+
36+
And then set up the Github actions workflows:
37+
38+
.. code-block:: bash
39+
40+
mv dotgithub .github
41+
42+
{% endcomment %}
43+
44+
Welcome to {{ project_name }}'s documentation!
45+
=================================================
46+
47+
:Version: 0.1.0
48+
:Source: https://github.com/maykinmedia/{{ project_name }}
49+
:Keywords: ``<keywords>``
50+
:PythonVersion: 3.10
51+
52+
|build-status| |code-quality| |black| |coverage| |docs|
53+
54+
|python-versions| |django-versions| |pypi-version|
55+
56+
<One liner describing the project>
57+
58+
.. contents::
59+
60+
.. section-numbering::
61+
62+
Features
63+
========
64+
65+
* ...
66+
* ...
67+
68+
Installation
69+
============
70+
71+
Requirements
72+
------------
73+
74+
* Python 3.10 or above
75+
* Django 4.2 or newer
76+
77+
78+
Install
79+
-------
80+
81+
.. code-block:: bash
82+
83+
pip install {{ project_name }}
84+
85+
86+
Usage
87+
=====
88+
89+
<document or refer to docs>
90+
91+
Local development
92+
=================
93+
94+
To install and develop the library locally, use::
95+
96+
.. code-block:: bash
97+
98+
pip install -e .[tests,coverage,docs,release]
99+
100+
When running management commands via ``django-admin``, make sure to add the root
101+
directory to the python path (or use ``python -m django <command>``):
102+
103+
.. code-block:: bash
104+
105+
export PYTHONPATH=. DJANGO_SETTINGS_MODULE=testapp.settings
106+
django-admin check
107+
# or other commands like:
108+
# django-admin makemessages -l nl
109+
110+
111+
.. |build-status| image:: https://github.com/maykinmedia/{{ project_name }}/workflows/Run%20CI/badge.svg
112+
:alt: Build status
113+
:target: https://github.com/maykinmedia/{{ project_name }}/actions?query=workflow%3A%22Run+CI%22
114+
115+
.. |code-quality| image:: https://github.com/maykinmedia/{{ project_name }}/workflows/Code%20quality%20checks/badge.svg
116+
:alt: Code quality checks
117+
:target: https://github.com/maykinmedia/{{ project_name }}/actions?query=workflow%3A%22Code+quality+checks%22
118+
119+
.. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
120+
:target: https://github.com/psf/black
121+
122+
.. |coverage| image:: https://codecov.io/gh/maykinmedia/{{ project_name }}/branch/main/graph/badge.svg
123+
:target: https://codecov.io/gh/maykinmedia/{{ project_name }}
124+
:alt: Coverage status
125+
126+
.. |docs| image:: https://readthedocs.org/projects/{{ project_name }}/badge/?version=latest
127+
:target: https://{{ project_name }}.readthedocs.io/en/latest/?badge=latest
128+
:alt: Documentation Status
129+
130+
.. |python-versions| image:: https://img.shields.io/pypi/pyversions/{{ project_name }}.svg
131+
132+
.. |django-versions| image:: https://img.shields.io/pypi/djversions/{{ project_name }}.svg
133+
134+
.. |pypi-version| image:: https://img.shields.io/pypi/v/{{ project_name }}.svg
135+
:target: https://pypi.org/project/{{ project_name }}/

docs/Makefile

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = .
9+
BUILDDIR = _build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/check_sphinx.py-tpl

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import subprocess
2+
3+
4+
def test_linkcheck(tmpdir):
5+
doctrees = tmpdir.join("doctrees")
6+
htmldir = tmpdir.join("html")
7+
subprocess.check_call(
8+
["sphinx-build", "-W", "-blinkcheck", "-d", str(doctrees), ".", str(htmldir)],
9+
)
10+
11+
12+
def test_build_docs(tmpdir):
13+
doctrees = tmpdir.join("doctrees")
14+
htmldir = tmpdir.join("html")
15+
subprocess.check_call(
16+
["sphinx-build", "-W", "-bhtml", "-d", str(doctrees), ".", str(htmldir)],
17+
)

0 commit comments

Comments
 (0)