Skip to content

Commit

Permalink
Fix failing docs build (#32)
Browse files Browse the repository at this point in the history
* Use the renamed python-build package

* Set lower bound on sphinx version

* Use clever version-finding code from landlab

* Update changelog

* Remove lint

* Stop black and isort from fighting over conf.py
  • Loading branch information
mdpiper authored Nov 12, 2024
1 parent 290dd82 commit 6a92371
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 16 deletions.
5 changes: 3 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

## 0.3.4 (unreleased)


- Nothing changed yet.
- Fix failing docs build (#32)
- Use Miniforge instead of Mambaforge in CI (#31)
- Make a landing page for the examples (#30)


## 0.3.3 (2024-08-17)
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
sphinx
sphinx >=8
recommonmark
pandoc
45 changes: 35 additions & 10 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,35 +1,60 @@
# Configuration file for the Sphinx documentation builder.
#
""" conf.py
Configuration file for the Sphinx documentation builder.
isort:skip_file
"""

# 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

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

# import sys
# sys.path.insert(0, os.path.abspath('.'))
import datetime

# 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('.'))
import datetime
import os
import pathlib
import re

import packaging


import pkg_resources
def get_version_from_file(path):
with open(path) as fp:
match = re.search(r'__version__\s*=\s*[\'"]([^\'"]+)[\'"]', fp.read())
if match:
version = match.group(1)
else:
raise ValueError(f"version string not found ({path})")
return packaging.version.Version(version)


src_dir = os.path.abspath(
os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, "bmi_geotiff")
)
# sys.path.insert(0, src_dir)
docs_dir = pathlib.Path(__file__).parent
version_file = os.path.join(src_dir, "_version.py")

# The master toctree document.
master_doc = "index"


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

project = "bmi-geotiff"
author = "Community Surface Dynamics Modeling System"
version = pkg_resources.get_distribution("bmi_geotiff").version
release = version
this_year = datetime.date.today().year
copyright = f"{this_year}, {author}"

v = get_version_from_file(version_file)
version = f"{v.major}.{v.minor}"
release = v.public

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

Expand Down
4 changes: 2 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ dependencies:
- pytest-datadir
- coveralls
- bmi-tester
- sphinx
- sphinx >=8
- recommonmark
- pandoc
- notebook
- matplotlib
- cartopy
- build
- python-build
- twine
- zest.releaser
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ dev = [
"nox",
]
build = [
"build",
"python-build",
"twine",
"zest.releaser"
]
Expand Down

0 comments on commit 6a92371

Please sign in to comment.