From c7589957eb9b24f78066f4ce6bba6e9d36eebbcc Mon Sep 17 00:00:00 2001 From: joncrall Date: Fri, 11 Sep 2020 12:34:04 -0400 Subject: [PATCH] Fixup docs and issue in setup --- docs/source/installing_python.rst | 25 ++++++++++++++++++------- setup.py | 1 - xdoctest/directive.py | 22 +++++++++++----------- 3 files changed, 29 insertions(+), 19 deletions(-) diff --git a/docs/source/installing_python.rst b/docs/source/installing_python.rst index 03bcd877..8502375e 100644 --- a/docs/source/installing_python.rst +++ b/docs/source/installing_python.rst @@ -5,11 +5,14 @@ Before you can use xdoctest, you must have Python installed. Its also best practice to be in a `virtual environment `_. If you are a Python beginner, then I would recommend setting up a `conda `_ environment. -I typically do this on Linux as follows: + + +On Linux, I typically use this end-to-end script for installing conda, +creating, and activating a virtual environment. .. code:: bash - # Download the conda install script + # Download the conda install script into a temporary directory mkdir -p ~/tmp cd ~/tmp CONDA_INSTALL_SCRIPT=Miniconda3-latest-Linux-x86_64.sh @@ -21,9 +24,9 @@ I typically do this on Linux as follows: sh $CONDA_INSTALL_SCRIPT -b -p $_CONDA_ROOT # Activate the basic conda environment source $_CONDA_ROOT/etc/profile.d/conda.sh - # Update the base and create the virtual environment - conda update -y -n base conda - conda create -y -n py38 python=3.8 + # Update the base and create a virtual environment named py38 + conda update --name base conda --yes + conda create --name py38 python=3.8 --yes # Activate your vitualenv # I recommend adding the following steps to your ~/.bashrc @@ -32,8 +35,8 @@ I typically do this on Linux as follows: conda activate py38 Once you have created this conda environment, I recommend adding the following -lines to your ``.bashrc``. - +lines to your ``.bashrc``. This way you will automatically activate your +virtual environment whenever you start a new bash shell. .. code:: bash @@ -45,3 +48,11 @@ lines to your ``.bashrc``. # Always start in a virtual environment conda activate py38 fi + + +For other operating systems, see the official documentation to install conda +`on Windows `_ or +`on MacOS `_. + + +Once conda is installed the commands for `managing conda virtual environments `_ are roughly the same across platforms. diff --git a/setup.py b/setup.py index 93191bbe..9407aad0 100755 --- a/setup.py +++ b/setup.py @@ -204,7 +204,6 @@ def native_mb_python_tag(plat_impl=None, version_info=None): ) -print(parse_requirements('requirements/tests.txt')) if __name__ == '__main__': setupkw.update(dict( description='A rewrite of the builtin doctest module', diff --git a/xdoctest/directive.py b/xdoctest/directive.py index bb809262..ad33b343 100644 --- a/xdoctest/directive.py +++ b/xdoctest/directive.py @@ -20,8 +20,8 @@ Advanced directives may take arguments, be conditional, or modify the runtime state in complex ways. For instance, whereas most directives modify a boolean -value in the runtime state, the advanced `REQUIRES` directive either adds or -removes a value from a `set` of unmet requirements. Doctests will only run if +value in the runtime state, the advanced ``REQUIRES`` directive either adds or +removes a value from a ``set`` of unmet requirements. Doctests will only run if there are no unmet requirements. @@ -30,7 +30,7 @@ Example: - The following example shows how the `+SKIP` directives may be used to + The following example shows how the ``+SKIP`` directives may be used to bypass certain places in the code. >>> # An inline directive appears on the same line as a command and @@ -57,7 +57,7 @@ >>> print('This line will print: (F)') Example: - This next examples illustrates how to use the advanced `+REQURIES()` + This next examples illustrates how to use the advanced ``+REQURIES()`` directive. Note, the REQUIRES and SKIP states are independent. >>> import sys @@ -144,7 +144,7 @@ def named(key, pattern): class RuntimeState(utils.NiceRepr): """ - Maintains the runtime state for a single `run()` of an example + Maintains the runtime state for a single ``run()`` of an example Inline directives are pushed and popped after the line is run. Otherwise directives persist until another directive disables it. @@ -238,7 +238,7 @@ def update(self, directives): Update the runtime state given a set of directives Args: - directives (List[Directive]): list of directives. The `effects` + directives (List[Directive]): list of directives. The ``effects`` method is used to update this object. """ # Clear the previous inline state @@ -297,8 +297,8 @@ def extract(cls, text): Directive: directive: the parsed directives Notes: - The original `doctest` module sometimes yeilded false positives for a - directive pattern. Because `xdoctest` is parsing the text, this issue + The original ``doctest`` module sometimes yeilded false positives for a + directive pattern. Because ``xdoctest`` is parsing the text, this issue does not occur. Example: @@ -523,8 +523,8 @@ def _is_requires_satisfied(arg, argv=None, environ=None): Args: arg (str): condition code - argv (List[str]): cmdline if arg is cmd code usually `sys.argv` - environ (Dict[str, str]): environment variables usually `os.environ` + argv (List[str]): cmdline if arg is cmd code usually ``sys.argv`` + environ (Dict[str, str]): environment variables usually ``os.environ`` Returns: bool: flag - True if the requirement is met @@ -666,7 +666,7 @@ def parse_directive_optstr(optpart, inline=None): Parses the information in the directive from the "optpart" optstrs are: - optionally prefixed with `+` (default) or `-` + optionally prefixed with ``+`` (default) or ``-`` comma separated may contain one paren enclosed argument (experimental) all spaces are ignored