Skip to content

Commit

Permalink
Release pydoctor 24.11.0 (#840)
Browse files Browse the repository at this point in the history
* Bump to version 24.11.0

* Bump version of the common.html page. The readthedocs version changed but not the base one. This is an unfortunate necessary change, without that pydoctor would be able to generate bogus pages with readthedocs theme customization without even triggering a warning. But for the classic theme users, this will unnecessarily trigger a warning if one has customized common.html. Sorry for the desagreement.

* Use the toml package only if python_version < "3.11".

* Since we've dropped support for Python 3.7, we don't need the importlib_metadata dependency.
  • Loading branch information
tristanlatr authored Dec 2, 2024
1 parent 26cbc91 commit 1ef003b
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 18 deletions.
11 changes: 1 addition & 10 deletions pydoctor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,8 @@
Warning: PyDoctor's API isn't stable YET, custom builds are prone to break!
"""

from typing import TYPE_CHECKING

# On Python 3.8+, use importlib.metadata from the standard library.
# On older versions, a compatibility package can be installed from PyPI.
try:
import importlib.metadata as importlib_metadata
except ImportError:
if not TYPE_CHECKING:
import importlib_metadata

import importlib.metadata as importlib_metadata

__version__ = importlib_metadata.version('pydoctor')

Expand Down
15 changes: 13 additions & 2 deletions pydoctor/_configparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import argparse
from collections import OrderedDict
import re
import sys
from typing import Any, Callable, Dict, List, Optional, Tuple, TextIO, Union
import csv
import functools
Expand All @@ -33,7 +34,17 @@
import warnings

from configargparse import ConfigFileParserException, ConfigFileParser, ArgumentParser
import toml

if sys.version_info >= (3, 11):
from tomllib import load as _toml_load
import io
# The tomllib module from the standard library
# expect a binary IO and will fail if receives otherwise.
# So we hack a compat function that will work with TextIO and assume the utf-8 encoding.
def toml_load(stream: TextIO) -> Any:
return _toml_load(io.BytesIO(stream.read().encode()))
else:
from toml import load as toml_load

# I did not invented these regex, just put together some stuff from:
# - https://stackoverflow.com/questions/11859442/how-to-match-string-in-quotes-using-regex
Expand Down Expand Up @@ -163,7 +174,7 @@ def parse(self, stream:TextIO) -> Dict[str, Any]:
"""Parses the keys and values from a TOML config file."""
# parse with configparser to allow multi-line values
try:
config = toml.load(stream)
config = toml_load(stream)
except Exception as e:
raise ConfigFileParserException("Couldn't parse TOML file: %s" % e)

Expand Down
2 changes: 1 addition & 1 deletion pydoctor/themes/base/common.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!DOCTYPE html>
<html xmlns:t="http://twistedmatrix.com/ns/twisted.web.template/0.1">
<meta name="pydoctor-template-version" content="2" />
<meta name="pydoctor-template-version" content="3" />

<t:transparent t:render="head">Head</t:transparent>

Expand Down
2 changes: 1 addition & 1 deletion pydoctor/themes/readthedocs/common.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!DOCTYPE html>
<html xmlns:t="http://twistedmatrix.com/ns/twisted.web.template/0.1">
<meta name="pydoctor-template-version" content="2" />
<meta name="pydoctor-template-version" content="3" />

<t:transparent t:render="head">Head</t:transparent>

Expand Down
8 changes: 4 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = pydoctor
version = 24.3.3.dev0
version = 24.11.0.dev.0
author = Michael Hudson-Doyle
author_email = [email protected]
maintainer = Maarten ter Huurne
Expand Down Expand Up @@ -41,13 +41,13 @@ install_requires =
Twisted
urllib3>=2.0
requests
astor; python_version < "3.9"
attrs
docutils>=0.17
lunr>=0.6.2,<0.8.0
configargparse
toml
importlib_metadata; python_version < "3.8"

toml; python_version < "3.11"
astor; python_version < "3.9"
importlib_resources; python_version < "3.9"

[options.extras_require]
Expand Down

0 comments on commit 1ef003b

Please sign in to comment.