From 615a59a5711ca194f6ac7cecb8627f0fe8b79177 Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Thu, 11 Mar 2021 22:06:51 +0200
Subject: [PATCH] Package specifiers.

Allow installing just some of the dependencies. Some filters won't work,
but that's expected. Dcoument the change and keep all dependencies as
required for now to not cause unexpected breakage.
---
 README.rst | 32 +++++++++++++++++++++++++++-----
 setup.py   |  8 +++++++-
 2 files changed, 34 insertions(+), 6 deletions(-)

diff --git a/README.rst b/README.rst
index e7e25a7..5199a20 100644
--- a/README.rst
+++ b/README.rst
@@ -20,6 +20,24 @@ Template
 A CLI tool for generating files from `Jinja2 <http://jinja.pocoo.org/>`_
 templates and environment variables.
 
+
+Installation
+------------
+
+.. code:: shell
+
+    pip install template[all]
+
+
+This will install Template along with the dependencies for all of the filters
+available with it. However, you can use narrower specifiers if you want to avoid
+a specifc dependency (the filters listed below include the needed specifier).
+In previous versions of Template all of the dependencies were required, so to
+avoid breakage this behavior will be be kept. However, this will change in a
+later release so the keep the expected behavior please update your project's
+dependencies.
+
+
 Examples
 --------
 
@@ -52,14 +70,18 @@ Jinja filters
 
 The following Jinja filters were added:
 
-- :code:`to_yaml`: Convert to yaml.
-- :code:`from_yaml`: Convert from yaml.
+- :code:`to_yaml`: Convert to yaml (requires the :code:`yaml` package
+  specifier).
+- :code:`from_yaml`: Convert from yaml (requires the :code:`yaml` package
+  specifier).
 - :code:`to_json`: Convert to json.
 - :code:`from_json`: Convert from json.
-- :code:`to_toml`: Convert to toml.
-- :code:`from_toml`: Convert from toml.
+- :code:`to_toml`: Convert to toml (requires the :code:`toml` package
+  specifier).
+- :code:`from_toml`: Convert from toml (requires the :code:`toml` package
+  specifier).
 - :code:`jmespath`: Queries data using the `JMESPath <http://jmespath.org/>`_
-  query language.
+  query language (requires the :code:`jmespath` package specifier).
 - :code:`run`: Runs a command and returns the stdout, stderr and returncode
   using `run
   <https://docs.python.org/3.6/library/subprocess.html?highlight=popen#subprocess.run>`_.
diff --git a/setup.py b/setup.py
index e6f9ece..db52133 100644
--- a/setup.py
+++ b/setup.py
@@ -36,6 +36,12 @@ setup(
         "toml",
         "subprocess32>=3.5.0;python_version<'3.5'",
     ],
-    extras_require={"dev": ["pipenv"]},
+    extras_require={
+        "all": ["PyYAML", "jmespath", "toml"],
+        "dev": ["pipenv"],
+        "jmespath": ["jmespath"],
+        "toml": ["toml"],
+        "yaml": ["PyYAML"],
+    },
     entry_points={"console_scripts": ["template=template:main"]},
 )
-- 
GitLab