Skip to content

Commit

Permalink
Merge pull request #17 from InfrastructureAsCode-ch/develop
Browse files Browse the repository at this point in the history
Version 0.2.0
  • Loading branch information
ubaumann authored Aug 24, 2024
2 parents bfbc220 + d0d9442 commit acd3dd6
Show file tree
Hide file tree
Showing 7 changed files with 447 additions and 397 deletions.
27 changes: 13 additions & 14 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ jobs:
name: linters
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v1
uses: actions/setup-python@v5

- name: Install Poetry
uses: snok/install-poetry@v1
Expand All @@ -18,7 +18,7 @@ jobs:
virtualenvs-in-project: true

- name: Cache Poetry virtualenv
uses: actions/cache@v2
uses: actions/cache@v4
id: cached-poetry-dependencies
with:
path: .venv
Expand All @@ -40,16 +40,15 @@ jobs:
shell: bash
strategy:
matrix:
python-version: [ '3.8', '3.9', '3.10', '3.11']
platform: [ubuntu-latest, macOS-latest, windows-latest]
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
platform: [ubuntu-latest, macos-13, windows-2019]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v1
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: x64

- name: Install Poetry
uses: snok/install-poetry@v1
Expand All @@ -58,12 +57,12 @@ jobs:
virtualenvs-in-project: true

- name: Cache Poetry virtualenv
uses: actions/cache@v2
uses: actions/cache@v4
id: cached-poetry-dependencies
with:
path: .venv
key: venv-${{ matrix.python-version }}-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
if: ${{ matrix.platform != 'windows-latest' }} # windows hangs if using a cached venv
if: ${{ matrix.platform != 'windows-2019' }} # windows hangs if using a cached venv

- name: Install Dependencies
run: poetry install --no-interaction --no-root
Expand All @@ -76,13 +75,13 @@ jobs:

- name: Force using UTF-8 encoding for windows tests
run: poetry run python -m pytest -vs
if: ${{ matrix.platform == 'windows-latest' }}
if: ${{ matrix.platform == 'windows-2019' }}
env:
PYTHONIOENCODING: utf-8

- name: Run pytest
run: make pytest
if: ${{ matrix.platform != 'windows-latest' }}
if: ${{ matrix.platform != 'windows-2019' }}


release:
Expand All @@ -91,9 +90,9 @@ jobs:
needs: [linters, pytest]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v1
uses: actions/setup-python@v5
with:
python-version: 3.8

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ IMG_URL=https://raw.githubusercontent.com/InfrastructureAsCode-ch/nornir_rich/ma
# Run pytest
.PHONY: pytest
pytest:
poetry run pytest -vs ${ARGS}
poetry run pytest -vs tests

# Check if the python code needs to be reformatted
.PHONY: black
Expand Down
2 changes: 1 addition & 1 deletion nornir_rich/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.1.6" # From Makefile
__version__ = "0.2.0" # From Makefile
12 changes: 5 additions & 7 deletions nornir_rich/progress_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,21 +103,19 @@ def task_instance_started(self, task: Task, host: Host) -> None:
self.progress_running_tasks.update(self.running_concurrent_bar, advance=1)

def task_instance_completed(
self, task: Task, host: Host, results: MultiResult
self, task: Task, host: Host, result: MultiResult
) -> None:
with self.lock:
self.progress_running_tasks.update(self.running_concurrent_bar, advance=-1)
self.progress_total.update(self.total, advance=1)
self.progress_status.update(
self.error if results.failed else self.successful, advance=1
self.error if result.failed else self.successful, advance=1
)
if results.changed:
if result.changed:
self.progress_status.update(self.changed, advance=1)

def subtask_instance_started(self, task: Task, host: Host) -> None:
...
def subtask_instance_started(self, task: Task, host: Host) -> None: ...

def subtask_instance_completed(
self, task: Task, host: Host, result: MultiResult
) -> None:
...
) -> None: ...
Loading

0 comments on commit acd3dd6

Please sign in to comment.