Skip to content

Commit

Permalink
Fixup docs and issue in setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Erotemic committed Sep 11, 2020
1 parent 9e0bfb4 commit c758995
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 19 deletions.
25 changes: 18 additions & 7 deletions docs/source/installing_python.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ Before you can use xdoctest, you must have Python installed. Its also best
practice to be in a `virtual environment <https://realpython.com/effective-python-environment/>`_.
If you are a Python beginner, then I would recommend setting up a
`conda <https://docs.conda.io/en/latest/>`_ 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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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 <https://docs.conda.io/projects/conda/en/latest/user-guide/install/windows.html>`_ or
`on MacOS <https://docs.conda.io/projects/conda/en/latest/user-guide/install/macos.html>`_.


Once conda is installed the commands for `managing conda virtual environments <https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#>`_ are roughly the same across platforms.
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
22 changes: 11 additions & 11 deletions xdoctest/directive.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c758995

Please sign in to comment.