Skip to content

Commit

Permalink
Merge pull request #193 from radinamatic/404-for-0.6-2
Browse files Browse the repository at this point in the history
Hiding dev docs
  • Loading branch information
radinamatic committed Aug 27, 2020
2 parents 10792a0 + 5479f76 commit c27ca40
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 107 deletions.
72 changes: 2 additions & 70 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,74 +32,6 @@
parent = os.path.dirname(cwd)
sys.path.insert(0, os.path.abspath(parent))

# This import *must* come after the path insertion, otherwise sphinx won't be able to find the kolibri module
import kolibri # noqa

builddir = os.path.join(cwd, '_build')

# When we start loading stuff from kolibri, we're gonna need this
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "kolibri.deployment.default.settings.base")
os.environ["KOLIBRI_HOME"] = os.path.join(builddir, 'kolibri_home')

sys.path.append(os.path.join(os.path.dirname(kolibri.__file__), "dist"))

print(sys.path)

import django
from django.utils.html import strip_tags
from django.utils.encoding import force_text

if not os.path.exists(os.environ["KOLIBRI_HOME"]):
os.mkdir(os.environ["KOLIBRI_HOME"])

django.setup()

# Monkey patch this so we don't have any complaints during Sphinx inspect
from django.db.models.fields import files # noqa
files.FileDescriptor.__get__ = lambda *args: None


# Auto list fields from django models - from https://djangosnippets.org/snippets/2533/#c5977
def process_docstring(app, what, name, obj, options, lines):
# This causes import errors if left outside the function
from django.db import models

# Only look at objects that inherit from Django's base model class
if inspect.isclass(obj) and issubclass(obj, models.Model):
# Grab the field list from the meta class
fields = obj._meta.get_fields()

for field in fields:
# Skip ManyToOneRel and ManyToManyRel fields which have no 'verbose_name' or 'help_text'
if not hasattr(field, 'verbose_name'):
continue

# Decode and strip any html out of the field's help text
help_text = strip_tags(force_text(field.help_text))

# Decode and capitalize the verbose name, for use if there isn't
# any help text
verbose_name = force_text(field.verbose_name).capitalize()

if help_text:
# Add the model field to the end of the docstring as a param
# using the help text as the description
lines.append(u':param %s: %s' % (field.attname, help_text))
else:
# Add the model field to the end of the docstring as a param
# using the verbose name as the description
lines.append(u':param %s: %s' % (field.attname, verbose_name))

# Add the field's type to the docstring
if isinstance(field, models.ForeignKey):
to = field.rel.to
lines.append(u':type %s: %s to :class:`~%s`' % (field.attname, type(field).__name__, to))
else:
lines.append(u':type %s: %s' % (field.attname, type(field).__name__))

return lines


# -- General configuration -----------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
Expand All @@ -109,6 +41,8 @@ def process_docstring(app, what, name, obj, options, lines):
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'sphinx_rtd_theme', 'notfound.extension',]

builddir = os.path.join(cwd, '_build')

linkcheck_ignore = [
'https://groups.google.com/a/learningequality.org/forum/#!forum/dev',
]
Expand Down Expand Up @@ -237,8 +171,6 @@ def process_docstring(app, what, name, obj, options, lines):
# and https://github.com/altair-viz/altair/pull/418/files
# https://github.com/rtfd/sphinx_rtd_theme/issues/117
def setup(app):
# Register the docstring processor with sphinx
app.connect('autodoc-process-docstring', process_docstring)
# Add our custom CSS overrides
app.add_stylesheet('theme_overrides.css')

Expand Down
2 changes: 0 additions & 2 deletions docs/contributing/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ Contributing

.. _contributing:

.. include:: ../../CONTRIBUTING.rst


Code of conduct
===============
Expand Down
36 changes: 1 addition & 35 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,9 @@ Getting Started
---------------

.. toctree::
:maxdepth: 1
:maxdepth: 2

user/index
dev/index
changelog
contributing/index
authors

Kolibri
=======

.. image:: https://badge.fury.io/py/kolibri.svg
:target: https://pypi.python.org/pypi/kolibri/
.. image:: https://travis-ci.org/learningequality/kolibri.svg
:target: https://travis-ci.org/learningequality/kolibri
.. image:: http://codecov.io/github/learningequality/kolibri/coverage.svg?branch=master
:target: http://codecov.io/github/learningequality/kolibri?branch=master
.. image:: https://readthedocs.org/projects/kolibri/badge/?version=latest
:target: http://kolibri.readthedocs.org/en/latest/


What is Kolibri?
Expand All @@ -39,21 +23,3 @@ insight (like "next lesson" recommendations), and to allow user data to be synce
thus a Kolibri learner can use his or her credentials on any linked Kolibri installation, for instance on different
devices at a school.

See https://learningequality.org/kolibri/ for more info.


How can I use it?
-----------------

Kolibri is under active development and is not yet ready to be used. In the meantime, take a look at `KA-Lite <https://learningequality.org/ka-lite/>`_, Kolibri's predecessor which is already deployed around the world.


How can I contribute?
---------------------

.. warning::
We welcome new contributors but since **Kolibri** is still in development, the API is not yet completely ready to integrate external plugins. Please start by:

* Reading our `Developer Documentation <http://kolibri.readthedocs.io/en/develop/dev/getting_started.html>`_ available online, and in the ``docs/`` directory.
* Contacting us on the Mailing list: `Google groups <https://groups.google.com/a/learningequality.org/forum/#!forum/dev>`_.
* or via IRC: #kolibri on Freenode.

0 comments on commit c27ca40

Please sign in to comment.