Skip to main content

Configuration-free Python doc generation via Sphinx.

Project description


Configuration-free Sphinx package documentation.

Flinx aims to be for documentation what Flit is for packaging: a
configuration-free way to get started on {documentation, packaging}, and add
configuration gradually. It also borrows a concept from react-starter-kit: you
can “eject”, and leave Flinx behind.

This tool isn't for everyone. Flinx is a thin wrapper around ``sphinx-build``
and ``sphinx-autobuild``. If you're happy creating a ``docs/`` and using
those commands directly, you don't need this one.

Signs you might be interested in this package:

* You want zero-configuration documentation for new projects.
* You don't want to edit both your module source and ````, when
you rename your module. (I know, you shouldn't do this after you've published.
But I do this a lot during initial development.)
* You don't want to manually edit both your module source, and ````,
when you bump the version number. (Although `bumpversion
<>`_ is an alternative, here.)
* You're an eager guinea pig for early-stage software.



$ python3 -m pip install flinx



$ flinx build

Uses `sphinx-build` to build the HTML documentation.

``flinx build -o`` opens a browser onto the documentation once it's been built.

.. todo:: Currently this pollutes ``./docs``.


$ flinx serve

Uses ``sphinx-autobuild`` to build and serve the HTML documentation.

``flinx serve -o`` opens a browser onto the documentation once it's been built.

Thanks to ``sphinx-autobuild``, the documentation will re-build and re-run when
the sources are changed.

This doesn't extend to the ``pyproject.toml`` configuration file.


$ flinx generate

Writes ``docs/`` and ``docs/index.rst``, that match the current project


$ flinx eject

This is equivalent to ``flinx generate``, except that the files omit the "THIS

.. note::
These command-line options are pretty different from ``sphinx-build`` and
``sphinx-autobuild``. This falls under the heading of “if you're happy with
those tools and know your way around their options, you probably won't like
this package”. They're designed to be more like *other* site generators that
I use, such as Jekyll. Since I *don't* know my way around ``sphinx-build``,
I'm not trying to be compatible with it.


If pyproject.toml_ exists and contains a ``[tool.flinx.metadata]`` table, the
project name, author, version, copyright date (``date``), and description file
are read from that. These are all optional.

If ``pyproject.toml`` contains a ``[tool.flit.metadata]`` Flit_
configuration table, the project name, author, and description file are read
from that.

If ``pyproject.toml`` contains a ``[tool.poetry]`` Poetry_ configuration table,
the project name, author, and version are read from that.

Flinx attempts to automatically discover any information that isn't specified in
the project file:

* Flinx attempts to detect the module. This is the first non-test
directory that contains an ```` file that contains a version
definition, else it's the first non-test ``*.py`` file that contains a version
definition. A version definition is a line of the format ``__version__ =
"1.2.3"``, with single or double quotes. (Flinx ignores whitespace, but does
not import or parse the file.)
* Flix reads the version from the module file (if the module is a single file), or from the
module's `` file (if the module is a directory).
* The author is read from `git config`. It's an error if there's
no project file, and the author isn't available via git.
* The copyright date is the current year.

Add `Sphinx configuration`_ variables to a ``[tool.flinx.configuration]`` table
in ``pyproject.toml``. For example:


html_theme = 'sphinx_rtd_theme'

Extensions in the ``sphinx.ext`` namespace can be abbreviated. For example,
``extensions = ['napoleon', 'todo']`` is equivalent to ``extensions =
['sphinx.ext.napoleon', 'sphinx.ext.todo']``.

Extensions from ``sphinx.ext`` are automatically added, if there's a
configuration variable that begins with the name of that estension. For example,
the presence of ``todo_include_todos = true`` in the project file implies

.. _pyproject.toml:
.. _Flit:
.. _Poetry:
.. _Sphinx configuration:


Flinx isn't compatible with Read the Docs. This is planned, but tricky.


Inspired by `flit <>`_. Built on `sphinx
<>`_ and `sphinx-autobuild

About the Name

“Flinx” is a mash-up of “flit” and “sphinx”. I wanted to name it “flynx”, as a
tribute to `Seveneves <>`_, but I
realized I'd been spelling “sphinx” wrong. There's an app named “Flynx”, so it's
probably just as well.

“Flinx” is also a character in an Allen Dean Foster series. I regret to admit
that I haven't read that series, and that it didn't inform my choice of names.



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

flinx-0.2.0.tar.gz (18.4 kB view hashes)

Uploaded source

Built Distribution

flinx-0.2.0-py3-none-any.whl (24.6 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page