From b4d3eb047ef0772c4105689ffddb4569e05e58a9 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Sun, 26 Sep 2021 20:32:36 +0200 Subject: [PATCH] Add news file to the docs --- docs/basic/pgtypes.rst | 2 ++ docs/conf.py | 4 ++++ docs/index.rst | 1 + docs/lib/ticket_role.py | 50 +++++++++++++++++++++++++++++++++++++++++ docs/news.rst | 23 +++++++++++++++++++ 5 files changed, 80 insertions(+) create mode 100644 docs/lib/ticket_role.py create mode 100644 docs/news.rst diff --git a/docs/basic/pgtypes.rst b/docs/basic/pgtypes.rst index 03c8ae6cc..28372379d 100644 --- a/docs/basic/pgtypes.rst +++ b/docs/basic/pgtypes.rst @@ -219,6 +219,8 @@ Example:: pair: geometry; Data types single: PostGIS; Data types +.. _adapt-shapely: + Geometry adaptation using Shapely --------------------------------- diff --git a/docs/conf.py b/docs/conf.py index 00e9e94fb..112bc17d8 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -41,6 +41,7 @@ extensions = [ "sphinx.ext.intersphinx", "sphinx_autodoc_typehints", "sql_role", + "ticket_role", "pg3_docs", "libpq_docs", ] @@ -103,3 +104,6 @@ autodoc_member_order = "bysource" # PostgreSQL docs version to link libpq functions to libpq_docs_version = "13" + +# Where to point on :ticket: role +ticket_url = "https://github.com/psycopg/psycopg/issues/%s" diff --git a/docs/index.rst b/docs/index.rst index c811a693f..a1e802cf1 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -32,6 +32,7 @@ Documentation basic/index advanced/index api/index + news Indices and tables diff --git a/docs/lib/ticket_role.py b/docs/lib/ticket_role.py new file mode 100644 index 000000000..b5e0a6664 --- /dev/null +++ b/docs/lib/ticket_role.py @@ -0,0 +1,50 @@ +# type: ignore +""" + ticket role + ~~~~~~~~~~~ + + An interpreted text role to link docs to tickets issues. + + :copyright: Copyright 2013-2021 by Daniele Varrazzo. + :copyright: Copyright 2021 The Psycopg Team +""" + +import re +from docutils import nodes, utils +from docutils.parsers.rst import roles + + +def ticket_role(name, rawtext, text, lineno, inliner, options={}, content=[]): + cfg = inliner.document.settings.env.app.config + if cfg.ticket_url is None: + msg = inliner.reporter.warning( + "ticket not configured: please configure ticket_url in conf.py" + ) + prb = inliner.problematic(rawtext, rawtext, msg) + return [prb], [msg] + + rv = [nodes.Text(name + " ")] + tokens = re.findall(r"(#?\d+)|([^\d#]+)", text) + for ticket, noise in tokens: + if ticket: + num = int(ticket.replace("#", "")) + + url = cfg.ticket_url % num + roles.set_classes(options) + node = nodes.reference( + ticket, utils.unescape(ticket), refuri=url, **options + ) + + rv.append(node) + + else: + assert noise + rv.append(nodes.Text(noise)) + + return rv, [] + + +def setup(app): + app.add_config_value("ticket_url", None, "env") + app.add_role("ticket", ticket_role) + app.add_role("tickets", ticket_role) diff --git a/docs/news.rst b/docs/news.rst new file mode 100644 index 000000000..3e1e13622 --- /dev/null +++ b/docs/news.rst @@ -0,0 +1,23 @@ +.. index:: + single: Release notes + single: News + +Release notes +============= + +Current release +--------------- + +psycopg 3.0.b2 +^^^^^^^^^^^^^^ + +- Add :ref:`adapt-shapely` (:ticket:`#80`). +- Add `psycopg.pq.__build_version__` constant. +- Don't use the extended protocol with COPY, (:tickets:`#78, #82`). +- Add *context* parameter to `~psycopg.Connection.connect()` (:ticket:`#83`). + + +psycopg 3.0.b1 +-------------- + +- First public release on PyPI. -- 2.47.3