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

♻️ Use newest default-app template #2

Merged
merged 6 commits into from
Jan 30, 2024
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
10 changes: 0 additions & 10 deletions .bumpversion.cfg

This file was deleted.

64 changes: 64 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
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.9', '3.11', '3.12']
django: ['3.2', '4.2']

name: Run the test suite (Python ${{ matrix.python }}, Django ${{ matrix.django }})

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

- name: Install dependencies
run: pip install tox tox-gh-actions

- name: Run tests
run: tox
env:
PYTHON_VERSION: ${{ matrix.python }}
DJANGO: ${{ matrix.django }}

- name: Publish coverage report
uses: codecov/codecov-action@v3

publish:
name: Publish package to PyPI
runs-on: ubuntu-latest
needs: tests

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

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'

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

# TODO: switch to verified publishers
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
33 changes: 33 additions & 0 deletions .github/workflows/code_quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Code quality checks

# Run this workflow every time a new commit pushed to your repository
on:
push:
branches:
- main
tags:
- '*'
paths:
- '**.py'
pull_request:
paths:
- '**.py'
workflow_dispatch:

jobs:
linting:
name: Code-quality checks
runs-on: ubuntu-latest
strategy:
matrix:
toxenv: [isort, black, flake8, docs]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: pip install tox
- run: tox
env:
TOXENV: ${{ matrix.toxenv }}
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ recursive-include open_api_framework *.txt
recursive-include open_api_framework *.po
global-exclude __pycache__
global-exclude *.py[co]

28 changes: 23 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Welcome to open_api_framework's documentation!
:Version: 0.1.0
:Source: https://github.com/maykinmedia/open_api_framework
:Keywords: ``<keywords>``
:PythonVersion: 3.9
:PythonVersion: 3.11

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

Expand All @@ -30,9 +30,8 @@ Installation
Requirements
------------

* Python 3.7 or above
* setuptools 30.3.0 or above
* Django 2.2 or newer
* Python 3.9/3.11 or above
* Django 3.2/4.2 or newer


Install
Expand All @@ -48,6 +47,25 @@ Usage

<document or refer to docs>

Local development
=================

To install and develop the library locally, use::

.. code-block:: bash

pip install -e .[tests,coverage,docs,release]

When running management commands via ``django-admin``, make sure to add the root
directory to the python path (or use ``python -m django <command>``):

.. code-block:: bash

export PYTHONPATH=. DJANGO_SETTINGS_MODULE=testapp.settings
django-admin check
# or other commands like:
# django-admin makemessages -l nl


.. |build-status| image:: https://github.com/maykinmedia/open_api_framework/workflows/Run%20CI/badge.svg
:alt: Build status
Expand All @@ -60,7 +78,7 @@ Usage
.. |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/open_api_framework/branch/master/graph/badge.svg
.. |coverage| image:: https://codecov.io/gh/maykinmedia/open_api_framework/branch/main/graph/badge.svg
:target: https://codecov.io/gh/maykinmedia/open_api_framework
:alt: Coverage status

Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
import sys
from pathlib import Path

current_dir = Path(__file__).parent.parent
current_dir = Path(__file__).parents[1]
code_directory = current_dir / "open_api_framework"

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


# -- Project information -----------------------------------------------------
Expand Down
30 changes: 15 additions & 15 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
Welcome to open_api_framework's documentation!
=================================================

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

|python-versions| |django-versions| |pypi-version|
|python-versions| |django-versions|

<One liner describing the project>

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


.. |build-status| image:: https://github.com/maykinmedia/open_api_framework/workflows/Run%20CI/badge.svg
.. |build-status| image:: https://github.com/maykinmedia/open-api-framework/workflows/Run%20CI/badge.svg
:alt: Build status
:target: https://github.com/maykinmedia/open_api_framework/actions?query=workflow%3A%22Run+CI%22
:target: https://github.com/maykinmedia/open-api-framework/actions?query=workflow%3A%22Run+CI%22

.. |code-quality| image:: https://github.com/maykinmedia/open_api_framework/workflows/Code%20quality%20checks/badge.svg
.. |code-quality| image:: https://github.com/maykinmedia/open-api-framework/workflows/Code%20quality%20checks/badge.svg
:alt: Code quality checks
:target: https://github.com/maykinmedia/open_api_framework/actions?query=workflow%3A%22Code+quality+checks%22
:target: https://github.com/maykinmedia/open-api-framework/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/open_api_framework/branch/master/graph/badge.svg
:target: https://codecov.io/gh/maykinmedia/open_api_framework
.. |coverage| image:: https://codecov.io/gh/maykinmedia/open-api-framework/branch/master/graph/badge.svg
:target: https://codecov.io/gh/maykinmedia/open-api-framework
:alt: Coverage status

.. |docs| image:: https://readthedocs.org/projects/open_api_framework/badge/?version=latest
:target: https://open_api_framework.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status
.. .. |docs| image:: https://readthedocs.org/projects/open-api-framework/badge/?version=latest
.. :target: https://open-api-framework.readthedocs.io/en/latest/?badge=latest
.. :alt: Documentation Status

.. |python-versions| image:: https://img.shields.io/pypi/pyversions/open_api_framework.svg
.. |python-versions| image:: https://img.shields.io/pypi/pyversions/open-api-framework.svg

.. |django-versions| image:: https://img.shields.io/pypi/djversions/open_api_framework.svg
.. |django-versions| image:: https://img.shields.io/pypi/djversions/open-api-framework.svg

.. |pypi-version| image:: https://img.shields.io/pypi/v/open_api_framework.svg
:target: https://pypi.org/project/open_api_framework/
.. .. |pypi-version| image:: https://img.shields.io/pypi/v/open-api-framework.svg
.. :target: https://pypi.org/project/open-api-framework/
1 change: 0 additions & 1 deletion open_api_framework/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "open_api_framework.apps.OpenApiFrameworkConfig"
5 changes: 5 additions & 0 deletions open_api_framework/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class OpenApiFrameworkConfig(AppConfig):
name = "open_api_framework"
Empty file added open_api_framework/py.typed
Empty file.
108 changes: 107 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,109 @@
[build-system]
requires = ["setuptools >= 30.3.0"] # version supporting setup.cfg]
requires = ["setuptools>=61.0.0"]
build-backend = "setuptools.build_meta"

[project]
name = "open_api_framework"
version = "0.1.0"
description = "TODO"
authors = [
{name = "Maykin Media", email = "[email protected]"}
]
readme = "README.rst"
license = {file = "LICENSE"}
keywords = ["TODO"]
classifiers = [
"Development Status :: 3 - Alpha",
"Framework :: Django",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4.2",
"Intended Audience :: Developers",
"Operating System :: Unix",
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Software Development :: Libraries :: Python Modules",
]
requires-python = ">=3.9"
dependencies = [
"django>=3.2.23",
"django-axes>=6.3.0",
"django-admin-index>=3.1.0",
"django-redis>=5.4.0",
"djangorestframework>=3.12.4",
"drf-spectacular>=0.27.0",
"commonground-api-common>=1.12.1",
"mozilla-django-oidc-db>=0.14.1",
"zgw-consumers>=0.27.0",
"psycopg2>=2.9.9",
"python-dotenv>=1.0.0",
"python-decouple>=3.8",
"requests>=2.31.0",
"uwsgi>=2.0.23",
"sentry-sdk>=1.39.2",
"elastic-apm>=6.20.0",
"celery>=5.2.7"
]

[project.urls]
Homepage = "https://github.com/maykinmedia/open_api_framework"
Documentation = "http://open_api_framework.readthedocs.io/en/latest/"
"Bug Tracker" = "https://github.com/maykinmedia/open_api_framework/issues"
"Source Code" = "https://github.com/maykinmedia/open_api_framework"

[project.optional-dependencies]
tests = [
"pytest",
"pytest-django",
"tox",
"isort",
"black",
"flake8",
]
coverage = [
"pytest-cov",
]
docs = [
"sphinx",
"sphinx-rtd-theme",
]
release = [
"bump-my-version",
"twine",
]

[tool.setuptools.packages.find]
include = ["open_api_framework*"]
namespaces = false

[tool.isort]
profile = "black"
combine_as_imports = true
known_django = "django"
known_first_party="open_api_framework"
sections=["FUTURE", "STDLIB", "DJANGO", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]

[tool.pytest.ini_options]
testpaths = ["tests"]
DJANGO_SETTINGS_MODULE = "testapp.settings"

[tool.bumpversion]
current_version = "0.1.0"
files = [
{filename = "pyproject.toml"},
{filename = "README.rst"},
{filename = "docs/conf.py"},
]

[tool.coverage.report]
exclude_also = [
"if (typing\\.)?TYPE_CHECKING:",
"@(typing\\.)?overload",
"class .*\\(.*Protocol.*\\):",
"@(abc\\.)?abstractmethod",
"raise NotImplementedError",
"\\.\\.\\.",
"pass",
]
Loading