Skip to main content

Django package to generate ccbv.co.uk-style documentation for your own code

Project description

Django Classy DOC

django-classy-doc brings Classy Class-Based Views-style docs to your own code

Installation

From PyPI

pip install django-classy-doc

From the repo

pip install -e https://gitlab.levitnet.be/levit/django-classy-doc.git

Getting started

To generate the documentation, run

./manage.py classify

This will create documentation for your project and save the output in ./output

For more usage information run

./manage.py classify --help

Configuration

Set these in your settings.py file.

django-classy-doc has several configuration options, the most important are CLASSY_DOC_BASES, CLASSY_DOC_MODULE_TYPES and CLASSY_DOC_KNOWN_APPS.

CLASSY_DOC_BASES

This is the list of strings of the base modules you want to document, if you leave it unset, djang-classy-doc will document every application from your INSTALLED_APPS

django-classy-docs will string-match everything from your INSTALLED_APPS that starts with any of the mentioned strings

ex:

CLASSY_DOC_BASES = ['catalog', 'custom_auth', 'account']

CLASSY_DOC_MODULE_TYPES

These are the modules type django-classy-doc will try to import from every application that matches CLASSY_DOC_BASES. It defaults to ['models', 'views'].

So, assuming your project looks like this:

+  mod1
|  +  apps.py
|  +  admin.py
|  +  models.py
|  +  views.py
+  mod2
|  +  apps.py
|  +  admin.py
|  +  models.py
+  mod3
|  +  apps.py
|  +  views.py

The following modules will be documented: mod1.models, mod1.views, mod2.models, mod3.views

CLASSY_DOC_KNOWN_APPS

A dictionary of lists that represents the "known apps" that you want to hide by default. This means that properties and methods present in your classes (that extend these bases classes) that are only defined in these base classes, will be hidden at first. All sections of the generated documentation will have a checkbox for each of these known apps that will let you show/hide thes properties and methods.

If left unset, it will default to {'django': ['django']}

ex:

CLASSY_KNOWN_APPS = {
  'django': ['django'],                                                      
  'DRF': ['rest_framework', 'django_filters'],
  'wagtail': ['wagtail', 'treebeard', 'modelcluster'],
}

Other configuration

CLASSY_DOC_ALSO_INCLUDE

A list of modules (that would otherwise not be matched) that django-classy-doc should also try to document. This defaults to an empty list.

CLASSY_DOC_ALSO_EXCLUDE

A list of modules (that would otherwise be matched) that django-classy-doc should not try to document. This defaults to an empty list.

`CLASSY_DOC_NON_INSTALLED_APPS``

A list of modules, not present in INSTALLED_APPS to include in the search for modules. This is mostly useful if you want to document DJango itself.

Recipes

CCBV

In order to replicate CCBV, these are the settings you should set:

CLASSY_DOC_BASES = ['django.views.generic']
CLASSY_DOC_NON_INSTALLED_APPS = ['django.views.generic']
CLASSY_DOC_MODULE_TYPES = [
    'base',
    'dates',
    'detail',
    'edit',
    'list',
]
CLASSY_DOC_KNOWN_APPS = {}

CDRF

In order to replicate CDRF, these are the settings you should set:

CLASSY_DOC_BASES = ['rest_framework']
CLASSY_DOC_MODULE_TYPES = ['generics', 'mixins', 'pagination', 'serializers', 'views', 'viewsets']
CLASSY_DOC_KNOWN_APPS = {}

CDDB

In order to replicate CDDB, these are the settings you should set:

CLASSY_DOC_BASES = ['django.db', 'django.db.models']
CLASSY_DOC_NON_INSTALLED_APPS = ['django.db.models', 'django.db']
CLASSY_DOC_MODULE_TYPES = [
    'base',
    'fields',
    'enums',
    'expressions',
    'constraints',
    'indexes',
    'lookups',
    'aggregates',
    'constants',
    'deletion',
    'functions',
    'manager',
    'query_utils',
    'sql',
    'options',
    'query',
    'signals',
    'utils',
    'transaction',
]
CLASSY_DOC_KNOWN_APPS = {}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_classy_doc-0.0.2.tar.gz (4.4 kB view details)

Uploaded Source

File details

Details for the file django_classy_doc-0.0.2.tar.gz.

File metadata

  • Download URL: django_classy_doc-0.0.2.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.9

File hashes

Hashes for django_classy_doc-0.0.2.tar.gz
Algorithm Hash digest
SHA256 db3ccaf9b3a3cc54d115d26fb88f034924696c69fe275f52c82832d61fb55645
MD5 e9458755fe88d132d97014af7580b1e2
BLAKE2b-256 6f00bf07f3c770fbf9fa7fd496f3ea4a3ceb49ffa52c72dc43f66d9148286c71

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page