Skip to content

Commit

Permalink
Remove trailing newline (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cariad Eccleston authored Mar 16, 2021
1 parent 6f71fea commit 5c3fa57
Show file tree
Hide file tree
Showing 15 changed files with 104 additions and 71 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ jobs:
- if: steps.cache-venv.outputs.cache-hit != 'true'
run: pipenv sync --dev

- run: pipenv run ./test.sh
- run: pipenv run ./lint.sh
- run: pipenv run pytest

- uses: codecov/codecov-action@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ verify_ssl = true
name = "pypi"

[packages]
colorama = "*"
colorama = "~=0.4.4"

[dev-packages]
black = "==20.8b1"
Expand Down
76 changes: 50 additions & 26 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

![Build](https://github.com/cariad/progrow/actions/workflows/ci.yml/badge.svg) [![codecov](https://codecov.io/gh/cariad/progrow/branch/main/graph/badge.svg?token=0WYUG6XRR8)](https://codecov.io/gh/cariad/progrow)

`progrow` is a Python package for describing the progress of work across rows.
`progrow` is a Python package for graphing the progress of work across rows.

![progrow example](https://github.com/cariad/progrow/raw/main/example.png)

Expand All @@ -14,9 +14,7 @@
pip install progrow
```

## Examples

### Rendering a single row
## Rendering a single row

```python
from progrow import Row
Expand All @@ -29,7 +27,7 @@ print(row.render())
apple harvest ████████▉
```

### Including fractions, percentages and other styles
## Including fractions, percentages and other styles

An optional `Style` can be passed into `render()`:

Expand All @@ -54,7 +52,7 @@ print(row.render(style=style))
apple harvest progress: ███▌ 23 / 100 • 23%
```

### Rendering rows from a generator
## Rendering rows from a generator

```python
from progrow import Row, Style
Expand Down Expand Up @@ -106,7 +104,7 @@ banana harvest █▊ 9 / 99 • 9%
caramel harvest ███████████████████ 100 / 100 • 100%
```

### Rendering rows from a list
## Rendering rows from a list

When all the row data is available before rendering, create a `Rows` instance to have the layout calculated automatically.

Expand Down
Binary file modified example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash -e

li="\033[1;34m↪\033[0m " # List item
ok="\033[0;32m✔️\033[0m " # OK

while IFS="" read -r file_path
do
echo -e "${li:?}${file_path:?}"
shellcheck --check-sourced --enable=all --severity style -x "${file_path:?}"
done < <(find . -name "*.sh" -not -path "./.venv/*")

echo -e "${li:?}Linting YAML..."
yamllint . --strict

echo -e "${li:?}Sorting Python import definitions..."
if [[ "${CI:=}" == "true" ]]; then
isort . --check-only --diff
else
isort .
fi

echo -e "${li:?}Applying opinionated Python code style..."
if [[ "${CI:=}" == "true" ]]; then
black . --check --diff
else
black .
fi

echo -e "${li:?}Checking PEP8 compliance..."
flake8 .

echo -e "${li:?}Checking Python types..."
mypy progrow
mypy tests

echo -e "${ok:?}OK!"
2 changes: 1 addition & 1 deletion progrow/rows.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ def render(self, style: Style = Style()) -> str:
for row in self.rows:
rendered += row.render(layout, style) + "\n"

return rendered
return rendered.rstrip()
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
addopts = "--cov=progrow --cov-branch --cov-report=html --cov-report=term-missing:skip-covered --cov-report=xml --no-cov-on-fail"
log_cli = 1
log_cli_level = "DEBUG"
testpaths = "progrow"
testpaths = "tests"
11 changes: 6 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
# "Typing :: Typed",
"Typing :: Typed",
]

version = get_version()
Expand All @@ -34,10 +37,10 @@
author="Cariad Eccleston",
author_email="[email protected]",
classifiers=classifiers,
description="Describes the progress of work across rows",
description="Graphs the progress of work across rows",
include_package_data=True,
install_requires=[
"colorama>=0.4",
"colorama~=0.4.4",
],
license="MIT License",
long_description=long_description,
Expand All @@ -46,8 +49,6 @@
packages=[
"progrow",
],
# "py.typed" in each package's directory must be included for the package to
# be considered typed.
package_data={
"progrow": ["py.typed"],
},
Expand Down
27 changes: 0 additions & 27 deletions test.sh

This file was deleted.

Empty file added tests/__init__.py
Empty file.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions progrow/test_rows.py → tests/test_rows.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def test_append() -> None:
rows = Rows([Row(name="foo", current=1, maximum=9)])
rows.append(name="bar", current=2, maximum=9)
style = Style(color=False, width=40)
assert rows.render(style) == "foo ████\nbar ███████▉\n"
assert rows.render(style) == "foo ████\nbar ███████▉"


@mark.parametrize(
Expand Down Expand Up @@ -148,4 +148,4 @@ def test_calculate_layout(rows: Rows, style: Style, expect: Layout) -> None:
],
)
def test_to_string(rows: Rows, style: Style, expect: List[str]) -> None:
assert rows.render(style) == "\n".join(expect) + "\n"
assert rows.render(style) == "\n".join(expect)
File renamed without changes.

0 comments on commit 5c3fa57

Please sign in to comment.