Skip to content

Commit

Permalink
doc work
Browse files Browse the repository at this point in the history
  • Loading branch information
bckohan committed Jan 31, 2024
1 parent e0f6615 commit ad7b927
Show file tree
Hide file tree
Showing 11 changed files with 123 additions and 20 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ All of the BaseCommand functionality is preserved, so that TyperCommand can be a

.. warning::

This is an early beta release. Expect rapid changes.
This is a late beta release. The interface is mostly stable but there may be lingering issues.


.. code-block:: python
Expand Down
27 changes: 14 additions & 13 deletions django_typer/__init__.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
r"""
___ _ _____
/ (_) __ _ _ __ __ _ ___ /__ \_ _ _ __ ___ _ __
/ /\ / |/ _` | '_ \ / _` |/ _ \ / /\/ | | | '_ \ / _ \ '__|
/ /_//| | (_| | | | | (_| | (_) | / / | |_| | |_) | __/ |
/___,'_/ |\__,_|_| |_|\__, |\___/ \/ \__, | .__/ \___|_|
|__/ |___/ |___/|_|
::
___ _ _____
/ (_) __ _ _ __ __ _ ___ /__ \_ _ _ __ ___ _ __
/ /\ / |/ _` | '_ \ / _` |/ _ \ / /\/ | | | '_ \ / _ \ '__|
/ /_//| | (_| | | | | (_| | (_) | / / | |_| | |_) | __/ |
/___,'_/ |\__,_|_| |_|\__, |\___/ \/ \__, | .__/ \___|_|
|__/ |___/ |___/|_|
django-typer provides an extension to the base django management command class that
melds the typer/click infrastructure with the django infrastructure. The result is
all the ease of specifying commands, groups and options and arguments using typer and
click in a way that feels like and is interface compatible with django's base
management commands This should enable a smooth transition for existing django
commands and an intuitive feel for implementing new commands.
click in a way that feels like and is interface compatible with django's BaseCommand_
This should enable a smooth transition for existing django commands and an intuitive
feel for implementing new commands.
django-typer also supports shell completion for bash, zsh, fish and powershell and
extends that support to native django management commands as well.
Expand Down Expand Up @@ -46,7 +48,6 @@

import contextlib
import inspect
import os
import sys
import typing as t
from copy import deepcopy
Expand Down Expand Up @@ -78,7 +79,7 @@
from .types import Style as ColorStyle
from .types import Traceback, Verbosity, Version

VERSION = (0, 4, "0b")
VERSION = (0, 5, "0b")

__title__ = "Django Typer"
__version__ = ".".join(str(i) for i in VERSION)
Expand Down Expand Up @@ -1288,7 +1289,7 @@ class definition time (i.e. on module load). When the TyperCommand is instantiat
the command tree is built thats used for subcommand resolution in django-typer's
get_command method and for help output.
All of the documented BaseCommand functionality works as expected. call_command()
All of the documented BaseCommand_ functionality works as expected. call_command()
also works as expected. TyperCommands however add a few extra features:
- Simple TyperCommands implemented only using handle() can be invoked directly
Expand Down Expand Up @@ -1520,7 +1521,7 @@ def execute(self, *args, **options):
below this call may use get_current_command() to get a reference
to the command instance.
*args and **options are passed to handle().
args and options are passed to handle().
:param args: the arguments to pass to the command
:param options: the options to pass to the command
Expand Down
3 changes: 3 additions & 0 deletions doc/source/_static/commands.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.wy-nav-content {
max-width: 100%;
}
Empty file added doc/source/_static/style.css
Empty file.
25 changes: 23 additions & 2 deletions doc/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,28 @@
Change Log
==========

v0.1.0
======
v0.5.0b
=======

* Incremental Beta Release

v0.4.0b
=======

* Incremental Beta Release

v0.3.0b
=======

* Incremental Beta Release

v0.2.0b
=======

* Incremental Beta Release


v0.1.0b
=======

* Initial Release (Beta)
9 changes: 9 additions & 0 deletions doc/source/commands.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
========
Commands
========

.. typer:: django_typer.management.commands.shellcompletion.Command:typer_app
:prog: shellcompletion
:width: 100
:show-nested:
:make-sections:
16 changes: 15 additions & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
from datetime import datetime
import sys
import os
from pathlib import Path
from sphinx.ext.autodoc import between
import django

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_typer.tests.settings')
django.setup()

sys.path.append(str(Path(__file__).parent.parent.parent))
import django_typer
Expand Down Expand Up @@ -64,10 +69,18 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = []
html_static_path = [
'_static',
]
html_css_files = [
'style.css',
]

todo_include_todos = True

def add_page_class(app, pagename, templatename, context, doctree):
from sphinx.builders.html._assets import _CascadingStyleSheet
context['css_files'] += [_CascadingStyleSheet(f'_static/{pagename}.css')]

def setup(app):
# Register a sphinx.ext.autodoc.between listener to ignore everything
Expand All @@ -76,4 +89,5 @@ def setup(app):
'autodoc-process-docstring',
between('^.*[*]{79}.*$', exclude=True)
)
app.connect('html-page-context', add_page_class)
return app
1 change: 1 addition & 0 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ Installation
:maxdepth: 2
:caption: Contents:

commands
reference
changelog
57 changes: 55 additions & 2 deletions doc/source/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Reference

.. _base:

Base Classes
django_typer
------------

.. automodule:: django_typer
Expand All @@ -20,8 +20,61 @@ Base Classes

.. _types:

Types
types
-----

.. automodule:: django_typer.types
:members:


.. _parsers:

parsers
-------

.. automodule:: django_typer.parsers
:members:

.. _completers:

completers
----------

.. automodule:: django_typer.completers
:members:

.. _utils:

utils
-----

.. automodule:: django_typer.utils
:members:


.. _patch:

patch
-----

.. automodule:: django_typer.patch
:members:


.. _apps:

apps
----

.. automodule:: django_typer.apps
:members:


.. _shellcompletion:

shellcompletion
---------------

.. automodule:: django_typer.management.commands.shellcompletion
:members:

1 change: 1 addition & 0 deletions doc/source/refs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
.. _PyPI: https://pypi.python.org/pypi/django-typer
.. _Typer: https://typer.tiangolo.com/
.. _DRY: https://en.wikipedia.org/wiki/Don%27t_repeat_yourself
.. _BaseCommand: https://docs.djangoproject.com/en/stable/howto/custom-management-commands/#command-objects
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "django-typer"
version = "0.4.0b"
version = "0.5.0b"
description = "Use Typer to define the CLI for your Django management commands."
authors = ["Brian Kohan <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit ad7b927

Please sign in to comment.