Skip to content

Commit

Permalink
trying to improve github doc hosting
Browse files Browse the repository at this point in the history
  • Loading branch information
jaumebonet committed Apr 10, 2018
1 parent 996cdc6 commit eb70a6f
Show file tree
Hide file tree
Showing 175 changed files with 199 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs
8 changes: 7 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,18 @@
'Programming Language :: Python :: 3.6',
],

project_urls={
'Documentation': 'http://jaumebonet.cat/libconfig',
'Source': 'https://github.com/jaumebonet/libconfig/',
'Tracker': 'https://github.com/jaumebonet/libconfig/issues',
},

platforms='UNIX',
keywords='development',

install_requires=['pandas', 'pyyaml', 'six'],

packages=find_packages(exclude=['docs', 'test']),
packages=find_packages(exclude=['docs', 'test', 'sphinx-docs']),
include_package_data=True,
zip_safe=False,
)
File renamed without changes.
File renamed without changes.
Binary file added sphinx-docs/builddoc/doctrees/api.doctree
Binary file not shown.
Binary file added sphinx-docs/builddoc/doctrees/environment.pickle
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added sphinx-docs/builddoc/doctrees/index.doctree
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
30 changes: 30 additions & 0 deletions sphinx-docs/source/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.. _api_ref:

.. currentmodule:: libconfig

API reference
=============

.. _grid_api:

Functions
---------

.. autosummary::
:toctree: generated/

~config.check_option
~config.get_option
~config.get_option_default
~config.get_option_description
~config.lock_option
~config.register_option
~config.reset_option
~config.reset_options
~config.set_option
~config.set_options_from_JSON
~config.set_options_from_YAML
~config.set_options_from_dict
~config.show_options
~config.write_options_to_JSON
~config.write_options_to_YAML
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
libconfig.config.check\_option
==============================

.. currentmodule:: libconfig.config

.. autofunction:: check_option
6 changes: 6 additions & 0 deletions sphinx-docs/source/generated/libconfig.config.get_option.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
libconfig.config.get\_option
============================

.. currentmodule:: libconfig.config

.. autofunction:: get_option
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
libconfig.config.get\_option\_default
=====================================

.. currentmodule:: libconfig.config

.. autofunction:: get_option_default
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
libconfig.config.get\_option\_description
=========================================

.. currentmodule:: libconfig.config

.. autofunction:: get_option_description
6 changes: 6 additions & 0 deletions sphinx-docs/source/generated/libconfig.config.lock_option.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
libconfig.config.lock\_option
=============================

.. currentmodule:: libconfig.config

.. autofunction:: lock_option
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
libconfig.config.register\_option
=================================

.. currentmodule:: libconfig.config

.. autofunction:: register_option
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
libconfig.config.reset\_option
==============================

.. currentmodule:: libconfig.config

.. autofunction:: reset_option
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
libconfig.config.reset\_options
===============================

.. currentmodule:: libconfig.config

.. autofunction:: reset_options
6 changes: 6 additions & 0 deletions sphinx-docs/source/generated/libconfig.config.set_option.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
libconfig.config.set\_option
============================

.. currentmodule:: libconfig.config

.. autofunction:: set_option
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
libconfig.config.set\_options\_from\_JSON
=========================================

.. currentmodule:: libconfig.config

.. autofunction:: set_options_from_JSON
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
libconfig.config.set\_options\_from\_YAML
=========================================

.. currentmodule:: libconfig.config

.. autofunction:: set_options_from_YAML
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
libconfig.config.set\_options\_from\_dict
=========================================

.. currentmodule:: libconfig.config

.. autofunction:: set_options_from_dict
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
libconfig.config.show\_options
==============================

.. currentmodule:: libconfig.config

.. autofunction:: show_options
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
libconfig.config.write\_options\_to\_JSON
=========================================

.. currentmodule:: libconfig.config

.. autofunction:: write_options_to_JSON
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
libconfig.config.write\_options\_to\_YAML
=========================================

.. currentmodule:: libconfig.config

.. autofunction:: write_options_to_YAML
71 changes: 71 additions & 0 deletions sphinx-docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
.. libconfig documentation master file, created by
sphinx-quickstart on Thu Jan 18 11:39:05 2018.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
libconfig: global config variables for libraries
================================================


``libconfig`` is a Python library inspired by `pandas <https://pandas.pydata.org/>`_
to manage global configuration variables in your own python libraries.

To see the code, please visit the `github repository <https://github.com/jaumebonet/libconfig>`_.

Report bugs and problems through our `issue tracker <https://github.com/jaumebonet/RosettaSilentToolbox/issues>`_.

Install
-------

You can install ``libconfig`` directly from **PyPi**::

pip install libconfig

Basic Example
-------------

The most expected way to use the library is by creating a ``core`` file in your library in which to setup the global
values of your library. As an example, a minimized vertion of the configuration of the
`RosettaSilentToolbox <https://github.com/jaumebonet/RosettaSilentToolbox>`_ looks like this:

.. ipython::

In [1]: import multiprocessing
...:
...: from libconfig import *
...:
...: try:
...: # Register IO control options
...: register_option("system", "overwrite", False, "bool", "Allow overwriting already existing files")
...: register_option("system", "output", "./", "path_out", "Default folder to output generated files")
...: register_option("system", "cpu", multiprocessing.cpu_count() - 1, "int", "Available CPU for multiprocessing")
...:
...: # Finally, register_option and reset_option are taken out from the global view so that
...: # they are not imported with the rest of the functions. This way the user can not access
...: # to them when importing the library and has to work through the rest of the available
...: # functions.
...: for name in ["register_option", "reset_options"]:
...: del globals()[name]
...:
...: except Exception:
...: # This avoids recalling this every time, as register_option will raise an error when
...: # trying to re-register. Basically, this is the equivalent to Cpp's #IFDEF
...: pass

This ends up loading a starting set of options:

.. ipython::

In [2]: import pandas as pd
...: pd.set_option('display.width', 1000)
...: show_options()

And exposing only to the rest of the library (and maybe to the user) the functions to modify those options
in a controlled manner by taking out :func:`.register_option` and :func:`.reset_options` from the global view.

A list of all the available functions can be found in the :ref:`API <api>`.

.. toctree::
:hidden:

api

0 comments on commit eb70a6f

Please sign in to comment.