Repository: redis/redis-py

Issue:
Fix anchor links in README
### Pull Request check-list

_Please make sure to review and check all of these items:_

- [x] Does `$ tox` pass with this change (including linting)?
- [x] Do the CI tests pass with this change (enable it first in your forked repo and wait for the github action build to finish)?
- [x] Is the new or changed code fully tested?
- [x] Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?

_NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open._

### Description of change

The anchor links in the README don't seem to work. Removing one `#` should fix it.



Discussion:

Resolving patch:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -29,7 +29,8 @@
 extensions = [
     "sphinx.ext.autodoc",
     "sphinx.ext.doctest",
-    "sphinx.ext.viewcode"
+    "sphinx.ext.viewcode",
+    "sphinx.ext.autosectionlabel",
 ]
 
 # Add any paths that contain templates here, relative to this directory.
@@ -53,10 +54,11 @@
 # built documents.
 #
 # The short X.Y version.
-version = "4.0"
+import redis
+version = '.'.join(redis.__version__.split(".")[0:2])
 
 # The full version, including alpha/beta/rc tags.
-release = "4.0.0"
+release = redis.__version__
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
@@ -93,17 +95,27 @@
 # A list of ignored prefixes for module index sorting.
 # modindex_common_prefix = []
 
+nitpicky = True
+
 
 # -- Options for HTML output --------------------------------------------------
 
 # The theme to use for HTML and HTML Help pages.  See the documentation for
 # a list of builtin themes.
-html_theme = "default"
+html_theme = "sphinx_rtd_theme"
 
 # Theme options are theme-specific and customize the look and feel of a theme
 # further.  For a list of options available for each theme, see the
 # documentation.
-# html_theme_options = {}
+html_theme_options = {
+    'display_version': True,
+    'prev_next_buttons_location': 'bottom',
+    'style_external_links': False,
+    # Toc options
+    'collapse_navigation': True,
+    'sticky_navigation': True,
+    'navigation_depth': 4,
+}
 
 # Add any paths that contain custom themes here, relative to this directory.
 # html_theme_path = []
diff --git a/redis/commands/timeseries/commands.py b/redis/commands/timeseries/commands.py
--- a/redis/commands/timeseries/commands.py
+++ b/redis/commands/timeseries/commands.py
@@ -27,7 +27,7 @@ def create(self, key, **kwargs):
         """
         Create a new time-series.
         For more information see
-        `TS.CREATE <https://oss.redis.com/redistimeseries/master/commands/#tscreate>`_.  # noqa
+        `TS.CREATE <https://oss.redis.com/redistimeseries/master/commands/#tscreate>`_.
 
         Args:
 
@@ -60,7 +60,7 @@ def create(self, key, **kwargs):
             - 'min': only override if the value is lower than the existing value.
             - 'max': only override if the value is higher than the existing value.
             When this is not set, the server-wide default will be used.
-        """
+        """  # noqa
         retention_msecs = kwargs.get("retention_msecs", None)
         uncompressed = kwargs.get("uncompressed", False)
         labels = kwargs.get("labels", {})
@@ -79,10 +79,10 @@ def alter(self, key, **kwargs):
         """
         Update the retention, labels of an existing key.
         For more information see
-        `TS.ALTER <https://oss.redis.com/redistimeseries/master/commands/#tsalter>`_.  # noqa
+        `TS.ALTER <https://oss.redis.com/redistimeseries/master/commands/#tsalter>`_.
 
         The parameters are the same as TS.CREATE.
-        """
+        """  # noqa
         retention_msecs = kwargs.get("retention_msecs", None)
         labels = kwargs.get("labels", {})
         duplicate_policy = kwargs.get("duplicate_policy", None)
@@ -97,7 +97,7 @@ def add(self, key, timestamp, value, **kwargs):
         """
         Append (or create and append) a new sample to the series.
         For more information see
-        `TS.ADD <https://oss.redis.com/redistimeseries/master/commands/#tsadd>`_. # noqa
+        `TS.ADD <https://oss.redis.com/redistimeseries/master/commands/#tsadd>`_.
 
         Args:
 
@@ -129,7 +129,7 @@ def add(self, key, timestamp, value, **kwargs):
             - 'min': only override if the value is lower than the existing value.
             - 'max': only override if the value is higher than the existing value.
             When this is not set, the server-wide default will be used.
-        """
+        """  # noqa
         retention_msecs = kwargs.get("retention_msecs", None)
         uncompressed = kwargs.get("uncompressed", False)
         labels = kwargs.get("labels", {})
@@ -151,8 +151,8 @@ def madd(self, ktv_tuples):
         Expects a list of `tuples` as (`key`,`timestamp`, `value`).
         Return value is an array with timestamps of insertions.
         For more information see
-        `TS.MADD <https://oss.redis.com/redistimeseries/master/commands/#tsmadd>`_. # noqa
-        """
+        `TS.MADD <https://oss.redis.com/redistimeseries/master/commands/#tsmadd>`_.
+        """  # noqa
         params = []
         for ktv in ktv_tuples:
             for item in ktv:
@@ -167,7 +167,7 @@ def incrby(self, key, value, **kwargs):
         This command can be used as a counter or gauge that automatically gets
         history as a time series.
         For more information see
-        `TS.INCRBY <https://oss.redis.com/redistimeseries/master/commands/#tsincrbytsdecrby>`_. # noqa
+        `TS.INCRBY <https://oss.redis.com/redistimeseries/master/commands/#tsincrbytsdecrby>`_.
 
         Args:
 
@@ -189,7 +189,7 @@ def incrby(self, key, value, **kwargs):
         chunk_size:
             Each time-series uses chunks of memory of fixed size for time series samples.
             You can alter the default TSDB chunk size by passing the chunk_size argument (in Bytes).
-        """
+        """  # noqa
         timestamp = kwargs.get("timestamp", None)
         retention_msecs = kwargs.get("retention_msecs", None)
         uncompressed = kwargs.get("uncompressed", False)
@@ -211,7 +211,7 @@ def decrby(self, key, value, **kwargs):
         This command can be used as a counter or gauge that
         automatically gets history as a time series.
         For more information see
-        `TS.DECRBY <https://oss.redis.com/redistimeseries/master/commands/#tsincrbytsdecrby>`_. # noqa
+        `TS.DECRBY <https://oss.redis.com/redistimeseries/master/commands/#tsincrbytsdecrby>`_.
 
         Args:
 
@@ -237,7 +237,7 @@ def decrby(self, key, value, **kwargs):
         chunk_size:
             Each time-series uses chunks of memory of fixed size for time series samples.
             You can alter the default TSDB chunk size by passing the chunk_size argument (in Bytes).
-        """
+        """  # noqa
         timestamp = kwargs.get("timestamp", None)
         retention_msecs = kwargs.get("retention_msecs", None)
         uncompressed = kwargs.get("uncompressed", False)
@@ -260,7 +260,7 @@ def delete(self, key, from_time, to_time):
         and end data points will also be deleted.
         Return the count for deleted items.
         For more information see
-        `TS.DEL <https://oss.redis.com/redistimeseries/master/commands/#tsdel>`_. # noqa
+        `TS.DEL <https://oss.redis.com/redistimeseries/master/commands/#tsdel>`_.
 
         Args:
 
@@ -270,7 +270,7 @@ def delete(self, key, from_time, to_time):
             Start timestamp for the range deletion.
         to_time:
             End timestamp for the range deletion.
-        """
+        """  # noqa
         return self.execute_command(DEL_CMD, key, from_time, to_time)
 
     def createrule(
@@ -286,8 +286,8 @@ def createrule(
         [`avg`, `sum`, `min`, `max`, `range`, `count`, `first`, `last`,
         `std.p`, `std.s`, `var.p`, `var.s`]
         For more information see
-        `TS.CREATERULE <https://oss.redis.com/redistimeseries/master/commands/#tscreaterule>`_. # noqa
-        """
+        `TS.CREATERULE <https://oss.redis.com/redistimeseries/master/commands/#tscreaterule>`_.
+        """  # noqa
         params = [source_key, dest_key]
         self._appendAggregation(params, aggregation_type, bucket_size_msec)
 
@@ -297,8 +297,8 @@ def deleterule(self, source_key, dest_key):
         """
         Delete a compaction rule.
         For more information see
-        `TS.DELETERULE <https://oss.redis.com/redistimeseries/master/commands/#tsdeleterule>`_. # noqa
-        """
+        `TS.DELETERULE <https://oss.redis.com/redistimeseries/master/commands/#tsdeleterule>`_.
+        """  # noqa
         return self.execute_command(DELETERULE_CMD, source_key, dest_key)
 
     def __range_params(
@@ -344,7 +344,7 @@ def range(
         """
         Query a range in forward direction for a specific time-serie.
         For more information see
-        `TS.RANGE <https://oss.redis.com/redistimeseries/master/commands/#tsrangetsrevrange>`_. # noqa
+        `TS.RANGE <https://oss.redis.com/redistimeseries/master/commands/#tsrangetsrevrange>`_.
 
         Args:
 
@@ -374,7 +374,7 @@ def range(
             by_min_value).
         align:
             Timestamp for alignment control for aggregation.
-        """
+        """  # noqa
         params = self.__range_params(
             key,
             from_time,
@@ -405,7 +405,7 @@ def revrange(
         """
         Query a range in reverse direction for a specific time-series.
         For more information see
-        `TS.REVRANGE <https://oss.redis.com/redistimeseries/master/commands/#tsrangetsrevrange>`_.  # noqa
+        `TS.REVRANGE <https://oss.redis.com/redistimeseries/master/commands/#tsrangetsrevrange>`_.
 
         **Note**: This command is only available since RedisTimeSeries >= v1.4
 
@@ -432,7 +432,7 @@ def revrange(
             Filter result by maximum value (must mention also filter_by_min_value).
         align:
             Timestamp for alignment control for aggregation.
-        """
+        """  # noqa
         params = self.__range_params(
             key,
             from_time,
@@ -501,7 +501,7 @@ def mrange(
         """
         Query a range across multiple time-series by filters in forward direction.
         For more information see
-        `TS.MRANGE <https://oss.redis.com/redistimeseries/master/commands/#tsmrangetsmrevrange>`_.  # noqa
+        `TS.MRANGE <https://oss.redis.com/redistimeseries/master/commands/#tsmrangetsmrevrange>`_.
 
         Args:
 
@@ -544,7 +544,7 @@ def mrange(
             pair labels of a series.
         align:
             Timestamp for alignment control for aggregation.
-        """
+        """  # noqa
         params = self.__mrange_params(
             aggregation_type,
             bucket_size_msec,
@@ -584,7 +584,7 @@ def mrevrange(
         """
         Query a range across multiple time-series by filters in reverse direction.
         For more information see
-        `TS.MREVRANGE <https://oss.redis.com/redistimeseries/master/commands/#tsmrangetsmrevrange>`_. # noqa
+        `TS.MREVRANGE <https://oss.redis.com/redistimeseries/master/commands/#tsmrangetsmrevrange>`_.
 
         Args:
 
@@ -629,7 +629,7 @@ def mrevrange(
             labels of a series.
         align:
             Timestamp for alignment control for aggregation.
-        """
+        """  # noqa
         params = self.__mrange_params(
             aggregation_type,
             bucket_size_msec,
@@ -653,14 +653,14 @@ def get(self, key):
         """ # noqa
         Get the last sample of `key`.
         For more information see `TS.GET <https://oss.redis.com/redistimeseries/master/commands/#tsget>`_.
-        """
+        """  # noqa
         return self.execute_command(GET_CMD, key)
 
     def mget(self, filters, with_labels=False):
         """ # noqa
         Get the last samples matching the specific `filter`.
         For more information see `TS.MGET <https://oss.redis.com/redistimeseries/master/commands/#tsmget>`_.
-        """
+        """  # noqa
         params = []
         self._appendWithLabels(params, with_labels)
         params.extend(["FILTER"])
@@ -671,14 +671,14 @@ def info(self, key):
         """  # noqa
         Get information of `key`.
         For more information see `TS.INFO <https://oss.redis.com/redistimeseries/master/commands/#tsinfo>`_.
-        """
+        """  # noqa
         return self.execute_command(INFO_CMD, key)
 
     def queryindex(self, filters):
         """  # noqa
         Get all the keys matching the `filter` list.
         For more information see `TS.QUERYINDEX <https://oss.redis.com/redistimeseries/master/commands/#tsqueryindex>`_.
-        """
+        """  # noqa
         return self.execute_command(QUERYINDEX_CMD, *filters)
 
     @staticmethod
diff --git a/tasks.py b/tasks.py
--- a/tasks.py
+++ b/tasks.py
@@ -20,6 +20,12 @@ def devenv(c):
     run(cmd)
 
 
+@task
+def build_docs(c):
+    """Generates the sphinx documentation."""
+    run("tox -e docs")
+
+
 @task
 def linters(c):
     """Run code linters"""


Test patch: