Skip to content

Commit

Permalink
Merge branch 'master' into better_app_name_in_help
Browse files Browse the repository at this point in the history
  • Loading branch information
henryiii authored Oct 5, 2022
2 parents 98b58e2 + da87b67 commit d23987e
Show file tree
Hide file tree
Showing 71 changed files with 1,340 additions and 1,077 deletions.
2 changes: 0 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ updates:
directory: "/"
schedule:
interval: "daily"
ignore:
- dependency-name: "actions/*"
32 changes: 32 additions & 0 deletions .github/matchers/pylint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"problemMatcher": [
{
"severity": "warning",
"pattern": [
{
"regexp": "^([^:]+):(\\d+):(\\d+): ([A-DF-Z]\\d+): \\033\\[[\\d;]+m([^\\033]+).*$",
"file": 1,
"line": 2,
"column": 3,
"code": 4,
"message": 5
}
],
"owner": "pylint-warning"
},
{
"severity": "error",
"pattern": [
{
"regexp": "^([^:]+):(\\d+):(\\d+): (E\\d+): \\033\\[[\\d;]+m([^\\033]+).*$",
"file": 1,
"line": 2,
"column": 3,
"code": 4,
"message": 5
}
],
"owner": "pylint-error"
}
]
}
36 changes: 25 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,17 @@ jobs:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/[email protected]
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- uses: pre-commit/[email protected]
- name: pylint
run: |
echo "::add-matcher::$GITHUB_WORKSPACE/.github/matchers/pylint.json"
pipx run nox -s pylint
tests:
name: Tests on 🐍 ${{ matrix.python-version }} ${{ matrix.os }}
Expand All @@ -42,14 +50,16 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- uses: actions/cache@v2
- uses: actions/cache@v3
if: runner.os == 'Linux' && startsWith(matrix.python-version, 'pypy')
with:
path: ~/.cache/pip
Expand Down Expand Up @@ -91,10 +101,12 @@ jobs:
name: Dist
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Build SDist and wheel
run: pipx run build
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
path: dist/*

Expand All @@ -105,12 +117,12 @@ jobs:
if: github.event_name == 'release' && github.event.action == 'published'

steps:
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist

- uses: pypa/gh-action-pypi-publish@v1.4.2
- uses: pypa/gh-action-pypi-publish@v1.5.1
with:
user: __token__
password: ${{ secrets.pypi_password }}
Expand All @@ -119,7 +131,9 @@ jobs:
needs: [tests]
runs-on: ubuntu-20.04
steps:
- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install coveralls
run: pip install coveralls
- name: Coveralls Finished
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ tests/.cache/*
*.pot
/*venv*
*.mypy_cache
.eggs
/plumbum/version.py
/tests/nohup.out
35 changes: 24 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ci:
repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.3.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand All @@ -20,7 +20,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/psf/black
rev: "21.12b0"
rev: "22.8.0"
hooks:
- id: black

Expand All @@ -30,46 +30,59 @@ repos:
- id: isort

- repo: https://github.com/asottile/pyupgrade
rev: "v2.29.1"
rev: "v2.38.2"
hooks:
- id: pyupgrade
args: ["--py36-plus"]

- repo: https://github.com/asottile/setup-cfg-fmt
rev: "v1.20.0"
rev: "v2.0.0"
hooks:
- id: setup-cfg-fmt
args: [--include-version-classifiers, --max-py-version=3.11]

- repo: https://github.com/hadialqattan/pycln
rev: v1.1.0
rev: v2.1.1
hooks:
- id: pycln
args: [--config=pyproject.toml]
args: [--all]
stages: [manual]

- repo: https://github.com/pycqa/flake8
rev: "4.0.1"
rev: "5.0.4"
hooks:
- id: flake8
exclude: docs/conf.py
additional_dependencies: [flake8-bugbear, flake8-print, flake8-2020]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v0.930"
rev: "v0.981"
hooks:
- id: mypy
files: plumbum
args: [--show-error-codes]
args: []
additional_dependencies: [typed-ast, types-paramiko, types-setuptools]

# This wants the .mo files removed
- repo: https://github.com/mgedmin/check-manifest
rev: "0.47"
rev: "0.48"
hooks:
- id: check-manifest
stages: [manual]

- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
rev: v2.2.1
hooks:
- id: codespell

- repo: https://github.com/pre-commit/pygrep-hooks
rev: "v1.9.0"
hooks:
- id: python-check-blanket-noqa
- id: python-check-blanket-type-ignore
- id: python-no-log-warn
- id: python-no-eval
- id: python-use-type-annotations
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal
17 changes: 14 additions & 3 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
1.8.0
-----

* Drop Python 2.7 and 3.5 support (`#573 <https://github.com/tomerfiliba/plumbum/pull/573>`_)
* Lots of extended checks and fixes for problems exposed.
* Color: support ``NO_COLOR``/``FORCE_COLOR`` (`#575 <https://github.com/tomerfiliba/plumbum/pull/575>`_)
* Commands: New ``iter_lines`` ``buffer_size`` parameter (`#582 <https://github.com/tomerfiliba/plumbum/pull/582>`_)
* Commands: cache remote commands (`#583 <https://github.com/tomerfiliba/plumbum/pull/583>`_)
* Exceptions: fix for exception pickling (`#586 <https://github.com/tomerfiliba/plumbum/pull/586>`_)


1.7.2
-----

Expand Down Expand Up @@ -50,7 +61,7 @@
* Paths: support composing paths using subscription operations (`#455 <https://github.com/tomerfiliba/plumbum/pull/455>`_)
* CLI: Improved 'Set' validator to allow non-string types, and CSV params (`#452 <https://github.com/tomerfiliba/plumbum/pull/452>`_)
* TypedEnv: Facility for modeling environment-variables into python data types (`#451 <https://github.com/tomerfiliba/plumbum/pull/451>`_)
* Commands: execute local/remote commands via a magic `.cmd` attribute (`#450 <https://github.com/tomerfiliba/plumbum/pull/450>`_)
* Commands: execute local/remote commands via a magic ``.cmd`` attribute (`#450 <https://github.com/tomerfiliba/plumbum/pull/450>`_)

1.6.7
-----
Expand Down Expand Up @@ -130,7 +141,7 @@
* Bugfix: Getting an executable no longer returns a directory (`#234 <https://ithub.com/tomerfiliba/plumbum/issues/234>`_)
* Bugfix: Iterdir now works on Python <3.5
* Testing is now expanded and fully written in Pytest, with coverage reporting.
* Added support for Conda ( as of 1.6.2, use the `-c conda-forge` channel)
* Added support for Conda ( as of 1.6.2, use the ``-c conda-forge`` channel)

1.6.0
-----
Expand All @@ -156,7 +167,7 @@
* CLI: add ``--help-all`` and various cosmetic fixes: (`#125 <https://github.com/tomerfiliba/plumbum/pull/125>`_),
(`#126 <https://github.com/tomerfiliba/plumbum/pull/126>`_), (`#127 <https://github.com/tomerfiliba/plumbum/pull/127>`_)
* CLI: add ``root_app`` property (`#141 <https://github.com/tomerfiliba/plumbum/pull/141>`_)
* Machines: ``getattr`` now raises ``AttributeError`` instead of `CommandNotFound` (`#135 <https://github.com/tomerfiliba/plumbum/pull/135>`_)
* Machines: ``getattr`` now raises ``AttributeError`` instead of ``CommandNotFound`` (`#135 <https://github.com/tomerfiliba/plumbum/pull/135>`_)
* Paramiko: ``keep_alive`` support (`#186 <https://github.com/tomerfiliba/plumbum/pull/186>`_)
* Paramiko: does not support piping explicitly now (`#160 <https://github.com/tomerfiliba/plumbum/pull/160>`_)
* Parmaiko: Added pure SFTP backend, gives STFP v4+ support (`#188 <https://github.com/tomerfiliba/plumbum/pull/188>`_)
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Redirection
>>> from plumbum.cmd import cat, head
>>> ((cat < "setup.py") | head["-n", 4])()
'#!/usr/bin/env python\nimport os\n\ntry:\n'
'#!/usr/bin/env python3\nimport os\n\ntry:\n'
>>> (ls["-a"] > "file.list")()
''
>>> (cat["file.list"] | wc["-l"])()
Expand Down Expand Up @@ -174,7 +174,7 @@ Sample output

::

$ python simple_cli.py -v -I foo/bar -Ispam/eggs x.cpp y.cpp z.cpp
$ python3 simple_cli.py -v -I foo/bar -Ispam/eggs x.cpp y.cpp z.cpp
Verbose: True
Include dirs: ['foo/bar', 'spam/eggs']
Compiling: ('x.cpp', 'y.cpp', 'z.cpp')
Expand Down
30 changes: 15 additions & 15 deletions docs/_cheatsheet.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ Basics
>>> ls
LocalCommand(<LocalPath /bin/ls>)
>>> ls()
u'build.py\ndist\ndocs\nLICENSE\nplumbum\nREADME.rst\nsetup.py\ntests\ntodo.txt\n'
'build.py\ndist\ndocs\nLICENSE\nplumbum\nREADME.rst\nsetup.py\ntests\ntodo.txt\n'
>>> notepad = local["c:\\windows\\notepad.exe"]
>>> notepad() # Notepad window pops up
u'' # Notepad window is closed by user, command returns
'' # Notepad window is closed by user, command returns
Instead of writing ``xxx = local["xxx"]`` for every program you wish to use, you can
also :ref:`import commands <import-hack>`:
Expand All @@ -28,7 +28,7 @@ Or, use the ``local.cmd`` syntactic-sugar:
>>> local.cmd.ls
LocalCommand(<LocalPath /bin/ls>)
>>> local.cmd.ls()
u'build.py\ndist\ndocs\nLICENSE\nplumbum\nREADME.rst\nsetup.py\ntests\ntodo.txt\n'
'build.py\ndist\ndocs\nLICENSE\nplumbum\nREADME.rst\nsetup.py\ntests\ntodo.txt\n'
See :ref:`guide-local-commands`.

Expand All @@ -38,10 +38,10 @@ Piping
.. code-block:: python
>>> chain = ls["-a"] | grep["-v", "\\.py"] | wc["-l"]
>>> print chain
>>> print(chain)
/bin/ls -a | /bin/grep -v '\.py' | /usr/bin/wc -l
>>> chain()
u'13\n'
'13\n'
See :ref:`guide-local-commands-pipelining`.

Expand All @@ -51,11 +51,11 @@ Redirection
.. code-block:: python
>>> ((cat < "setup.py") | head["-n", 4])()
u'#!/usr/bin/env python\nimport os\n\ntry:\n'
'#!/usr/bin/env python3\nimport os\n\ntry:\n'
>>> (ls["-a"] > "file.list")()
u''
''
>>> (cat["file.list"] | wc["-l"])()
u'17\n'
'17\n'
See :ref:`guide-local-commands-redir`.

Expand All @@ -69,7 +69,7 @@ Working-directory manipulation
>>> with local.cwd(local.cwd / "docs"):
... chain()
...
u'15\n'
'15\n'
A more explicit, and thread-safe way of running a command in a differet directory is using the ``.with_cwd()`` method:

Expand Down Expand Up @@ -103,7 +103,7 @@ Command nesting
.. code-block:: python
>>> from plumbum.cmd import sudo
>>> print sudo[ifconfig["-a"]]
>>> print(sudo[ifconfig["-a"]])
/usr/bin/sudo /sbin/ifconfig -a
>>> (sudo[ifconfig["-a"]] | grep["-i", "loop"]) & FG
lo Link encap:Local Loopback
Expand All @@ -127,7 +127,7 @@ and `Paramiko <https://github.com/paramiko/paramiko/>`_ (a pure-Python implement
>>> with remote.cwd("/lib"):
... (r_ls | grep["0.so.0"])()
...
u'libusb-1.0.so.0\nlibusb-1.0.so.0.0.0\n'
'libusb-1.0.so.0\nlibusb-1.0.so.0.0.0\n'
See :ref:`guide-remote`.

Expand All @@ -150,9 +150,9 @@ CLI applications
logging.root.setLevel(level)
def main(self, *srcfiles):
print "Verbose:", self.verbose
print "Include dirs:", self.include_dirs
print "Compiling:", srcfiles
print("Verbose:", self.verbose)
print("Include dirs:", self.include_dirs)
print("Compiling:", srcfiles)
if __name__ == "__main__":
MyCompiler.run()
Expand All @@ -162,7 +162,7 @@ Sample output

::

$ python simple_cli.py -v -I foo/bar -Ispam/eggs x.cpp y.cpp z.cpp
$ python3 simple_cli.py -v -I foo/bar -Ispam/eggs x.cpp y.cpp z.cpp
Verbose: True
Include dirs: ['foo/bar', 'spam/eggs']
Compiling: ('x.cpp', 'y.cpp', 'z.cpp')
Expand Down
Loading

0 comments on commit d23987e

Please sign in to comment.