Skip to content

Commit 60fdb14

Browse files
authored
Merge pull request #103 from epics-containers/fix-docs
Fix edit button in docs
2 parents 3f147bf + 11be575 commit 60fdb14

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

docs/conf.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,29 @@
55
# https://www.sphinx-doc.org/en/master/usage/configuration.html
66

77
import sys
8+
from importlib import metadata
9+
from pathlib import Path
10+
from subprocess import check_output
811

912
import requests
1013

1114
# -- General configuration ------------------------------------------------
1215

13-
# TODO do we want to set this from code?
14-
version = "1.0"
15-
1616
# General information about the project.
1717
project = "epics-containers"
1818

19+
# The full version, including alpha/beta/rc tags.
20+
release = metadata.version(project)
21+
22+
# The short X.Y version.
23+
if "+" in release:
24+
# Not on a tag, use branch name
25+
root = Path(__file__).absolute().parent.parent
26+
git_branch = check_output("git branch --show-current".split(), cwd=root)
27+
version = git_branch.decode().strip()
28+
else:
29+
version = release
30+
1931
extensions = [
2032
# Use this for generating API docs
2133
"sphinx.ext.autodoc",
@@ -108,7 +120,7 @@
108120
html_theme = "pydata_sphinx_theme"
109121
github_repo = "epics-containers.github.io"
110122
github_user = "epics-containers"
111-
switcher_json = f"https://{github_user}.github.io/{github_repo}/switcher.json"
123+
switcher_json = f"https://{github_user}.github.io/switcher.json"
112124
switcher_exists = requests.get(switcher_json).ok
113125
if not switcher_exists:
114126
print(
@@ -153,7 +165,7 @@
153165
# A dictionary of values to pass into the template engine’s context for all pages
154166
html_context = {
155167
"github_user": github_user,
156-
"github_repo": project,
168+
"github_repo": github_repo,
157169
"github_version": version,
158170
"doc_path": "docs",
159171
}

pyproject.toml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
[build-system]
2-
requires = ["setuptools>=64", "setuptools_scm[toml]>=6.2", "wheel"]
2+
requires = ["setuptools>=64", "setuptools_scm[toml]>=6.2"]
33
build-backend = "setuptools.build_meta"
44

5+
# This is a minimal toml file to allow us to do pip install
56
[project]
67
name = "epics_containers"
78
dynamic = ["version"]
8-
readme = "README.md"
9-
10-
# This is a minimal toml file to allow us to do pip install
11-
dependencies = ["copier"]
129

13-
[tool.setuptools]
14-
include-package-data = false
10+
[tool.setuptools_scm]
1511

1612
[project.optional-dependencies]
1713
dev = [

0 commit comments

Comments
 (0)