Skip to content
Open
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
29 changes: 29 additions & 0 deletions .cookiecutter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"cookiecutter": {
"codeowner_github_usernames": "@itdependsnetworks @jeffkala @qduk",
"full_name": "Network to Code, LLC",
"email": "info@networktocode.com",
"github_org": "networktocode",
"description": "Common helper functions useful in network automation.",
"project_name": "netutils",
"project_slug": "netutils",
"repo_url": "https://github.com/networktocode/netutils",
"base_url": "netutils",
"project_python_name": "netutils",
"project_python_base_version": "3.9",
"project_with_config_settings": "no",
"generate_docs": "yes",
"version": "1.15.1",
"_drift_manager": {
"template": "https://github.com/networktocode-llc/cookiecutter-ntc.git",
"template_dir": "python",
"template_ref": "main",
"cookie_dir": "",
"branch_prefix": "drift-manager",
"pull_request_strategy": "create",
"post_actions": [],
"draft": false,
"baked_commit_ref": "cb8b5e31dece5ab2663d2ffd218a96ca1ae794c5"
}
}
}
32 changes: 26 additions & 6 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
**/*.pyc
**/*.pyo
**/*.log
.git/
.gitignore
# Docker related
development/Dockerfile
development/docker-compose*.yml
development/*.env
*.env
environments/
Dockerfile
docker-compose.yml
.env

# Python
**/*.pyc
**/*.pyo
**/__pycache__/
**/.pytest_cache/
**/.venv/


# Other
docs/_build
**/__pycache__
FAQ.md
.git/
.gitignore
.github
tasks.py
LICENSE
**/*.log
**/.vscode/
invoke*.yml
tasks.py
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ about: Report a reproducible bug in the current release of netutils
---

### Environment
* Python version: <!-- Example: 3.8.5 -->
* netutils version: <!-- Example: 1.14.0 -->
* Python version: <!-- Example: 3.9 -->
* netutils version: <!-- Example: 1.0.0 -->

<!-- What did you expect to happen? -->
### Expected Behavior
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ about: Propose a new feature or enhancement
---

### Environment
* netutils version: <!-- Example: 1.14.0 -->
* netutils version: <!-- Example: 1.0.0 -->

<!--
Describe in detail the new functionality you are proposing.
Expand Down
87 changes: 54 additions & 33 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ env:

jobs:
ruff-format:
runs-on: "ubuntu-24.04"
runs-on: "ubuntu-latest"
env:
INVOKE_NETUTILS_LOCAL: "True"
steps:
Expand All @@ -27,11 +27,11 @@ jobs:
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
with:
poetry-version: "1.8.5"
poetry-version: "2.1.3"
- name: "Linting: ruff format"
run: "poetry run invoke ruff --action format"
ruff-lint:
runs-on: "ubuntu-24.04"
runs-on: "ubuntu-latest"
env:
INVOKE_NETUTILS_LOCAL: "True"
steps:
Expand All @@ -40,11 +40,11 @@ jobs:
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
with:
poetry-version: "1.8.5"
poetry-version: "2.1.3"
- name: "Linting: ruff"
run: "poetry run invoke ruff --action lint"
mypy:
runs-on: "ubuntu-24.04"
runs-on: "ubuntu-latest"
env:
INVOKE_NETUTILS_LOCAL: "True"
steps:
Expand All @@ -60,7 +60,7 @@ jobs:
- "ruff-format"
- "ruff-lint"
check-docs-build:
runs-on: "ubuntu-24.04"
runs-on: "ubuntu-latest"
env:
INVOKE_NETUTILS_LOCAL: "True"
steps:
Expand All @@ -69,11 +69,12 @@ jobs:
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
with:
poetry-version: "1.8.5"
poetry-version: "2.1.3"
poetry-install-options: "--only dev,docs"
- name: "Check Docs Build"
run: "poetry run invoke build-and-check-docs"
poetry:
runs-on: "ubuntu-24.04"
runs-on: "ubuntu-latest"
env:
INVOKE_NETUTILS_LOCAL: "True"
steps:
Expand All @@ -82,16 +83,15 @@ jobs:
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
with:
poetry-version: "1.8.5"
poetry-version: "2.1.3"
- name: "Checking: poetry lock file"
run: "poetry lock --check"
run: "poetry run invoke lock --check"
needs:
- "ruff-format"
- "ruff-lint"
- "mypy"
- "yamllint"
yamllint:
runs-on: "ubuntu-24.04"
runs-on: "ubuntu-latest"
env:
INVOKE_NETUTILS_LOCAL: "True"
steps:
Expand All @@ -100,14 +100,14 @@ jobs:
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
with:
poetry-version: "1.8.5"
poetry-version: "2.1.3"
- name: "Linting: yamllint"
run: "poetry run invoke yamllint"
needs:
- "ruff-format"
- "ruff-lint"
pylint:
runs-on: "ubuntu-24.04"
runs-on: "ubuntu-latest"
strategy:
fail-fast: true
matrix:
Expand All @@ -120,7 +120,7 @@ jobs:
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
with:
poetry-version: "1.8.5"
poetry-version: "2.1.3"
- name: "Get image version"
run: "echo INVOKE_NETUTILS_IMAGE_VER=`poetry version -s`-py${{ matrix.python-version }} >> $GITHUB_ENV"
- name: "Set up Docker Buildx"
Expand All @@ -139,8 +139,6 @@ jobs:
cache-to: "type=gha,scope=${{ env.INVOKE_NETUTILS_IMAGE_NAME }}-${{ env.INVOKE_NETUTILS_IMAGE_VER }}-py${{ matrix.python-version }}"
build-args: |
PYTHON_VER=${{ env.PYTHON_VER }}
- name: "Debug: Show docker images"
run: "docker image ls"
- name: "Linting: Pylint"
run: "poetry run invoke pylint"
needs:
Expand All @@ -150,7 +148,7 @@ jobs:
fail-fast: true
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
runs-on: "ubuntu-24.04"
runs-on: "ubuntu-latest"
env:
PYTHON_VER: "${{ matrix.python-version }}"
steps:
Expand All @@ -159,7 +157,7 @@ jobs:
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
with:
poetry-version: "1.8.5"
poetry-version: "2.1.3"
- name: "Get image version"
run: "echo INVOKE_NETUTILS_IMAGE_VER=`poetry version -s`-py${{ matrix.python-version }} >> $GITHUB_ENV"
- name: "Set up Docker Buildx"
Expand All @@ -178,15 +176,31 @@ jobs:
cache-to: "type=gha,scope=${{ env.INVOKE_NETUTILS_IMAGE_NAME }}-${{ env.INVOKE_NETUTILS_IMAGE_VER }}-py${{ matrix.python-version }}"
build-args: |
PYTHON_VER=${{ env.PYTHON_VER }}
- name: "Debug: Show docker images"
run: "docker image ls"
- name: "Run Tests"
run: "poetry run invoke pytest"
needs:
- "pylint"
- "poetry"
changelog:
if: >
contains(fromJson('["develop"]'), github.base_ref) &&
(github.head_ref != 'main') && (!startsWith(github.head_ref, 'release'))
runs-on: "ubuntu-latest"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v4"
with:
fetch-depth: "0"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
with:
poetry-version: "2.1.3"
- name: "Check for changelog entry"
run: |
git fetch --no-tags origin +refs/heads/${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }}
poetry run towncrier check --compare-with origin/${{ github.base_ref }}
publish_gh:
name: "Publish to GitHub"
runs-on: "ubuntu-24.04"
runs-on: "ubuntu-latest"
# yamllint disable-line rule:quoted-strings
if: startsWith(github.ref, 'refs/tags/v')
env:
Expand All @@ -197,13 +211,15 @@ jobs:
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
with:
poetry-version: "1.8.5"
poetry-version: "2.1.3"
python-version: "3.12"
poetry-install-options: "--no-root"
- name: "Set env"
run: "echo RELEASE_VERSION=${GITHUB_REF:10} >> $GITHUB_ENV"
- name: "Run Poetry Version"
run: "poetry version $RELEASE_VERSION"
- name: "Build Documentation"
run: "poetry run invoke build-and-check-docs"
- name: "Run Poetry Build"
run: "poetry build"
- name: "Upload binaries to release"
Expand All @@ -214,25 +230,30 @@ jobs:
- "pytest"
publish_pypi:
name: "Push Package to PyPI"
runs-on: "ubuntu-24.04"
if: "startsWith(github.ref, 'refs/tags/v')"
runs-on: "ubuntu-latest"
# yamllint disable-line rule:quoted-strings
if: startsWith(github.ref, 'refs/tags/v')
env:
INVOKE_NETUTILS_LOCAL: "True"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v4"
- name: "Set up Python"
uses: "actions/setup-python@v2"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
with:
python-version: "3.13"
- name: "Install Python Packages"
run: "pip install poetry"
poetry-version: "2.1.3"
- name: "Set env"
run: "echo RELEASE_VERSION=${GITHUB_REF:10} >> $GITHUB_ENV"
- name: "Run Poetry Version"
run: "poetry version $RELEASE_VERSION"
- name: "Install Dependencies (needed for mkdocs)"
run: "poetry install --no-root"
- name: "Build Documentation"
run: "poetry run invoke build-and-check-docs"
- name: "Run Poetry Build"
run: "poetry build"
- name: "Push to PyPI"
uses: "pypa/gh-action-pypi-publish@release/v1"
uses: "pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc" # v1.12.4
with:
user: "__token__"
password: "${{ secrets.PYPI_API_TOKEN }}"
Expand All @@ -242,7 +263,7 @@ jobs:
needs:
- "publish_gh"
- "publish_pypi"
runs-on: "ubuntu-24.04"
runs-on: "ubuntu-latest"
env:
SLACK_WEBHOOK_URL: "${{ secrets.SLACK_WEBHOOK_URL }}"
SLACK_MESSAGE: >-
Expand Down
Loading