Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new base for docs #450

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

version: 2

build:
os: ubuntu-20.04
tools:
python: "3.10"
python: "3.11"
jobs:
post_install:
- pip install poetry
- poetry config virtualenvs.create false
- poetry install --only docs
- poetry run poetry-dynamic-versioning

sphinx:
configuration: docs/conf.py

python:
install:
- method: pip
path: .
extra_requirements:
- docs
builder: dirhtml
configuration: "docs/conf.py"
fail_on_warning: true
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# <img src="https://i.imgur.com/nPCcxts.png" height=25> MCStatus
# <img src="https://i.imgur.com/nPCcxts.png" style="height: 25px"> MCStatus

[![discord chat](https://img.shields.io/discord/936788458939224094.svg?logo=Discord)](https://discord.gg/C2wX7zduxC)
![supported python versions](https://img.shields.io/pypi/pyversions/mcstatus.svg)
Expand Down
4 changes: 2 additions & 2 deletions Makefile → docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = docs
BUILDDIR = build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
Expand Down
135 changes: 114 additions & 21 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,53 +1,146 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
"""Configuration file for the Sphinx documentation builder.

This file does only contain a selection of the most common options. For a
full list see the documentation:
http://www.sphinx-doc.org/en/master/config
"""

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# 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('.'))

from __future__ import annotations

import os
import sys
from datetime import date

from packaging.version import parse as parse_version

if sys.version_info >= (3, 11):
from tomllib import load as toml_parse
else:
from tomli import load as toml_parse

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


# -- Project information -----------------------------------------------------

project = "mcstatus"
copyright = "2022, Nathan Adams"
author = "Nathan Adams"

def _get_project_meta() -> dict[str, str]:
with open("../pyproject.toml", "rb") as pyproject:
return toml_parse(pyproject)["tool"]["poetry"] # type: ignore[no-any-return]


pkg_meta = _get_project_meta()
project = str(pkg_meta["name"])
copyright = str(date.today().year) + ", py-mine"
author = "py-mine"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to still give attribution to dinnerbone here. I'll look for a way to add py-mine to the list in pyproject.toml and use pkg_meta["authors"] here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't notice that you mentioned Dinnerbone as author before, here it was just generated value.


parsed_version = parse_version(pkg_meta["version"])

# The short X.Y version
version = parsed_version.base_version
# The full version, including alpha/beta/rc tags
release = str(parsed_version)


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

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# extensions coming with Sphinx (named "sphinx.ext.*") or your custom
# ones.
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.doctest",
"sphinx.ext.todo",
"sphinx.ext.coverage",
"sphinx.ext.viewcode",
"sphinx.ext.autosummary",
"sphinx.ext.autosectionlabel",
# Used to reference for third party projects:
"sphinx.ext.intersphinx",
# Used to write beautiful docstrings:
"sphinx.ext.napoleon",
# Used to include .md files:
"m2r2",
# Used to insert typehints into the final docs:
"sphinx_autodoc_typehints",
]

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

autodoc_default_flags = {
"members": "",
"undoc-members": "code,error_template",
"exclude-members": "__dict__,__weakref__",
}

# Set `typing.TYPE_CHECKING` to `True`:
# https://pypi.org/project/sphinx-autodoc-typehints/
set_type_checking_flag = True

# Automatically generate section labels:
autosectionlabel_prefix_document = True

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:

source_suffix = [".rst", ".md"]

# The master toctree document.
master_doc = "index"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = "en"
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = "sphinx"

add_module_names = False

autodoc_default_options = {
"show-inheritance": True,
}

# -- Options for HTML output -------------------------------------------------

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

# 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"]
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
html_theme_options = {
"navigation_with_keys": True,
}

# -- Extension configuration -------------------------------------------------

napoleon_include_private_with_doc = True
napoleon_use_admonition_for_examples = True
napoleon_use_admonition_for_references = True

# Third-party projects documentation references:
intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
}


# -- Options for todo extension ----------------------------------------------

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True
22 changes: 11 additions & 11 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
.. mcstatus documentation master file, created by
sphinx-quickstart on Sun Feb 13 09:51:08 2022.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
.. mdinclude:: ../README.md

Welcome to mcstatus's documentation!
====================================
Content
-------

.. toctree::
:maxdepth: 2
:caption: Contents:
:maxdepth: 1
:caption: Pages

./contributing.rst
./modules.rst
pages/contributing.rst

.. toctree::
:maxdepth: 1
:caption: API Documentation


Indices and tables
==================
------------------

* :ref:`genindex`
* :ref:`modindex`
Expand Down
21 changes: 0 additions & 21 deletions docs/mcstatus.protocol.rst

This file was deleted.

62 changes: 0 additions & 62 deletions docs/mcstatus.rst

This file was deleted.

21 changes: 0 additions & 21 deletions docs/mcstatus.scripts.rst

This file was deleted.

7 changes: 0 additions & 7 deletions docs/modules.rst

This file was deleted.

File renamed without changes.
35 changes: 0 additions & 35 deletions make.bat

This file was deleted.

Loading