diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 99e6171..6df67c3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 + diff --git a/dotgithub/workflows/code_quality.yml b/.github/workflows/code_quality.yml similarity index 86% rename from dotgithub/workflows/code_quality.yml rename to .github/workflows/code_quality.yml index b10a1cd..0433b75 100644 --- a/dotgithub/workflows/code_quality.yml +++ b/.github/workflows/code_quality.yml @@ -30,4 +30,4 @@ jobs: run: pip install tox - run: tox env: - TOXENV: ${% templatetag openvariable %} matrix.toxenv {% templatetag closevariable %} + TOXENV: ${{ matrix.toxenv }} diff --git a/.gitignore b/.gitignore index 894a44c..bc4359b 100644 --- a/.gitignore +++ b/.gitignore @@ -46,6 +46,7 @@ coverage.xml *.cover .hypothesis/ .pytest_cache/ +reports/ # Translations *.mo @@ -55,6 +56,7 @@ coverage.xml *.log local_settings.py db.sqlite3 +*.db # Flask stuff: instance/ @@ -102,3 +104,7 @@ venv.bak/ # mypy .mypy_cache/ + + +# jetbrains +.idea diff --git a/LICENSE b/LICENSE index 68e153b..829c43d 100644 --- a/LICENSE +++ b/LICENSE @@ -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: diff --git a/MANIFEST.in b/MANIFEST.in index 96b4836..42b9b48 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -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] diff --git a/README.rst b/README.rst index 5557efa..aa27220 100644 --- a/README.rst +++ b/README.rst @@ -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 ```` is typically -placed in your home directory. -.. code-block:: bash - - mkdir - cd - -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 ````, 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 \ - . - -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: ```` :PythonVersion: 3.10 @@ -80,7 +39,7 @@ Install .. code-block:: bash - pip install {{ project_name }} + pip install django-json-schema Usage @@ -108,28 +67,28 @@ directory to the python path (or use ``python -m django ``): # 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/ diff --git a/project_name/__init__.py-tpl b/django_json_schema/__init__.py similarity index 100% rename from project_name/__init__.py-tpl rename to django_json_schema/__init__.py diff --git a/django_json_schema/apps.py b/django_json_schema/apps.py new file mode 100644 index 0000000..99bea89 --- /dev/null +++ b/django_json_schema/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class DjangoJsonSchemaConfig(AppConfig): + name = "django_json_schema" + default_auto_field = "django.db.models.fields.BigAutoField" diff --git a/project_name/py.typed b/django_json_schema/py.typed similarity index 100% rename from project_name/py.typed rename to django_json_schema/py.typed diff --git a/docs/check_sphinx.py-tpl b/docs/check_sphinx.py similarity index 100% rename from docs/check_sphinx.py-tpl rename to docs/check_sphinx.py diff --git a/docs/conf.py-tpl b/docs/conf.py similarity index 93% rename from docs/conf.py-tpl rename to docs/conf.py index 24bf6c3..4bb4af2 100644 --- a/docs/conf.py-tpl +++ b/docs/conf.py @@ -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 diff --git a/docs/index.rst b/docs/index.rst index e5cf1fd..4c29831 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -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| @@ -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/ diff --git a/docs/quickstart.rst b/docs/quickstart.rst index c103b11..0ac8fdd 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -9,7 +9,7 @@ Install from PyPI with pip: .. code-block:: bash - pip install {{ project_name }} + pip install django-json-schema Usage diff --git a/dotgithub/workflows/ci.yml b/dotgithub/workflows/ci.yml deleted file mode 100644 index 54cc6b7..0000000 --- a/dotgithub/workflows/ci.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: Run CI - -# Run this workflow every time a new commit pushed to your repository -on: - push: - branches: - - main - tags: - - '*' - pull_request: - workflow_dispatch: - -jobs: - tests: - runs-on: ubuntu-latest - strategy: - matrix: - python: ['3.10', '3.11', '3.12'] - django: ['4.2'] - - name: Run the test suite (Python ${% templatetag openvariable %} matrix.python {% templatetag closevariable %}, Django ${% templatetag openvariable %} matrix.django {% templatetag closevariable %}) - - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: ${% templatetag openvariable %} matrix.python {% templatetag closevariable %} - - - name: Install dependencies - run: pip install tox tox-gh-actions - - - name: Run tests - run: tox - env: - PYTHON_VERSION: ${% templatetag openvariable %} matrix.python {% templatetag closevariable %} - DJANGO: ${% templatetag openvariable %} matrix.django {% templatetag closevariable %} - - - name: Publish coverage report - uses: codecov/codecov-action@v4 - with: - token: ${% templatetag openvariable %} secrets.CODECOV_TOKEN {% templatetag closevariable %} - - 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') - - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: '3.10' - - - name: Build sdist and wheel - run: | - pip install build --upgrade - python -m build - - - name: Publish a Python distribution to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - diff --git a/project_name/apps.py-tpl b/project_name/apps.py-tpl deleted file mode 100644 index 698786e..0000000 --- a/project_name/apps.py-tpl +++ /dev/null @@ -1,5 +0,0 @@ -from django.apps import AppConfig - - -class {{ camel_case_project_name }}Config(AppConfig): - name = "{{ project_name }}" diff --git a/pyproject.toml b/pyproject.toml index c2b41b6..f85ba1e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["setuptools>=61.0.0"] build-backend = "setuptools.build_meta" [project] -name = "{{ project_name }}" +name = "django-json-schema" version = "0.1.0" description = "TODO" authors = [ @@ -31,10 +31,10 @@ dependencies = [ ] [project.urls] -Homepage = "https://github.com/maykinmedia/{{ project_name|lower }}" -Documentation = "http://{{ project_name|lower }}.readthedocs.io/en/latest/" -"Bug Tracker" = "https://github.com/maykinmedia/{{ project_name|lower }}/issues" -"Source Code" = "https://github.com/maykinmedia/{{ project_name|lower }}" +Homepage = "https://github.com/maykinmedia/django_json_schema" +Documentation = "http://django_json_schema.readthedocs.io/en/latest/" +"Bug Tracker" = "https://github.com/maykinmedia/django_json_schema/issues" +"Source Code" = "https://github.com/maykinmedia/django_json_schema" [project.optional-dependencies] tests = [ @@ -55,7 +55,7 @@ release = [ ] [tool.setuptools.packages.find] -include = ["{{ project_name|lower }}*"] +include = ["django_json_schema*"] namespaces = true [tool.isort] @@ -63,7 +63,7 @@ profile = "black" combine_as_imports = true skip = ["env", ".tox", ".history", ".eggs"] known_django = "django" -known_first_party="{{ project_name|lower }}" +known_first_party="django_json_schema" sections=["FUTURE", "STDLIB", "DJANGO", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"] [tool.pytest.ini_options] @@ -80,7 +80,7 @@ files = [ [tool.coverage.run] branch = true -source = ["{{ project_name|lower }}"] +source = ["django_json_schema"] omit = [ # migrations run while django initializes the test db "*/migrations/*", diff --git a/testapp/__init__.py-tpl b/testapp/__init__.py similarity index 100% rename from testapp/__init__.py-tpl rename to testapp/__init__.py diff --git a/testapp/settings.py-tpl b/testapp/settings.py similarity index 94% rename from testapp/settings.py-tpl rename to testapp/settings.py index 7b2da2c..1d12b23 100644 --- a/testapp/settings.py-tpl +++ b/testapp/settings.py @@ -11,7 +11,7 @@ DATABASES = { "default": { "ENGINE": "django.db.backends.sqlite3", - "NAME": BASE_DIR / "{{ project_name }}.db", + "NAME": BASE_DIR / "django_json_schema.db", } } @@ -21,7 +21,7 @@ "django.contrib.sessions", "django.contrib.messages", "django.contrib.admin", - "{{ project_name }}", + "django_json_schema", "testapp", ] diff --git a/testapp/urls.py-tpl b/testapp/urls.py similarity index 100% rename from testapp/urls.py-tpl rename to testapp/urls.py diff --git a/tests/__init__.py-tpl b/tests/__init__.py similarity index 100% rename from tests/__init__.py-tpl rename to tests/__init__.py diff --git a/tests/conftest.py-tpl b/tests/conftest.py-tpl deleted file mode 100644 index 3e3adab..0000000 --- a/tests/conftest.py-tpl +++ /dev/null @@ -1,6 +0,0 @@ -# import pytest - - -# @pytest.fixture -# def some_fixture(request): -# return "foo" diff --git a/tox.ini b/tox.ini index 550e977..b82463d 100644 --- a/tox.ini +++ b/tox.ini @@ -39,7 +39,7 @@ commands = isort --check-only --diff . [testenv:black] extras = tests skipsdist = True -commands = black --check {{ project_name|lower }} docs testapp tests +commands = black --check django_json_schema docs testapp tests [testenv:flake8] extras = tests