diff --git a/README.rst b/README.rst index 04df78df18db49c02034c081ac3763fe51a0e1e5..03031e87ac9dc27107549ff74f56ce17d0840ab2 100644 --- a/README.rst +++ b/README.rst @@ -1,11 +1,11 @@ .. image:: https://img.shields.io/badge/docs-latest-orange.svg - :target: https://bobconda.lab.idiap.ch/private/docs/bob/expose/master/index.html -.. image:: https://gitlab.idiap.ch/bob/expose/badges/master/pipeline.svg - :target: https://gitlab.idiap.ch/bob/expose/commits/master -.. image:: https://gitlab.idiap.ch/bob/expose/badges/master/coverage.svg - :target: https://gitlab.idiap.ch/bob/expose/commits/master + :target: https://bobconda.lab.idiap.ch/private/docs/bob/exposed/master/index.html +.. image:: https://gitlab.idiap.ch/bob/exposed/badges/master/pipeline.svg + :target: https://gitlab.idiap.ch/bob/exposed/commits/master +.. image:: https://gitlab.idiap.ch/bob/exposed/badges/master/coverage.svg + :target: https://gitlab.idiap.ch/bob/exposed/commits/master .. image:: https://img.shields.io/badge/gitlab-project-0000c0.svg - :target: https://gitlab.idiap.ch/bob/expose + :target: https://gitlab.idiap.ch/bob/exposed ==================================================== @@ -25,7 +25,7 @@ Installation Complete Bob's `installation`_ instructions. Then, to install this package, run:: - $ conda install expose + $ conda install exposed Contact diff --git a/conda/meta.yaml b/conda/meta.yaml index 24672d8c869408cb24b38d212b95b0b4e28978dd..7e73fee0e82e713c00de312cabee17b1c733df56 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -1,4 +1,4 @@ -{% set name = 'expose' %} +{% set name = 'exposed' %} {% set project_dir = environ.get('RECIPE_DIR') + '/..' %} package: diff --git a/doc/api.rst b/doc/api.rst index aa1514d0573a1509f8ea1b680d7f02231d10db5f..b2a0d4980928fadd8ed0b79af73e2c27e7274d93 100644 --- a/doc/api.rst +++ b/doc/api.rst @@ -4,16 +4,16 @@ Python API =========== -This section includes information for using the Python API of ``expose``. +This section includes information for using the Python API of ``exposed``. .. autosummary:: :toctree: api - expose.rc - expose.config - expose.logging - expose.click + exposed.rc + exposed.config + exposed.logging + exposed.click .. include:: links.rst diff --git a/doc/click.rst b/doc/click.rst index 913d057abc8d8e9f6cac8bf89923f4bba4e3dc3b..935a980d4b666b6bcb0545cc425434f2e9c516ba 100644 --- a/doc/click.rst +++ b/doc/click.rst @@ -1,6 +1,6 @@ .. vim: set fileencoding=utf-8 : -.. _expose.click: +.. _exposed.click: ====================== Command-Line Helpers @@ -10,25 +10,25 @@ This package provides a few handy additions to the :py:mod:`click` command-line interface (CLI) library, allowing one to build even more powerful CLIs. -.. _expose.click.verbosity: +.. _exposed.click.verbosity: Verbosity Option ---------------- -The :py:func:`expose.click.verbosity_option` :py:mod:`click` decorator allows +The :py:func:`exposed.click.verbosity_option` :py:mod:`click` decorator allows one to control the logging-level of a pre-defined :py:class:logging.Logger. Here is an example usage. .. code-block:: python - import expose.click + import exposed.click import logging # retrieve the base-package logger logger = logging.getLogger(__name__.split(".", 1)[0]) - @expose.click.verbosity_option(logger) + @exposed.click.verbosity_option(logger) def cli(verbose): pass @@ -45,29 +45,29 @@ with the appropriate logging level, mapped as such: ``logger.setLevel(logging.DEBUG)`` -.. _expose.click.configcommand: +.. _exposed.click.configcommand: Config Command -------------- -The :py:class:`expose.click.ConfigCommand` is a type of +The :py:class:`exposed.click.ConfigCommand` is a type of :py:class:`click.Command` in which declared CLI options may be either passed -via the command-line, or loaded from a :ref:`expose.config`. It works by +via the command-line, or loaded from a :ref:`exposed.config`. It works by reading the Python configuration file and filling up option values pretty much as :py:mod:`click` would do, with one exception: CLI options can now be of any Pythonic type. -To implement this, a CLI implemented via :py:class:`expose.click.ConfigCommand` +To implement this, a CLI implemented via :py:class:`exposed.click.ConfigCommand` may not declare any arguments, only options. All arguments are interpreted as configuration files, from where option values will be set, in order. Any type of configuration resource can be provided (file paths, python modules or entry-points). Command-line options take precedence over values set in configuration files. The order of configuration files matters, and the final values for CLI options follow the same rules as in -:ref:`expose.config.chain-loading`. +:ref:`exposed.config.chain-loading`. Options that may be read from configuration files must also be marked with the -custom click-type :py:class:`expose.click.ResourceOption`. +custom click-type :py:class:`exposed.click.ResourceOption`. Here is an example usage of this class: @@ -116,13 +116,13 @@ Then, the application shown above would also be able to work like this: python example_cli.py my-config -Options with type :py:class:`expose.click.ResourceOption` may also point to +Options with type :py:class:`exposed.click.ResourceOption` may also point to individual resources (specific variables on python modules). This may be, however, a more seldomly used feature. Read the class documentation for details. -.. _expose.click.aliasedgroups: +.. _exposed.click.aliasedgroups: Aliased Command Groups ---------------------- @@ -131,7 +131,7 @@ When designing an CLI with multiple subcommands, it is sometimes useful to be able to shorten command names. For example, being able to use ``git ci`` instead of ``git commit``, is a form of aliasing. To do so in :py:mod:`click` CLIs, it suffices to subclass all command group instances with -:py:class:`expose.click.AliasedGroup`. This should include groups and +:py:class:`exposed.click.AliasedGroup`. This should include groups and subgroups of any depth in your CLI. Here is an example usage: @@ -144,13 +144,13 @@ You may then shorten the command to be called such as this: .. command-output:: python example_alias.py pu -.. _expose.click.config_helpers: +.. _exposed.click.config_helpers: Experiment Options (Config) Command-Group ----------------------------------------- When building complex CLIs in which support for `configuration -<:ref:expose.config>`_ is required, it may be convenient to provide users with +<:ref:exposed.config>`_ is required, it may be convenient to provide users with CLI subcommands to display configuration resources (examples) shipped with the package. To this end, we provide an easy to plug :py:class:`click.Group` decorator that attaches a few useful subcommands to a predefined CLI command, @@ -172,7 +172,7 @@ You may try to use that example application like this: .. code-block:: shell # lists all installed resources in the entry-point-group - # "expose.test.config" + # "exposed.test.config" $ python doc/example_config.py list module: tests.data complex @@ -211,13 +211,13 @@ You may try to use that example application like this: d=[1, 2, 37], ) -.. _expose.click.rc_helpers: +.. _exposed.click.rc_helpers: Global Configuration (RC) Command-Group --------------------------------------- When building complex CLIs in which support for `global configuration -<:ref:expose.rc>`_ is required, it may be convenient to provide users with CLI +<:ref:exposed.rc>`_ is required, it may be convenient to provide users with CLI subcommands to display current values, set or get the value of specific configuration variables. For example, the ``git`` CLI provides the ``git config`` command that fulfills this task. Here is an example on how to build a @@ -253,7 +253,7 @@ You may try to use that example application like this: $ -.. _expose.click.entrypoins: +.. _exposed.click.entrypoins: Multi-package Command Groups ---------------------------- diff --git a/doc/conf.py b/doc/conf.py index 6881fb5d88e39d7bce50998f6903e83f92b49013..b91d3b8bf19d405d6e959831458e1f5804962e0e 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -73,7 +73,7 @@ source_suffix = ".rst" master_doc = "index" # General information about the project. -project = "expose" +project = "exposed" package = distribution(project) copyright = "%s, Idiap Research Institute" % time.strftime("%Y") diff --git a/doc/config.rst b/doc/config.rst index 9186a51b95cde0736e775c465c467985ccf784c1..38fd0e5ebb0cb32c357ed609351b4771fa94c0fe 100644 --- a/doc/config.rst +++ b/doc/config.rst @@ -1,6 +1,6 @@ .. vim: set fileencoding=utf-8 : -.. _expose.config: +.. _exposed.config: ==================================== Experimental Configuration Options @@ -27,21 +27,21 @@ Loading configuration options ----------------------------- There is only one single function that matters in this module: -:py:func:`expose.config.load`. You should use it to load Python configuration +:py:func:`exposed.config.load`. You should use it to load Python configuration options: To load a configuration file, containing options into a dictionary mapping variable names to values (of any Python type), use -:py:func:`expose.config.load`: +:py:func:`exposed.config.load`: .. doctest:: >>> import os.path - >>> from expose.config import load + >>> from exposed.config import load >>> options = load([os.path.join(data, "basic_config.py")]) -If the function :py:func:`expose.config.load` succeeds, it returns a +If the function :py:func:`exposed.config.load` succeeds, it returns a python module containing variables which represent the configuration resource. For example, if the file ``basic_config.py`` contained: @@ -60,14 +60,14 @@ Then, the object ``options`` would look like this: b = 3 -.. _expose.config.chain-loading: +.. _exposed.config.chain-loading: Chain Loading ------------- It is possible to implement chain configuration loading and overriding by passing iterables with more than one filename to -:py:func:`expose.config.load`. Suppose we have two configuration files +:py:func:`exposed.config.load`. Suppose we have two configuration files which must be loaded in sequence: .. literalinclude:: data/basic_config.py @@ -86,7 +86,7 @@ Then, one can chain-load them like this: .. doctest:: >>> import os.path - >>> from expose.config import load + >>> from exposed.config import load >>> file1 = os.path.join(data, "basic_config.py") >>> file2 = os.path.join(data, "second_config.py") >>> configuration = load([file1, file2]) @@ -100,15 +100,15 @@ The user wanting to override the values needs to manage the overriding and the order in which the override happens. -.. _expose.config.entry_points: +.. _exposed.config.entry_points: Entry Points and Python Modules ------------------------------- -The function :py:func:`expose.config.load` can also load config files through +The function :py:func:`exposed.config.load` can also load config files through module entry-points, or Python module names. Entry-points are simply aliases to Python modules and objects. To load entry-points via -:py:func:`expose.config.load`, you must provide the group name of the entry +:py:func:`exposed.config.load`, you must provide the group name of the entry points. For example, if in your package setup, you defined the following entry-points to 2 python modules such as the examples above: @@ -126,7 +126,7 @@ You could do the same as such: .. code-block:: python - >>> from expose.config import load + >>> from exposed.config import load >>> configuration = load(["basic", "second"], entry_point_group="mypackage.config") >>> print(f"a = {configuration.a} \nb = {configuration.b} \nc = {configuration.c}") a = 1 @@ -137,7 +137,7 @@ Or even refer to the module names themselves (instead of the entry-point names): .. code-block:: python - >>> from expose.config import load + >>> from exposed.config import load >>> configuration = load(["mypackage.config.basic", "mypackage.config.second"]) >>> print(f"a = {configuration.a} \nb = {configuration.b} \nc = {configuration.c}") a = 1 @@ -155,19 +155,19 @@ Of course, mixture of entry-point names, paths and module names are also accepta c = 4 -.. _expose.config.resource: +.. _exposed.config.resource: Loading Single Objects ---------------------- -The function :py:func:`expose.config.load` can also be used to load the +The function :py:func:`exposed.config.load` can also be used to load the contents of specific variables within configuration files. To do this, you need provide the name of an attribute to load. .. doctest:: >>> import os.path - >>> from expose.config import load + >>> from exposed.config import load >>> load([os.path.join(data, "basic_config.py")], attribute_name="b") 3 diff --git a/doc/example_alias.py b/doc/example_alias.py index 4c780608bc2140e82c614866d6521de6f5e2955b..997719df57bd35bd1868f3a741babd3cb4d40729 100644 --- a/doc/example_alias.py +++ b/doc/example_alias.py @@ -7,10 +7,10 @@ import click -import expose.click +import exposed.click -@click.group(cls=expose.click.AliasedGroup) +@click.group(cls=exposed.click.AliasedGroup) def main(): pass diff --git a/doc/example_cli.py b/doc/example_cli.py index 2f40daeb622f8ab2ba26e0ac55ec96aba8d1f723..55c80952b4d88b06a744d35679deaec13b3d604b 100644 --- a/doc/example_cli.py +++ b/doc/example_cli.py @@ -7,8 +7,8 @@ import click -from expose.click import ConfigCommand, ResourceOption, verbosity_option -from expose.logging import setup +from exposed.click import ConfigCommand, ResourceOption, verbosity_option +from exposed.logging import setup logger = setup(__name__.split(".", 1)[0]) @@ -37,7 +37,7 @@ Examples: cls=ResourceOption, ) @verbosity_option(logger=logger) -@click.version_option(package_name="expose") +@click.version_option(package_name="exposed") @click.pass_context def main(ctx, **_): """Tests our Click interfaces""" diff --git a/doc/example_config.py b/doc/example_config.py index f45ee332e30d14aa46537c06fe79494cb07687af..32c47368bd4b369eee15e2bca98a55c11db639c5 100644 --- a/doc/example_config.py +++ b/doc/example_config.py @@ -1,10 +1,10 @@ -from expose.click import config_group -from expose.logging import setup +from exposed.click import config_group +from exposed.logging import setup logger = setup(__name__.split(".", 1)[0]) -@config_group(logger=logger, entry_point_group="expose.test.config") +@config_group(logger=logger, entry_point_group="exposed.test.config") def main(**kwargs): """Use this command to list/describe/copy package config resources""" pass diff --git a/doc/example_defaults.py b/doc/example_defaults.py index f67b0c703de7f20323204ff69bf2cc28e138f434..904f06b022950afccd6bb312ec57f83ed5085d17 100644 --- a/doc/example_defaults.py +++ b/doc/example_defaults.py @@ -1,6 +1,6 @@ -from expose.click import user_defaults_group -from expose.logging import setup -from expose.rc import UserDefaults +from exposed.click import user_defaults_group +from exposed.logging import setup +from exposed.rc import UserDefaults logger = setup(__name__.split(".", 1)[0]) rc = UserDefaults("myapp.toml", logger=logger) diff --git a/doc/example_logging.py b/doc/example_logging.py index c03d97a109767afe06a117330cb22428be94d996..7ec571a6b04cd8b442e468ce63befb7c4d8588f9 100644 --- a/doc/example_logging.py +++ b/doc/example_logging.py @@ -1,6 +1,6 @@ import logging -from expose.logging import setup +from exposed.logging import setup logger = setup(__name__.split(".", 1)[0], format="%(levelname)s: %(message)s") logger.setLevel(logging.INFO) diff --git a/doc/index.rst b/doc/index.rst index 9ce4ec0c8a4c6b60306beb5923a17ab4feea5c62..9d165936fd873b4c5a9e1de3a85ec06a4e828e49 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -1,6 +1,6 @@ .. vim: set fileencoding=utf-8 : -.. _expose: +.. _exposed: ==================================================== Configuration Support for Python Packages and CLIs diff --git a/doc/logging.rst b/doc/logging.rst index 1c06ab5ca4aaf95e80c317b882fdb298ee3d8932..b2300cd94b33c2530ed4a1d507565237fca35c37 100644 --- a/doc/logging.rst +++ b/doc/logging.rst @@ -1,6 +1,6 @@ .. vim: set fileencoding=utf-8 : -.. _expose.logging: +.. _exposed.logging: ============================ Logging Helpers and Policy @@ -8,17 +8,17 @@ We advise the use of the Python :py:mod:`logging` module to log messages from your library. If you are unfamiliar with the design and use of that standard -Python module, we suggest you read our :ref:`expose.logging.rationale`. +Python module, we suggest you read our :ref:`exposed.logging.rationale`. We provide a single a method in this library to help setup a particular :py:class:`logging.Logger` to output to a (text-based) stream. The -documentation of :py:func:`expose.logging.setup` explains in details what it +documentation of :py:func:`exposed.logging.setup` explains in details what it does. To use it in an application, follow this pattern: .. code-block:: python import logging - from expose.logging import setup + from exposed.logging import setup logger = setup("mypackage", format="%(levelname)s: %(message)s") logger.setLevel(logging.INFO) # set log-level as you wish logger.info("test message") # use at application level, normally @@ -26,11 +26,11 @@ does. To use it in an application, follow this pattern: To help with setting the base logger level via the CLI, we provide a -:py:mod:`click` :ref:`expose.click.verbosity`. A full example can be seen at -:ref:`expose.click.configcommand` and :ref:`expose.click.rc_helpers`. +:py:mod:`click` :ref:`exposed.click.verbosity`. A full example can be seen at +:ref:`exposed.click.configcommand` and :ref:`exposed.click.rc_helpers`. -.. _expose.logging.rationale: +.. _exposed.logging.rationale: Logging Setup Rationale ----------------------- diff --git a/doc/rc.rst b/doc/rc.rst index b9f373f56fa5a225555cd4cd0d7ad2aa70680e52..eea7105891034be6fa370948ebd9d699cd1875de 100644 --- a/doc/rc.rst +++ b/doc/rc.rst @@ -1,4 +1,4 @@ -.. _expose.rc: +.. _exposed.rc: ============================== Global Configuration Options @@ -10,7 +10,7 @@ are local to a system or machine can be, for example, access credentials to a database, or the root location of files used in a Machine Learning (ML) pipeline. Typically, in these cases, developers want to allow users to configure such values once and have a programmatic way to access such values at -run time. Module :py:mod:`expose.rc` provides code to facilitate the +run time. Module :py:mod:`exposed.rc` provides code to facilitate the implementation and setup of this functionality. @@ -18,12 +18,12 @@ Storage ------- Global configuration options are stored in TOML_ format, in a file whose -location is specified by you. The class :py:class:`expose.rc.UserDefaults` can +location is specified by you. The class :py:class:`exposed.rc.UserDefaults` can load such a file and provide access to values set therein: .. code-block:: python - >>> from expose import rc + >>> from exposed import rc >>> defaults = rc.UserDefaults("~/.myapprc.toml") The ``defaults`` object in this example is a subtype of :py:class:`dict`, with @@ -39,7 +39,7 @@ value stored on that variable instead of the default. For example: >>> import os >>> os.environ["MYAPPRC"] = "~/.myapprc2.toml" - >>> from expose import rc + >>> from exposed import rc >>> defaults = rc.UserDefaults("~/.myapprc.toml", "MYAPPRC") Because the environment variable is set to a non-empty value, then the @@ -52,7 +52,7 @@ Reading and writing values -------------------------- You may use dictionary methods to get and set variables on any -:py:class:`expose.rc.UserDefaults`, besides all other methods related to +:py:class:`exposed.rc.UserDefaults`, besides all other methods related to mapping types (such as ``len()`` or ``setdefault()``). @@ -60,7 +60,7 @@ Writing changes back -------------------- To write changes back to the configuration file, use the -:py:meth:`expose.rc.UserDefaults.write` method, which requires no parameters, +:py:meth:`exposed.rc.UserDefaults.write` method, which requires no parameters, writing directly to the "default" location set during construction: .. code-block:: python @@ -80,7 +80,7 @@ Adding a global RC functionality to your module To add a global object that reads user defaults into your application, we recommend you create a module containing a configured instance of -:py:class:`expose.rc.UserDefaults`. Then, within your command-line interface, +:py:class:`exposed.rc.UserDefaults`. Then, within your command-line interface, import that module to trigger reading out the necessary variables. For example: @@ -88,7 +88,7 @@ example: .. code-block:: python # module "config" - from expose.rc import UserDefaults + from exposed.rc import UserDefaults rc = UserDefaults("~/.myapprc.toml", "MYAPPRC") # module "cli" @@ -100,7 +100,7 @@ Defining a command-line interface to the RC functionality --------------------------------------------------------- We provide command plugins for you to define CLI-based get/set operations on -your configuration file. This is discussed at :ref:`expose.click`. +your configuration file. This is discussed at :ref:`exposed.click`. .. include:: links.rst diff --git a/expose/__init__.py b/exposed/__init__.py similarity index 100% rename from expose/__init__.py rename to exposed/__init__.py diff --git a/expose/click.py b/exposed/click.py similarity index 100% rename from expose/click.py rename to exposed/click.py diff --git a/expose/config.py b/exposed/config.py similarity index 100% rename from expose/config.py rename to exposed/config.py diff --git a/expose/logging.py b/exposed/logging.py similarity index 100% rename from expose/logging.py rename to exposed/logging.py diff --git a/expose/rc.py b/exposed/rc.py similarity index 100% rename from expose/rc.py rename to exposed/rc.py diff --git a/pyproject.toml b/pyproject.toml index d4097ba2a0b62ebfb1f6f1ab24a51c2105962412..ac72dee0b7e13496927ac4ff4d340c12cbabaac3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,5 +28,5 @@ envlist = py38,py39,py310 deps = pytest-cov commands = - pytest --verbose --cov expose --cov-report term-missing --cov-report html:html/coverage --cov-report xml:coverage.xml --junitxml=junit-coverage.xml tests/ + pytest --verbose --cov exposed --cov-report term-missing --cov-report html:html/coverage --cov-report xml:coverage.xml --junitxml=junit-coverage.xml tests/ """ diff --git a/setup.py b/setup.py index 10aab685475e5ff9a96cfb46d5da426d3e38057e..368d14392be91ea6cb0f9fe5111dd44127026923 100644 --- a/setup.py +++ b/setup.py @@ -1,10 +1,10 @@ from setuptools import find_packages, setup setup( - name="expose", + name="exposed", version=open("version.txt").read().rstrip(), description="Configuration Support for Python Packages and CLIs", - url="http://gitlab.idiap.ch/bob/expose", + url="http://gitlab.idiap.ch/bob/exposed", license="BSD", author="Andre Anjos", author_email="andre.anjos@idiap.ch", @@ -15,7 +15,7 @@ setup( install_requires=["click >= 8", "tomli", "tomli-w"], entry_points={ # these are just test entry-points (not distributed) - "expose.test.config": [ + "exposed.test.config": [ "first = tests.data.basic_config", "first-a = tests.data.basic_config:a", "first-b = tests.data.basic_config:b", diff --git a/tests/data/test_dump_config2.py b/tests/data/test_dump_config2.py index 16bc14e5be0d2970df043ad830b772f5e8b1e1f5..a0ed88231e41d00501e3b8f30383481482f620de 100644 --- a/tests/data/test_dump_config2.py +++ b/tests/data/test_dump_config2.py @@ -14,12 +14,12 @@ Blablabla bli blo # database = None """Required parameter: database (--database, -d) -bla bla bla Can be a `expose.test.config' entry point, a module name, or a path to a Python file which contains a variable named `database'. +bla bla bla Can be a `exposed.test.config' entry point, a module name, or a path to a Python file which contains a variable named `database'. Registered entries are: ['complex', 'complex-var', 'error-config', 'first', 'first-a', 'first-b', 'second', 'second-b', 'second-c', 'verbose-config']""" # annotator = None """Required parameter: annotator (--annotator, -a) -bli bli bli Can be a `expose.test.config' entry point, a module name, or a path to a Python file which contains a variable named `annotator'. +bli bli bli Can be a `exposed.test.config' entry point, a module name, or a path to a Python file which contains a variable named `annotator'. Registered entries are: ['complex', 'complex-var', 'error-config', 'first', 'first-a', 'first-b', 'second', 'second-b', 'second-c', 'verbose-config']""" # output_dir = None diff --git a/tests/test_click.py b/tests/test_click.py index 82a5be20d4bf7cf7eb7ed7e11c726fafc203a78e..e43d219f02e2565364a8ed425951420574ee1f88 100644 --- a/tests/test_click.py +++ b/tests/test_click.py @@ -5,7 +5,7 @@ import click from click.testing import CliRunner -from expose.click import ( +from exposed.click import ( AliasedGroup, ConfigCommand, ResourceOption, @@ -44,7 +44,7 @@ def test_prefix_aliasing(): def test_commands_with_config_1(): # random test - @click.command(cls=ConfigCommand, entry_point_group="expose.test.config") + @click.command(cls=ConfigCommand, entry_point_group="exposed.test.config") def cli(**_): pass @@ -56,7 +56,7 @@ def test_commands_with_config_1(): def test_commands_with_config_2(): # test option with valid default value - @click.command(cls=ConfigCommand, entry_point_group="expose.test.config") + @click.command(cls=ConfigCommand, entry_point_group="exposed.test.config") @click.option("-a", type=click.INT, cls=ResourceOption) def cli(a, **_): assert type(a) == int, (type(a), a) @@ -84,7 +84,7 @@ def test_commands_with_config_2(): def test_commands_with_config_3(): # test required options - @click.command(cls=ConfigCommand, entry_point_group="expose.test.config") + @click.command(cls=ConfigCommand, entry_point_group="exposed.test.config") @click.option("-a", cls=ResourceOption, required=True) def cli(a, **_): click.echo("{}".format(a)) @@ -166,13 +166,13 @@ def test_config_dump(tmp_path, datadir): def test_config_dump2(tmp_path, datadir): - @click.command(cls=ConfigCommand, entry_point_group="expose.test.config") + @click.command(cls=ConfigCommand, entry_point_group="exposed.test.config") @click.option( "--database", "-d", required=True, cls=ResourceOption, - entry_point_group="expose.test.config", + entry_point_group="exposed.test.config", help="bla bla bla", ) @click.option( @@ -180,7 +180,7 @@ def test_config_dump2(tmp_path, datadir): "-a", required=True, cls=ResourceOption, - entry_point_group="expose.test.config", + entry_point_group="exposed.test.config", help="bli bli bli", ) @click.option( @@ -233,7 +233,7 @@ def test_config_dump2(tmp_path, datadir): def test_config_command_with_callback_options(): - @click.command(cls=ConfigCommand, entry_point_group="expose.test.config") + @click.command(cls=ConfigCommand, entry_point_group="exposed.test.config") @verbosity_option( logging.getLogger(__name__), envvar="VERBOSE", cls=ResourceOption ) @@ -260,7 +260,7 @@ def test_resource_option(): # test usage without ConfigCommand and with entry_point_group @click.command() @click.option( - "-a", "--a", cls=ResourceOption, entry_point_group="expose.test.config" + "-a", "--a", cls=ResourceOption, entry_point_group="exposed.test.config" ) def cli1(a): assert a == 1 @@ -289,7 +289,7 @@ def test_resource_option(): "--a", cls=ResourceOption, string_exceptions=("tests.data.basic_config"), - entry_point_group="expose.test.config", + entry_point_group="exposed.test.config", ) def cli3(a): assert a == "tests.data.basic_config" diff --git a/tests/test_config.py b/tests/test_config.py index 98f604a57931ab9aa5e0f5c8f2097321cca39286..f66368336b3945f7e2680c4f55662f5d90c22a21 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -5,9 +5,9 @@ import pytest from click.testing import CliRunner -from expose.click import config_group -from expose.config import load, mod_to_context -from expose.logging import setup as logger_setup +from exposed.click import config_group +from exposed.config import load, mod_to_context +from exposed.logging import setup as logger_setup def test_basic(datadir): @@ -61,7 +61,7 @@ def test_config_with_module(): def test_config_with_entry_point(): c = load( - ["first", "second", "complex"], entry_point_group="expose.test.config" + ["first", "second", "complex"], entry_point_group="exposed.test.config" ) assert hasattr(c, "a") and c.a == 1 assert hasattr(c, "b") and c.b == 6 @@ -71,14 +71,14 @@ def test_config_with_entry_point(): def test_config_with_entry_point_file_missing(): with pytest.raises(ValueError): - load(["error-config"], entry_point_group="expose.test.config") + load(["error-config"], entry_point_group="exposed.test.config") def test_config_with_mixture(datadir): c = load( [datadir / "basic_config.py", "tests.data.second_config", "complex"], - entry_point_group="expose.test.config", + entry_point_group="exposed.test.config", ) assert hasattr(c, "a") and c.a == 1 assert hasattr(c, "b") and c.b == 6 @@ -114,7 +114,7 @@ def cli_messages(): high_level_stream=messages, ) - @config_group(logger=logger, entry_point_group="expose.test.config") + @config_group(logger=logger, entry_point_group="exposed.test.config") def cli(**_): """This is the documentation provided by the user""" pass diff --git a/tests/test_logging.py b/tests/test_logging.py index 0b509d9e39d436189c9e7314a214975d1d3c1c92..0211532b680559301feaf7a340224dab0a5ad285 100644 --- a/tests/test_logging.py +++ b/tests/test_logging.py @@ -5,9 +5,9 @@ import click from click.testing import CliRunner -import expose.logging +import exposed.logging -from expose.click import verbosity_option +from exposed.click import verbosity_option def test_logger_setup(): @@ -15,7 +15,7 @@ def test_logger_setup(): lo = io.StringIO() hi = io.StringIO() - logger = expose.logging.setup( + logger = exposed.logging.setup( "awesome.logger", format="%(message)s", low_level_stream=lo, @@ -38,7 +38,7 @@ def test_logger_click_no_v(): lo = io.StringIO() hi = io.StringIO() - logger = expose.logging.setup( + logger = exposed.logging.setup( "awesome.logger", format="%(message)s", low_level_stream=lo, @@ -67,7 +67,7 @@ def test_logger_click_v(): lo = io.StringIO() hi = io.StringIO() - logger = expose.logging.setup( + logger = exposed.logging.setup( "awesome.logger", format="%(message)s", low_level_stream=lo, @@ -95,7 +95,7 @@ def test_logger_click_vv(): lo = io.StringIO() hi = io.StringIO() - logger = expose.logging.setup( + logger = exposed.logging.setup( "awesome.logger", format="%(message)s", low_level_stream=lo, @@ -123,7 +123,7 @@ def test_logger_click_vvv(): lo = io.StringIO() hi = io.StringIO() - logger = expose.logging.setup( + logger = exposed.logging.setup( "awesome.logger", format="%(message)s", low_level_stream=lo, @@ -151,7 +151,7 @@ def test_logger_click_3x_verbose(): lo = io.StringIO() hi = io.StringIO() - logger = expose.logging.setup( + logger = exposed.logging.setup( "awesome.logger", format="%(message)s", low_level_stream=lo, @@ -179,7 +179,7 @@ def test_logger_click_3x_verb(): lo = io.StringIO() hi = io.StringIO() - logger = expose.logging.setup( + logger = exposed.logging.setup( "awesome.logger", format="%(message)s", low_level_stream=lo, diff --git a/tests/test_rc.py b/tests/test_rc.py index 1f51863d81a4492fbf209f30c6d3708ce036b334..03f7889fb34d73ed5714a0e2c0c0ee3b78d0c01e 100644 --- a/tests/test_rc.py +++ b/tests/test_rc.py @@ -7,8 +7,8 @@ import pytest from click.testing import CliRunner -from expose.click import user_defaults_group -from expose.rc import UserDefaults +from exposed.click import user_defaults_group +from exposed.rc import UserDefaults def _check_userdefaults_ex1_contents(rc):