]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Add news file to the docs
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sun, 26 Sep 2021 18:32:36 +0000 (20:32 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sun, 26 Sep 2021 18:32:36 +0000 (20:32 +0200)
docs/basic/pgtypes.rst
docs/conf.py
docs/index.rst
docs/lib/ticket_role.py [new file with mode: 0644]
docs/news.rst [new file with mode: 0644]

index 03c8ae6cc1317cf6a30dc62eaa17100b5392cbae..28372379dab795e4730a9030e2a5d4a0586477ac 100644 (file)
@@ -219,6 +219,8 @@ Example::
     pair: geometry; Data types
     single: PostGIS; Data types
 
+.. _adapt-shapely:
+
 Geometry adaptation using Shapely
 ---------------------------------
 
index 00e9e94fbd34ceb0346ddfcc84a5d1833eb6c0c9..112bc17d8d71ede896a6054df1b73b06dc33f5ab 100644 (file)
@@ -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"
index c811a693ff1ee8cc0731e65adddf11155d5af30e..a1e802cf1c9ff9b6c2baff57380d1f4bdc736255 100644 (file)
@@ -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 (file)
index 0000000..b5e0a66
--- /dev/null
@@ -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 (file)
index 0000000..3e1e136
--- /dev/null
@@ -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.