Skip to content
This repository has been archived by the owner on Dec 9, 2022. It is now read-only.

Commit

Permalink
More On Docs
Browse files Browse the repository at this point in the history
  • Loading branch information
naveen521kk committed Sep 27, 2020
1 parent 2064b54 commit 51fd9d6
Show file tree
Hide file tree
Showing 12 changed files with 257 additions and 24 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ auto-save-list
tramp
.\#*

docs/build/**
*.pickle
# Org-mode
.org-id-locations
*_archive
Expand Down
10 changes: 10 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
sphinx:
configuration: docs/source/conf.py
formats: all

python:
version: 3.8
install:
- method: pip
path: .
29 changes: 29 additions & 0 deletions docs/source/_templates/autosummary/class.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{{ fullname | escape | underline}}

.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}
:members:

{% block methods %}
{%- if methods %}
.. rubric:: {{ _('Methods') }}

.. autosummary::
:nosignatures:
{% for item in methods if item != '__init__' and item not in inherited_members %}
~{{ name }}.{{ item }}
{%- endfor %}
{%- endif %}
{%- endblock %}

{% block attributes %}
{%- if attributes %}
.. rubric:: {{ _('Attributes') }}

.. autosummary::
{% for item in attributes %}
~{{ name }}.{{ item }}
{%- endfor %}
{%- endif %}
{% endblock %}
64 changes: 64 additions & 0 deletions docs/source/_templates/autosummary/module.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{{ fullname | escape | underline }}

.. currentmodule:: {{ fullname }}

.. automodule:: {{ fullname }}

{% block attributes %}
{% if attributes %}
.. rubric:: Module Attributes

.. autosummary::
{% for item in attributes %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block functions %}
{% if functions %}
.. rubric:: {{ _('Functions') }}

.. autosummary::
{% for item in functions %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block classes %}
{% if classes %}
.. rubric:: Classes

.. autosummary::
:toctree: .
:nosignatures:
{% for class in classes %}
{{ class }}
{% endfor %}
{% endif %}
{% endblock %}

{% block exceptions %}
{% if exceptions %}
.. rubric:: {{ _('Exceptions') }}

.. autosummary::
{% for item in exceptions %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block modules %}
{% if modules %}
.. rubric:: Modules

.. autosummary::
:toctree:
:recursive:
{% for item in modules %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
59 changes: 36 additions & 23 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,21 @@
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
import os
import sys

sys.path.insert(0, os.path.abspath("../.."))


# -- Project information -----------------------------------------------------
import sphinx_rtd_theme
import sphinx_rtd_theme # noqa:E402,F401

project = 'SXCU'
copyright = '2020, Naveen M K'
author = 'Naveen M K'
project = "SXCU"
copyright = "2020, Naveen M K"
author = "Naveen M K"

# The full version, including alpha/beta/rc tags
release = 'v0.1.0a0'
release = "v0.1.0a0"


# -- General configuration ---------------------------------------------------
Expand All @@ -32,11 +33,21 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"sphinx_rtd_theme"
"sphinx.ext.autosectionlabel",
"sphinx.ext.intersphinx",
"sphinx.ext.autodoc",
"sphinx_rtd_theme",
"sphinx.ext.napoleon",
"sphinx.ext.autosummary",
]


intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
}

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand All @@ -48,26 +59,28 @@

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'

html_theme = "sphinx_rtd_theme"

html_theme_options = {
'analytics_id': 'UA-140820927-3', # Provided by Google in your dashboard
'logo_only': False,
'display_version': True,
'prev_next_buttons_location': 'bottom',
'style_external_links': True,
'style_nav_header_background': 'cyan',
"analytics_id": "UA-140820927-3",
"logo_only": False,
"display_version": True,
"prev_next_buttons_location": "bottom",
"style_external_links": True,
"style_nav_header_background": "black",
# Toc options
'collapse_navigation': True,
'sticky_navigation': True,
'navigation_depth': 4,
"collapse_navigation": True,
"sticky_navigation": True,
"navigation_depth": 4,
}


# 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 = ['_static']
html_static_path = ["_static"]
html_logo = "logo.png"
html_favicon = "favicon.ico"
html_favicon = "favicon.ico"

autosummary_generate = True
44 changes: 44 additions & 0 deletions docs/source/examples.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
========
Examples
========

Uploading a Image to sxcu.net
*****************************

To upload an image `foo.png` located in the same directory as the script and print the url:

.. code-block:: python
import sxcu
connector = sxcu.SXCU()
result = connector.upload_image("foo.png")
print(result["url"])
Parameters acceped are

.. currentmodule:: sxcu

.. autosummary::
:recursive:

~SXCU.upload_image

Uploading Image with ``og_properties``
**************************************

What is ``og_properties``?
--------------------------

`The Open Graph protocol <https://ogp.me/>`_ The Open Graph protocol enables any web page to become a rich object in a social graph.

`sxcu.net <https://sxcu.net>`_ allows the following properties to be changed for changing the way it embed in apps and websites.

How to use it?
--------------

Using the class

.. autosummary::
:recursive:

~og_properties
14 changes: 13 additions & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,22 @@ SCXU is an API wrapper for api located at `sxcu.net <https://sxcu.net/api/docs/i
much this documentation covers with some example and API reference. Currently the documentation
is in building stage.

Installation
************

SXCU can be installed using ``pip``

.. code-block:: powershell
pip install sxcu
.. toctree::
:maxdepth: 2
:maxdepth: 4
:caption: Contents:

examples
reference


Indices and tables
Expand Down
Binary file modified docs/source/logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions docs/source/reference.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Reference
=========

This it python API reference of the current things implemented.

.. currentmodule:: sxcu

********************
Python API Reference
********************

.. autosummary::
:toctree: reference

~SXCU
~og_properties
21 changes: 21 additions & 0 deletions docs/source/reference/sxcu.SXCU.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
sxcu.SXCU
=========

.. currentmodule:: sxcu

.. autoclass:: SXCU
:members:


.. rubric:: Methods

.. autosummary::
:nosignatures:

~SXCU.collection_details
~SXCU.create_collection
~SXCU.create_link
~SXCU.delete_image
~SXCU.domain_list
~SXCU.upload_image
~SXCU.upload_text
15 changes: 15 additions & 0 deletions docs/source/reference/sxcu.og_properties.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
sxcu.og\_properties
===================

.. currentmodule:: sxcu

.. autoclass:: og_properties
:members:


.. rubric:: Methods

.. autosummary::
:nosignatures:

~og_properties.export
7 changes: 7 additions & 0 deletions sxcu/sxcu.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ def __init__(
self.title = title

def export(self) -> str:
"""Exports the Property set to a JSON file.
Returns
=======
:class:`str`
Using ``json.dumps`` the content of JSON file is dumped.
"""
return json.dumps(
{
"color": self.color,
Expand Down

0 comments on commit 51fd9d6

Please sign in to comment.