diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 8cc650709..1cd9077c2 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -68,3 +68,8 @@ repos:
hooks:
- id: check-manifest
stages: [manual]
+
+- repo: https://github.com/codespell-project/codespell
+ rev: v2.1.0
+ hooks:
+ - id: codespell
diff --git a/conda.recipe/README.mkd b/conda.recipe/README.mkd
index def3a461e..3613d5964 100644
--- a/conda.recipe/README.mkd
+++ b/conda.recipe/README.mkd
@@ -5,7 +5,7 @@ Change to the `conda.recipies` directory. Run
```bash
$ conda install conda-build
```
-to aquire the conda build tools. Then you can build with
+to acquire the conda build tools. Then you can build with
```bash
conda build --python 3.5 .
```
diff --git a/docs/cli.rst b/docs/cli.rst
index f8ffff0fc..8b113e4d0 100644
--- a/docs/cli.rst
+++ b/docs/cli.rst
@@ -572,10 +572,10 @@ Another common task of a cli application is provided by a configuration parser,
If no configuration file is present, this will create one and each call to ``.get`` will set the value with the given default.
The file is created when the context manager exits.
If the file is present, it is read and the values from the file are selected, and nothing is changed.
-You can also use ``[]`` syntax to forcably set a value, or to get a value with a standard ``ValueError`` if not present.
+You can also use ``[]`` syntax to forcibly set a value, or to get a value with a standard ``ValueError`` if not present.
If you want to avoid the context manager, you can use ``.read`` and ``.write`` as well.
-The ini parser will default to using the ``[DEFAULT]`` section for values, just like Python's ConfigParser on which it is based. If you want to use a different section, simply seperate section and heading with a ``.`` in the key. ``conf['section.item']`` would place ``item`` under ``[section]``. All items stored in an ``ConfigINI`` are converted to ``str``, and ``str`` is always returned.
+The ini parser will default to using the ``[DEFAULT]`` section for values, just like Python's ConfigParser on which it is based. If you want to use a different section, simply separate section and heading with a ``.`` in the key. ``conf['section.item']`` would place ``item`` under ``[section]``. All items stored in an ``ConfigINI`` are converted to ``str``, and ``str`` is always returned.
Terminal Utilities
------------------
diff --git a/docs/colorlib.rst b/docs/colorlib.rst
index d6138c1fd..eca17da50 100644
--- a/docs/colorlib.rst
+++ b/docs/colorlib.rst
@@ -119,7 +119,7 @@ An example of the usage of unsafe ``colors`` manipulations inside a context mana
colors.green.now()
print('This is green ' + colors.underline + 'and now also underlined!')
print('Underlined' + colors.underline.reset + ' and not underlined but still red')
- print('This is completly restored, even if an exception is thrown!')
+ print('This is completely restored, even if an exception is thrown!')
Output:
@@ -128,7 +128,7 @@ Output:
This is in red
This is in green and now also underlined!
Underlined and not underlined but still green.
- This is completly restored, even if an exception is thrown!
+ This is completely restored, even if an exception is thrown!
We can use ``colors`` instead of ``colors.fg`` for foreground colors. If we had used ``colors.fg``
as the context manager, then non-foreground properties, such as ``colors.underline`` or
diff --git a/docs/colors.rst b/docs/colors.rst
index 9989db973..c7d7240d6 100644
--- a/docs/colors.rst
+++ b/docs/colors.rst
@@ -197,12 +197,12 @@ An example of the usage of unsafe ``colors`` manipulations inside a context mana
This is in red
This is in green and now also underlined!
Underlined and not underlined but still green.
- This is completly restored, even if an exception is thrown!
+ This is completely restored, even if an exception is thrown!
colors.green.now()
print('This is green ' + colors.underline + 'and now also underlined!')
print('Underlined' + colors.underline.reset + ' and not underlined but still red')
- print('This is completly restored, even if an exception is thrown!')
+ print('This is completely restored, even if an exception is thrown!')
Output:
@@ -211,7 +211,7 @@ Output:
This is in red
This is in green and now also underlined!
Underlined and not underlined but still green.
- This is completly restored, even if an exception is thrown!
+ This is completely restored, even if an exception is thrown!
We can use ``colors`` instead of ``colors.fg`` for foreground colors. If we had used ``colors.fg``
as the context manager, then non-foreground properties, such as ``colors.underline`` or
@@ -280,6 +280,7 @@ See Also
========
* `colored `_ Another library with 256 color support
-* `colorful `_ A fairly new libary with a similar feature set
+* `colorful `_ A fairly new library with a similar feature set
* `colorama `_ A library that supports colored text on Windows,
can be combined with Plumbum.colors (if you force ``use_color``, doesn't support all extended colors)
+* `rich `_ A very powerful modern library for all sorts of styling.
diff --git a/docs/local_commands.rst b/docs/local_commands.rst
index d6718399d..24b479b51 100644
--- a/docs/local_commands.rst
+++ b/docs/local_commands.rst
@@ -288,7 +288,7 @@ In fact, you can nest even command-chains (i.e., pipes and redirections), e.g.,
``sudo[ls | grep["\\.py"]]``; however, that would require that the top-level program be able
to handle these shell operators, and this is not the case for ``sudo``. ``sudo`` expects its
argument to be an executable program, and it would complain about ``|`` not being one.
-So, there's a inherent differnce between between ``sudo[ls | grep["\\.py"]]``
+So, there's a inherent difference between between ``sudo[ls | grep["\\.py"]]``
and ``sudo[ls] | grep["\\.py"]`` (where the pipe is unnested) -- the first would fail,
the latter would work as expected.
diff --git a/docs/remote.rst b/docs/remote.rst
index 923633648..9b4dbae2f 100644
--- a/docs/remote.rst
+++ b/docs/remote.rst
@@ -264,4 +264,4 @@ renaming paths, etc. ::
.. note::
See the :ref:`guide-utils` guide for copying, moving and deleting remote paths
-For futher information, see the :ref:`api docs `.
+For further information, see the :ref:`api docs `.
diff --git a/examples/color.py b/examples/color.py
index 703ca017a..520b3a7ca 100755
--- a/examples/color.py
+++ b/examples/color.py
@@ -5,9 +5,9 @@
with colors.fg.red:
print("This is in red")
-print("This is completly restored, even if an exception is thrown!")
+print("This is completely restored, even if an exception is thrown!")
-print("The library will restore color on exiting automatially.")
+print("The library will restore color on exiting automatically.")
print(colors.bold["This is bold and exciting!"])
print(colors.bg.cyan | "This is on a cyan background.")
print(colors.fg[42] | "If your terminal supports 256 colors, this is colorful!")
diff --git a/plumbum/cli/progress.py b/plumbum/cli/progress.py
index 8551a1a58..098da97eb 100644
--- a/plumbum/cli/progress.py
+++ b/plumbum/cli/progress.py
@@ -232,7 +232,7 @@ def done(self):
class ProgressAuto(ProgressBase):
"""Automatically selects the best progress bar (IPython HTML or text). Does not work with qtconsole
(as that is correctly identified as identical to notebook, since the kernel is the same); it will still
- iterate, but no graphical indication will be diplayed.
+ iterate, but no graphical indication will be displayed.
:param iterator: The iterator to wrap with a progress bar
:param length: The length of the iterator (will use ``__len__`` if None)
diff --git a/plumbum/colorlib/styles.py b/plumbum/colorlib/styles.py
index e86ae11b1..9607d59d4 100644
--- a/plumbum/colorlib/styles.py
+++ b/plumbum/colorlib/styles.py
@@ -472,7 +472,7 @@ def __radd__(self, other):
return other + other.__class__(self)
def wrap(self, wrap_this):
- """Wrap a sting in this style and its inverse."""
+ """Wrap a string in this style and its inverse."""
return self + wrap_this + ~self
def __and__(self, other):
@@ -484,7 +484,7 @@ def __and__(self, other):
return self.wrap(other)
def __rand__(self, other):
- """This class supports ``"String:" & color`` syntax, excpet in Python 2.6 due to bug with that Python."""
+ """This class supports ``"String:" & color`` syntax."""
return self.wrap(other)
def __ror__(self, other):
diff --git a/plumbum/commands/modifiers.py b/plumbum/commands/modifiers.py
index 463b52102..6287af201 100644
--- a/plumbum/commands/modifiers.py
+++ b/plumbum/commands/modifiers.py
@@ -247,7 +247,7 @@ class _TF(ExecutionModifier):
This is useful for checking true/false bash commands.
If you wish to expect a different return code (other than the normal success indicate by 0),
- use ``TF(retcode)``. If you want to run the process in the forground, then use
+ use ``TF(retcode)``. If you want to run the process in the foreground, then use
``TF(FG=True)``.
Example::
@@ -297,7 +297,7 @@ class _RETCODE(ExecutionModifier):
This is useful for working with bash commands that have important retcodes but not very
useful output.
- If you want to run the process in the forground, then use ``RETCODE(FG=True)``.
+ If you want to run the process in the foreground, then use ``RETCODE(FG=True)``.
Example::
@@ -343,7 +343,7 @@ class _NOHUP(ExecutionModifier):
sleep[5] & NOHUP # Outputs to nohup.out
sleep[5] & NOHUP(stdout=os.devnull) # No output
- The equivelent bash command would be
+ The equivalent bash command would be
.. code-block:: bash
diff --git a/plumbum/lib.py b/plumbum/lib.py
index 20f128166..e6b60f63c 100644
--- a/plumbum/lib.py
+++ b/plumbum/lib.py
@@ -9,7 +9,7 @@
def _setdoc(super): # @ReservedAssignment
"""This inherits the docs on the current class. Not really needed for Python 3.5,
- due to new behavoir of inspect.getdoc, but still doesn't hurt."""
+ due to new behavior of inspect.getdoc, but still doesn't hurt."""
def deco(func):
func.__doc__ = getattr(getattr(super, func.__name__, None), "__doc__", None)
@@ -75,7 +75,7 @@ def getdoc(object):
def read_fd_decode_safely(fd, size=4096):
"""
- This reads a utf-8 file descriptor and returns a chunck, growing up to
+ This reads a utf-8 file descriptor and returns a chunk, growing up to
three bytes if needed to decode the character at the end.
Returns the data and the decoded text.
diff --git a/plumbum/machines/base.py b/plumbum/machines/base.py
index d1cf9b6f8..e9d9b62b8 100644
--- a/plumbum/machines/base.py
+++ b/plumbum/machines/base.py
@@ -58,7 +58,7 @@ def get(self, cmd, *othercommands):
raise
def __contains__(self, cmd):
- """Tests for the existance of the command, e.g., ``"ls" in plumbum.local``.
+ """Tests for the existence of the command, e.g., ``"ls" in plumbum.local``.
``cmd`` can be anything acceptable by ``__getitem__``.
"""
try:
diff --git a/plumbum/machines/remote.py b/plumbum/machines/remote.py
index d2e4b4fb6..0d3be092b 100644
--- a/plumbum/machines/remote.py
+++ b/plumbum/machines/remote.py
@@ -342,7 +342,7 @@ def _path_listdir(self, fn):
return files
def _path_glob(self, fn, pattern):
- # shquote does not work here due to the way bash loops use space as a seperator
+ # shquote does not work here due to the way bash loops use space as a separator
pattern = pattern.replace(" ", r"\ ")
fn = fn.replace(" ", r"\ ")
matches = self._session.run(fr"for fn in {fn}/{pattern}; do echo $fn; done")[
diff --git a/plumbum/path/base.py b/plumbum/path/base.py
index d9f6ef62c..301e6ccca 100644
--- a/plumbum/path/base.py
+++ b/plumbum/path/base.py
@@ -371,7 +371,7 @@ def split(self, *dummy_args, **dummy_kargs):
@property
def parts(self):
- """Splits the directory into parts, including the base directroy, returns a tuple"""
+ """Splits the directory into parts, including the base directory, returns a tuple"""
return tuple([self.drive + self.root] + self.split())
def relative_to(self, source):
diff --git a/plumbum/typed_env.py b/plumbum/typed_env.py
index 588652e74..3042ee294 100644
--- a/plumbum/typed_env.py
+++ b/plumbum/typed_env.py
@@ -162,7 +162,7 @@ def __dir__(self):
if self._defined_keys:
# return only defined
return sorted(self._defined_keys)
- # return whatever is in the environemnt (for convenience)
+ # return whatever is in the environment (for convenience)
members = set(self._env.keys())
members.update(dir(self.__class__))
return sorted(members)
diff --git a/setup.cfg b/setup.cfg
index 5d94bd766..c6f1770d2 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -86,3 +86,7 @@ exclude_lines =
max-complexity = 50
extend-ignore = E203, E501, E722, B950, E731
select = C,E,F,W,B,B9
+
+[codespell]
+ignore-words-list = ans,switchs,hart,ot,twoo,fo
+skip = *.po
diff --git a/tests/conftest.py b/tests/conftest.py
index 3ae6c9625..cd3a7bc3b 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -72,9 +72,9 @@ def pytest_configure(config):
# register all optional tests declared in ini file as markers
# https://docs.pytest.org/en/latest/writing_plugins.html#registering-custom-markers
ot_ini = config.inicfg.get("optional_tests").strip().splitlines()
- for ot in ot_ini:
+ for ot_ in ot_ini:
# ot should be a line like "optmarker: this is an opt marker", as with markers section
- config.addinivalue_line("markers", ot)
+ config.addinivalue_line("markers", ot_)
ot_markers = {marker_re.match(ln).group(1) for ln in ot_ini}
# collect requested optional tests