Skip to content

Commit 499ce4c

Browse files
committed
feat: django easy api framework base version
1 parent e7ecbe4 commit 499ce4c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+4440
-1
lines changed

.dcignore

Lines changed: 1547 additions & 0 deletions
Large diffs are not rendered by default.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,3 +388,4 @@ easy/media/
388388
/.idea/misc.xml
389389
/.idea/modules.xml
390390
/.idea/vcs.xml
391+
/.idea/django-api-framework.iml

.isort.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[settings]
2+
profile = black
3+
combine_as_imports = true

.pre-commit-config.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.3.0
4+
hooks:
5+
- id: check-merge-conflict
6+
7+
- repo: https://github.com/asottile/yesqa
8+
rev: v1.3.0
9+
hooks:
10+
- id: yesqa
11+
12+
- repo: https://github.com/pre-commit/pre-commit-hooks
13+
rev: v4.3.0
14+
hooks:
15+
- id: check-yaml
16+
- id: end-of-file-fixer
17+
exclude: '.bumpversion.cfg'
18+
- id: trailing-whitespace
19+
exclude: '.bumpversion.cfg'
20+
- id: requirements-txt-fixer
21+
- id: detect-private-key
22+
- id: detect-aws-credentials
23+
args: [--allow-missing-credentials]
24+
25+
- repo: https://github.com/psf/black
26+
rev: 22.8.0
27+
hooks:
28+
- id: black
29+
30+
- repo: https://github.com/PyCQA/isort
31+
rev: 5.10.1
32+
hooks:
33+
- id: isort
34+
35+
- repo: https://github.com/PyCQA/flake8
36+
rev: 5.0.4
37+
hooks:
38+
- id: flake8
39+
args: ["--config=setup.cfg"]
40+
additional_dependencies: [flake8-isort]

.pylintrc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[MASTER]
2+
load-plugins=pylint_django, pylint_celery
3+
4+
[FORMAT]
5+
max-line-length=88
6+
7+
[MESSAGES CONTROL]
8+
disable=missing-docstring,invalid-name
9+
10+
[DESIGN]
11+
max-parents=13
12+
13+
[TYPECHECK]
14+
generated-members=REQUEST,acl_users,aq_parent,"[a-zA-Z]+_set{1,2}",save,delete

CONTRIBUTORS.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
freemindcore

Makefile

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
.PHONY: help docs
2+
.DEFAULT_GOAL := help
3+
4+
help:
5+
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
6+
7+
clean: ## Removing cached python compiled files
8+
find . -name \*pyc | xargs rm -fv
9+
find . -name \*pyo | xargs rm -fv
10+
find . -name \*~ | xargs rm -fv
11+
find . -name __pycache__ | xargs rm -rfv
12+
13+
install: ## Install dependencies
14+
make clean
15+
flit install --deps develop --symlink
16+
17+
lint: ## Run code linters
18+
autoflake --remove-all-unused-imports --remove-unused-variables --ignore-init-module-imports -r easy
19+
black --check easy
20+
isort --check easy
21+
flake8
22+
mypy easy
23+
24+
fmt format: ## Run code formatters
25+
autoflake --in-place --remove-all-unused-imports --remove-unused-variables --ignore-init-module-imports -r easy
26+
isort easy
27+
black easy
28+
29+
test: ## Run tests
30+
pytest
31+
32+
test-cov: ## Run tests with coverage
33+
pytest --cov=easy --cov-report term
34+
35+
test-cov-full: ## Run tests with coverage term-missing
36+
pytest --cov=easy --cov-report term-missing tests
37+
38+
doc-deploy: ## Run Deploy Documentation
39+
make clean
40+
mkdocs gh-deploy --force
41+
42+
bump:
43+
bumpversion patch
44+
45+
bump-feat:
46+
bumpversion feat
47+
48+
bump-major:
49+
bumpversion major
50+
51+
bump-build:
52+
bumpversion build

README.md

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,58 @@
1-
# Django Easy API
1+
# Django Easy API Framework
2+
3+
### Easy and Fast Django REST framework based on Django-ninja-extra
4+
5+
- Auto CRUD Async API generation for all django models, configurable
6+
- Domain/Service/Controller base structure for better code organization
7+
- Base Permission class and more to come
8+
- Pure class based Django-ninja APIs, based on Django-Ninja-extra
9+
10+
_Note: this project is still in early stage, comments and advices are highly appreciated._
11+
12+
```
13+
Django-Ninja features :
14+
15+
Easy: Designed to be easy to use and intuitive.
16+
FAST execution: Very high performance thanks to Pydantic and async support.
17+
Fast to code: Type hints and automatic docs lets you focus only on business logic.
18+
Standards-based: Based on the open standards for APIs: OpenAPI (previously known as Swagger) and JSON Schema.
19+
Django friendly: (obviously) has good integration with the Django core and ORM.
20+
21+
Plus Extra:
22+
Class Based: Design your APIs in a class based fashion.
23+
Permissions: Protect endpoint(s) at ease with defined permissions and authorizations at route level or controller level.
24+
Dependency Injection: Controller classes supports dependency injection with python Injector or django_injector. Giving you the ability to inject API dependable services to APIController class and utilizing them where needed
25+
```
226

327
### Requirements
428
- Python >= 3.6
529
- Django >= 2.1
630
- pydantic >= 1.6
731
- Django-Ninja-extra >= 0.15.0
832

33+
### Install
34+
`pip install django-api-framework`
35+
36+
Then add "easy" to your django INSTALLED_APPS:
37+
38+
```
39+
[
40+
...,
41+
"easy",
42+
...,
43+
]
44+
```
45+
46+
47+
Get your admin api up and running:
48+
```
49+
api_admin_v1 = EasyAPI(
50+
urls_namespace="admin_api",
51+
version="v1.0.0",
52+
)
53+
54+
# Automatic Admin API generation
55+
api_admin_v1.auto_create_admin_controllers()
56+
```
57+
58+
Please check tests/demo_app for more.

docs/Makefile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
APP = /app
11+
12+
.PHONY: help livehtml apidocs Makefile
13+
14+
# Put it first so that "make" without argument is like "make help".
15+
help:
16+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -c .
17+
18+
# Build, watch and serve docs with live reload
19+
livehtml:
20+
sphinx-autobuild -b html --host 0.0.0.0 --port 9000 --watch $(APP) -c . $(SOURCEDIR) $(BUILDDIR)/html
21+
22+
# Outputs rst files from django application code
23+
apidocs:
24+
sphinx-apidoc -o $(SOURCEDIR)/api $(APP)
25+
26+
# Catch-all target: route all unknown targets to Sphinx using the new
27+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
28+
%: Makefile
29+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -c .

docs/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Included so that Django's startproject comment runs against the docs directory

0 commit comments

Comments
 (0)