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
24 changes: 24 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.idea/
venv/
.venv/
pytest_nuts.egg-info/
__pycache__
.vscode/
docs/build/
inventory/
nr-config.yaml
.pytest_cache/
.tox/
.mypy_cache/

test-reports/
.coverage

# ignore dists
dist/

tests/
.git/
.github/
Dockerfile
.dockerignore
25 changes: 14 additions & 11 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
# https://www.ianwootten.co.uk/2020/10/23/publishing-to-pypi-using-github-actions/
name: Publish nuts to PyPI and release on GitHub
on:
push:
Expand All @@ -12,16 +10,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python 3.9
uses: actions/setup-python@v6
- name: Install uv and set the python version
uses: astral-sh/setup-uv@v6
with:
python-version: 3.9
- name: Install poetry
run: pip install poetry
- name: Configure API token
run: poetry config pypi-token.pypi "${{ secrets.PYPI_API_TOKEN }}"
- name: Build and then publish nuts to PyPI
run: poetry publish --build
enable-cache: true
python-version: "3.13"

- 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 }}

relase-on-github:
name: Release on GitHub
runs-on: ubuntu-latest
Expand Down
19 changes: 11 additions & 8 deletions .github/workflows/run-mock_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,24 @@ on: [push, workflow_dispatch]
jobs:
run-mock_project:
name: Install NUTS from wheel and run mock project
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.13' ]
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v5
- name: Set up Python 3.9
uses: actions/setup-python@v6
- name: Install uv and set the python version
uses: astral-sh/setup-uv@v6
with:
python-version: 3.9
- name: Install poetry
run: pip install poetry
enable-cache: true
python-version: ${{ matrix.python-version }}
- name: Build package
run: poetry build
run: uv build

- name: Create and start virtual environment
run: |
python3 -m venv .venv
uv run python3 -m venv .venv
source .venv/bin/activate
working-directory: tests/mock_project
- name: Install NUTS using wheel
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-tests-against-pytest-master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: 3.12
python-version: 3.13
- name: install tox
run: pip install tox
- name: run tox against pytest-main
Expand Down
10 changes: 3 additions & 7 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python: [3.9, "3.10"]
include:
- python: 3.9
testenv: py
- python: "3.10"
testenv: py
python: ["3.10", "3.11", "3.12", "3.13"]
testenv: [py]
steps:
- uses: actions/checkout@v5
- uses: actions/cache@v4
Expand Down Expand Up @@ -48,7 +44,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.10"
python-version: "3.13"
- name: install tox
run: pip install tox
- name: "Run tox with ${{ matrix.testenv }}"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ inventory/
nr-config.yaml
.pytest_cache/
.tox/
.mypy_cache/

test-reports/
.coverage
Expand Down
19 changes: 7 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
FROM python:3.10-slim as builder
FROM python:3.13-slim

RUN pip install poetry
RUN mkdir -p /app
COPY . /app
WORKDIR /workspace

WORKDIR /app
# Install uv.
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/

RUN python3 -m venv .venv && poetry install --without dev
COPY . .

FROM python:3.10-slim as base

COPY --from=builder /app /app

WORKDIR /app
ENV PATH="/app/.venv/bin:$PATH"
ENV UV_PROJECT_ENVIRONMENT=/usr/local
RUN uv sync --frozen --no-cache --all-extras

# line below due to import bug
RUN python3 -c "from napalm.base.exceptions import ConnectionException"
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Apply test cases based on your pre-defined network topology to your actual netwo

Run `pip install nuts`

### Using poetry
### Using UV

Nuts uses [poetry](https://python-poetry.org/) as a dependency manager.
Nuts uses [uv](https://docs.astral.sh/uv/) as a dependency manager.

1. [Install poetry](https://python-poetry.org/docs/#installation).
1. [Install uv](https://docs.astral.sh/uv/getting-started/installation/).
2. Clone this repository.
3. Run `$ poetry install`
3. Run `$ uv sync`

## How It Works: Test Bundles and Test Definitions

Expand Down
9 changes: 4 additions & 5 deletions docs/source/installation/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@ NUTS is published on the Python Package Index (`PyPI <https://pypi.org/>`_), the

pip install nuts

Installation via poetry
Installation via uv
.......................

Nuts uses `poetry <https://python-poetry.org/>`__ as a dependency manager.
Nuts uses `uv <https://docs.astral.sh/uv/>`__ as a dependency manager.

#. `Install poetry <https://python-poetry.org/docs/#installation>`__.
#. `Install uv <https://docs.astral.sh/uv/getting-started/installation/>`__.
#. Clone the `nuts repository <https://github.com/INSRapperswil/Nuts.git>`__
#. Change into the cloned folder, then install all necessary dependencies: ``$ poetry install``
#. Install nuts: ``$ pip install .``
#. Change into the cloned folder, then install all necessary dependencies: ``$ uv sync``

Installation via container
..........................
Expand Down
Loading
Loading