Skip to content

Commit

Permalink
Fixed documentation to work with project.toml instead of setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
susuhahnml committed Nov 13, 2024
1 parent 888c874 commit 0c421da
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 26 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,13 @@ Run the following for basic usage information:
```bash
fillname -h
```

For detailed information on the project one can compile and open the
documentation

```bash
nox -s doc -- open
```

Instructions to install and use `nox` can be found in
[DEVELOPMENT.md](./DEVELOPMENT.md)
26 changes: 15 additions & 11 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

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

import configparser
import datetime
import os
import sys
import toml

sys.path.insert(0, os.path.abspath("."))
# modules that autodock should mock
Expand All @@ -18,23 +18,27 @@

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

_config = configparser.RawConfigParser()
_config.read(os.path.join("..", "setup.cfg"))
_meta = dict(_config.items("metadata"))
toml_config = toml.load(os.path.join("..", "pyproject.toml"))
project = toml_config["project"]["name"]
author = ", ".join([a["name"] for a in toml_config["project"]["authors"]])
url = toml_config["project"]["urls"]["Homepage"]
copyright = f'{datetime.datetime.now().date().strftime("%Y")}, {author}'

project = _meta["name"]
copyright = f'{datetime.datetime.now().date().strftime("%Y")}, {_meta["author"]}'
author = _meta["author"]

# The full version, including alpha/beta/rc tags
release = _meta["version"]
if sys.version_info[1] < 8:
import importlib_metadata as metadata
else:
from importlib import metadata

release = metadata.version("fillname")

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

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones. Make sure that custom extensions are listed in the doc field of
# [options.extras_require] in setup.cfg so they are available when building
# [options.extras_require] in project.toml")) so they are available when building
# the documentation.

extensions = [
Expand Down Expand Up @@ -70,7 +74,7 @@
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

html_title = _meta["name"]
html_title = project

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

Expand All @@ -86,7 +90,7 @@
"footer_icons": [
{
"name": "GitHub",
"url": _meta["url"],
"url": url,
"html": """
<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path>
Expand Down
25 changes: 10 additions & 15 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,31 +1,26 @@
[build-system]
requires = [
"setuptools",
"setuptools-scm",
]
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"

[project]
name = "fillname"
authors = [
{ name = "Author Fillname", email = "[email protected]" }
]
authors = [{ name = "Author Fillname", email = "[email protected]" }]
description = "A template project."
requires-python = ">=3.9"
license = {file = "LICENSE"}
dynamic = [ "version" ]
license = { file = "LICENSE" }
dynamic = ["version"]
readme = "README.md"

[project.urls]
Homepage = "https://fillname.org/"

[project.optional-dependencies]
format = [ "black", "isort", "autoflake" ]
lint_pylint = [ "pylint" ]
typecheck = [ "types-setuptools", "mypy" ]
test = [ "coverage[toml]" ]
doc = [ "sphinx", "furo", "nbsphinx", "sphinx_copybutton", "myst-parser" ]
dev = [ "fillname[test,typecheck,lint_pylint]" ]
format = ["black", "isort", "autoflake"]
lint_pylint = ["pylint"]
typecheck = ["types-setuptools", "mypy"]
test = ["coverage[toml]"]
doc = ["sphinx", "furo", "nbsphinx", "sphinx_copybutton", "myst-parser", "importlib_metadata", "toml"]
dev = ["fillname[test,typecheck,lint_pylint]"]

[project.scripts]
fillname = "fillname.__main__:main"
Expand Down

0 comments on commit 0c421da

Please sign in to comment.