Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

startproject with template #1

Merged
merged 2 commits into from
Jan 7, 2025
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
65 changes: 39 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,54 @@ on:
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
python: ['3.10', '3.11', '3.12']
django: ['4.2']

name: Test the creation of a Django project from the template
name: Run the test suite (Python ${{ matrix.python }}, Django ${{ matrix.django }})

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: ${{ matrix.python }}

- name: Install Django 4.2
run: pip install django~=4.2.0
- name: Install dependencies
run: pip install tox tox-gh-actions

- name: Run the startproject command
run: |
mkdir tmp
django-admin startproject \
--template . \
--extension=py-tpl,rst,gitignore,in,ini,cfg,toml,yml,yaml \
--name LICENSE \
-x tmp \
-x .github \
defaultapp tmp/

- name: Run basic checks (following README instructions)
run: |
pip install -e .[tests]
django-admin check
pytest
- name: Run tests
run: tox
env:
PYTHONPATH: .
DJANGO_SETTINGS_MODULE: testapp.settings
working-directory: tmp
PYTHON_VERSION: ${{ matrix.python }}
DJANGO: ${{ matrix.django }}

- name: Publish coverage report
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}

publish:
name: Publish package to PyPI
runs-on: ubuntu-latest
needs: tests
environment: release
permissions:
id-token: write

if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')

- name: Run dummy package build
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Build sdist and wheel
run: |
pip install build
pip install build --upgrade
python -m build
working-directory: tmp

- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ jobs:
run: pip install tox
- run: tox
env:
TOXENV: ${% templatetag openvariable %} matrix.toxenv {% templatetag closevariable %}
TOXENV: ${{ matrix.toxenv }}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ coverage.xml
*.cover
.hypothesis/
.pytest_cache/
reports/

# Translations
*.mo
Expand All @@ -55,6 +56,7 @@ coverage.xml
*.log
local_settings.py
db.sqlite3
*.db

# Flask stuff:
instance/
Expand Down Expand Up @@ -102,3 +104,7 @@ venv.bak/

# mypy
.mypy_cache/


# jetbrains
.idea
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright {% now "Y" %} Maykin Media
Copyright 2025 Maykin Media

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:

Expand Down
8 changes: 4 additions & 4 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
include *.rst
include LICENSE
include {{ project_name }}/py.typed
recursive-include {{ project_name }} *.html
recursive-include {{ project_name }} *.txt
recursive-include {{ project_name }} *.po
include django_json_schema/py.typed
recursive-include django_json_schema *.html
recursive-include django_json_schema *.txt
recursive-include django_json_schema *.po
global-exclude __pycache__
global-exclude *.py[co]
71 changes: 15 additions & 56 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,51 +1,10 @@
{% comment %}
===============
Getting started
===============

Below you'll find the steps to create a 3rd-party Django app from scratch,
using the Maykin Media starting template. The ``<project_root>`` is typically
placed in your home directory.

.. code-block:: bash

mkdir <project_root>
cd <project_root>

Create the virtual environment that holds your copy of Python and relevant
libraries:

.. code-block:: bash

virtualenv env or virtualenv --python=/usr/bin/python3.10 env
source env/bin/activate
pip install django~=4.2.0

Start a new Django project, named ``<project_name>``, using the template. This
will be your Python import path.

.. code-block:: bash

django-admin startproject \
--template=https://github.com/maykinmedia/default-app/archive/main.zip \
--extension=py-tpl,rst,gitignore,in,ini,cfg,toml,yml,yaml \
-x .github \
--name LICENSE \
<project_name> .

And then set up the Github actions workflows:

.. code-block:: bash

mv dotgithub .github

{% endcomment %}

Welcome to {{ project_name }}'s documentation!
Welcome to django-json-schema's documentation!
=================================================

:Version: 0.1.0
:Source: https://github.com/maykinmedia/{{ project_name }}
:Source: https://github.com/maykinmedia/django-json-schema
:Keywords: ``<keywords>``
:PythonVersion: 3.10

Expand Down Expand Up @@ -80,7 +39,7 @@ Install

.. code-block:: bash

pip install {{ project_name }}
pip install django-json-schema


Usage
Expand Down Expand Up @@ -108,28 +67,28 @@ directory to the python path (or use ``python -m django <command>``):
# django-admin makemessages -l nl


.. |build-status| image:: https://github.com/maykinmedia/{{ project_name }}/workflows/Run%20CI/badge.svg
.. |build-status| image:: https://github.com/maykinmedia/django-json-schema/workflows/Run%20CI/badge.svg
:alt: Build status
:target: https://github.com/maykinmedia/{{ project_name }}/actions?query=workflow%3A%22Run+CI%22
:target: https://github.com/maykinmedia/django-json-schema/actions?query=workflow%3A%22Run+CI%22

.. |code-quality| image:: https://github.com/maykinmedia/{{ project_name }}/workflows/Code%20quality%20checks/badge.svg
.. |code-quality| image:: https://github.com/maykinmedia/django-json-schema/workflows/Code%20quality%20checks/badge.svg
:alt: Code quality checks
:target: https://github.com/maykinmedia/{{ project_name }}/actions?query=workflow%3A%22Code+quality+checks%22
:target: https://github.com/maykinmedia/django-json-schema/actions?query=workflow%3A%22Code+quality+checks%22

.. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black

.. |coverage| image:: https://codecov.io/gh/maykinmedia/{{ project_name }}/branch/main/graph/badge.svg
:target: https://codecov.io/gh/maykinmedia/{{ project_name }}
.. |coverage| image:: https://codecov.io/gh/maykinmedia/django-json-schema/branch/main/graph/badge.svg
:target: https://codecov.io/gh/maykinmedia/django-json-schema
:alt: Coverage status

.. |docs| image:: https://readthedocs.org/projects/{{ project_name }}/badge/?version=latest
:target: https://{{ project_name }}.readthedocs.io/en/latest/?badge=latest
.. |docs| image:: https://readthedocs.org/projects/django-json-schema/badge/?version=latest
:target: https://django-json-schema.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status

.. |python-versions| image:: https://img.shields.io/pypi/pyversions/{{ project_name }}.svg
.. |python-versions| image:: https://img.shields.io/pypi/pyversions/django-json-schema.svg

.. |django-versions| image:: https://img.shields.io/pypi/djversions/{{ project_name }}.svg
.. |django-versions| image:: https://img.shields.io/pypi/djversions/django-json-schema.svg

.. |pypi-version| image:: https://img.shields.io/pypi/v/{{ project_name }}.svg
:target: https://pypi.org/project/{{ project_name }}/
.. |pypi-version| image:: https://img.shields.io/pypi/v/django-json-schema.svg
:target: https://pypi.org/project/django-json-schema/
File renamed without changes.
6 changes: 6 additions & 0 deletions django_json_schema/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class DjangoJsonSchemaConfig(AppConfig):
name = "django_json_schema"
default_auto_field = "django.db.models.fields.BigAutoField"
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions docs/conf.py-tpl → docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
from pathlib import Path

current_dir = Path(__file__).parents[1]
code_directory = current_dir / "{{ project_name|lower }}"
code_directory = current_dir / "django_json_schema"

sys.path.insert(0, str(code_directory))


# -- Project information -----------------------------------------------------

project = "{{ project_name }}"
copyright = "{% now 'Y' %}, Maykin Media"
project = "django_json_schema"
copyright = "2025, Maykin Media"
author = "Maykin Media"

# The full version, including alpha/beta/rc tags
Expand Down
36 changes: 19 additions & 17 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
.. {{ project_name }} documentation master file, created by startproject.
.. django-json-schema documentation master file, created by startproject.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.

Welcome to {{ project_name }}'s documentation!
Welcome to django-json-schema's documentation!
=================================================

|build-status| |code-quality| |black| |coverage| |docs|
|build-status| |code-quality| |black| |coverage|

|python-versions| |django-versions| |pypi-version|
..
|docs| |python-versions| |django-versions| |pypi-version|

<One liner describing the project>

Expand All @@ -33,28 +34,29 @@ Indices and tables
* :ref:`search`


.. |build-status| image:: https://github.com/maykinmedia/{{ project_name }}/workflows/Run%20CI/badge.svg
.. |build-status| image:: https://github.com/maykinmedia/django-json-schema/workflows/Run%20CI/badge.svg
:alt: Build status
:target: https://github.com/maykinmedia/{{ project_name }}/actions?query=workflow%3A%22Run+CI%22
:target: https://github.com/maykinmedia/django-json-schema/actions?query=workflow%3A%22Run+CI%22

.. |code-quality| image:: https://github.com/maykinmedia/{{ project_name }}/workflows/Code%20quality%20checks/badge.svg
.. |code-quality| image:: https://github.com/maykinmedia/django-json-schema/workflows/Code%20quality%20checks/badge.svg
:alt: Code quality checks
:target: https://github.com/maykinmedia/{{ project_name }}/actions?query=workflow%3A%22Code+quality+checks%22
:target: https://github.com/maykinmedia/django-json-schema/actions?query=workflow%3A%22Code+quality+checks%22

.. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black

.. |coverage| image:: https://codecov.io/gh/maykinmedia/{{ project_name }}/branch/master/graph/badge.svg
:target: https://codecov.io/gh/maykinmedia/{{ project_name }}
.. |coverage| image:: https://codecov.io/gh/maykinmedia/django-json-schema/branch/master/graph/badge.svg
:target: https://codecov.io/gh/maykinmedia/django-json-schema
:alt: Coverage status

.. |docs| image:: https://readthedocs.org/projects/{{ project_name }}/badge/?version=latest
:target: https://{{ project_name }}.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status
..
.. |docs| image:: https://readthedocs.org/projects/django-json-schema/badge/?version=latest
:target: https://django-json-schema.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status

.. |python-versions| image:: https://img.shields.io/pypi/pyversions/{{ project_name }}.svg
.. |python-versions| image:: https://img.shields.io/pypi/pyversions/django-json-schema.svg

.. |django-versions| image:: https://img.shields.io/pypi/djversions/{{ project_name }}.svg
.. |django-versions| image:: https://img.shields.io/pypi/djversions/django-json-schema.svg

.. |pypi-version| image:: https://img.shields.io/pypi/v/{{ project_name }}.svg
:target: https://pypi.org/project/{{ project_name }}/
.. |pypi-version| image:: https://img.shields.io/pypi/v/django-json-schema.svg
:target: https://pypi.org/project/django-json-schema/
2 changes: 1 addition & 1 deletion docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Install from PyPI with pip:

.. code-block:: bash

pip install {{ project_name }}
pip install django-json-schema


Usage
Expand Down
66 changes: 0 additions & 66 deletions dotgithub/workflows/ci.yml

This file was deleted.

Loading
Loading