Skip to content

Commit

Permalink
Minor things
Browse files Browse the repository at this point in the history
  • Loading branch information
Konstantinos Bairaktaris committed Feb 13, 2021
1 parent 3154294 commit 554ec16
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install .
python -m pip install -e .
python -m pip install -r test_requirements.txt
python -m pip install flake8
python -m pip install isort
Expand Down
6 changes: 1 addition & 5 deletions Makefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def debugtest():
def checks():
from pipepy import flake8, isort
flake8()
isort()
isort('.')()


def clean():
Expand All @@ -50,7 +50,3 @@ def build(clean):

def publish(build):
python('-m', "twine").upload("dist/*")()


def hello(msg="world"):
print(f"Hello {msg}")
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ A Python library for invoking and interacting with shell commands.
* [3. Reading data from and writing data to a command](#3-reading-data-from-and-writing-data-to-a-command)
* [Binary mode](#binary-mode)
* [Streaming to console](#streaming-to-console)
* [Exceptions](#exceptions)
* [Utils](#utils)
* ["Interactive" mode](#interactive-mode)
* [`pymake`](#pymake)
* [pymake](#pymake)
* [pymake variables](#pymake-variables)
* [TODOs](#todos)

<!-- Added by: kbairak, at: Wed Feb 10 12:13:31 PM EET 2021 -->
<!-- Added by: kbairak, at: Fri Feb 12 09:28:03 AM EET 2021 -->

<!--te-->

Expand Down Expand Up @@ -403,12 +405,7 @@ from pipepy import ping

def mean_ping(stdout):
pings = []
lines = iter(stdout)
while True:
try:
line = next(lines)
except StopIteration:
break
for line in stdout:
match = re.search(r'time=([\d\.]+) ms$', line.strip())
if not match:
continue
Expand Down Expand Up @@ -957,6 +954,7 @@ ways:

## TODOs

- [ ] Long pipe chains (eg `my_stdin() | grep('-E', r'\b17$') | greedy_print`)
- [ ] Ability to source bash files
- [x] Pass arguments to `pymake` (see what other tricks `make` does for
inspiration)
Expand Down
1 change: 1 addition & 0 deletions check_tag.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sys

import pkg_resources

from pipepy import git
Expand Down
1 change: 0 additions & 1 deletion src/pipepy/pipepy.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ def __init__(self, *args, _lazy=False, _stdin=None, _stream_stdout=None,
self._text = _text
self._encoding = _encoding
self._raises_exception = _raises_exception
self._stdin_close_pending = False

self._process = None # To be used with background processes
self._context = None # To be used with `with` statements
Expand Down
2 changes: 1 addition & 1 deletion src/pipepy/pymake.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys
import importlib.util
import inspect
import sys

Makefile = None
already_run = {}
Expand Down
3 changes: 3 additions & 0 deletions src/tests/playground/Makefile.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
DEFAULT_PYMAKE_TARGET = "echo1"


def echo1(msg1="world"):
print(f"hello {msg1}")

Expand Down
1 change: 1 addition & 0 deletions src/tests/test_background.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import time

from pipepy import PipePy

echo_messages = PipePy('python', 'src/tests/playground/echo_messages.py')
Expand Down
9 changes: 9 additions & 0 deletions src/tests/test_pymake.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ def test_pymake_args():
cd('../../..')


def test_pymake_default_target():
cd('src/tests/playground')

assert str(pymake) == "hello world\n"
assert str(pymake('msg1=Bill')) == "hello Bill\n"

cd('../../..')


def test_pymake_dependencies():
cd('src/tests/playground')

Expand Down

0 comments on commit 554ec16

Please sign in to comment.