Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 33 additions & 52 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,95 +5,76 @@ on: [push, pull_request]
jobs:
linters:
name: linters
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.13"]
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- name: Setup python
uses: actions/setup-python@v1
- uses: actions/checkout@v5

- name: Install Poetry
uses: snok/install-poetry@v1
- name: Install uv and set the python version
uses: astral-sh/setup-uv@v6
with:
virtualenvs-create: true
virtualenvs-in-project: true

- name: Cache Poetry virtualenv
uses: actions/cache@v2
id: cached-poetry-dependencies
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
enable-cache: true
python-version: ${{ matrix.python-version }}

- name: Install Dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
- name: Install the project
run: uv sync --locked --all-extras --dev

- name: Run black
run: poetry run black --check .
run: uv run black --check .

pytest:
name: Testing on Python ${{ matrix.python-version }} (${{ matrix.platform}})
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
platform: [ubuntu-latest, macOS-latest, windows-latest]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
platform: [ubuntu-latest, macos-13, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- name: Setup python
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
architecture: x64

- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- uses: actions/checkout@v5

- name: Cache Poetry virtualenv
uses: actions/cache@v2
id: cached-poetry-dependencies
- name: Install uv and set the python version
uses: astral-sh/setup-uv@v6
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
enable-cache: true
python-version: ${{ matrix.python-version }}

- name: Install Dependencies
run: poetry install --no-interaction --no-root
- name: Install the project
run: uv sync --locked --all-extras --dev

- name: Run pytest
run: poetry run pytest -vv
run: uv run pytest -vs

release:
name: Releasing to pypi
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
needs: [linters, pytest]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup python
uses: actions/setup-python@v1
with:
python-version: 3.8
- uses: actions/checkout@v5

- name: Install Poetry
uses: snok/install-poetry@v1
- name: Install uv and set the python version
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
python-version: "3.10"

- name: build release
run: poetry build
- name: Build release
run: uv build

- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: build
path: dist/*
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
.pytest_cache/
.vscode/
dist/
nornir.log
nornir.log
.venv/
2 changes: 1 addition & 1 deletion nornir_http/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def __init__(
response: Response,
result: Any = None,
failed: bool = False,
**kwargs: Any
**kwargs: Any,
):
super().__init__(host=host, result=result, failed=failed, **kwargs)
self.response = response
2 changes: 1 addition & 1 deletion nornir_http/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def http_method(
url: str = "",
raise_for_status: bool = False,
is_error: bool = True,
**kwargs: Any
**kwargs: Any,
) -> HTTPResult:
"""
This is a helper task that uses `httpx <https://www.python-httpx.org/api/>`_ to
Expand Down
Loading