diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 668b9aa..0000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: '' -labels: bug -assignees: '' - ---- - -**NetBox version** -What version of NetBox are you currently running? - -**Describe the bug** -A clear and concise description of what the bug is. - -**To Reproduce** -Steps to reproduce the behavior: -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**Screenshots** -If applicable, add screenshots to help explain your problem. - -**Additional context** -Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml new file mode 100644 index 0000000..8319faa --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -0,0 +1,61 @@ +--- +name: 🐛 Bug Report +description: Report a reproducible bug in the current release of NetBox Napalm Plugin +labels: ["type: bug"] +body: + - type: markdown + attributes: + value: > + **NOTE:** This form is only for reporting _reproducible bugs_ in a current NetBox Napalm Plugin release. + - type: input + attributes: + label: NetBox Napalm Plugin version + description: What version of NetBox Napalm Plugin are you currently running? + placeholder: v0.1.0 + validations: + required: true + - type: input + attributes: + label: NetBox version + description: What version of NetBox are you currently running? + placeholder: v3.6.0 + validations: + required: true + - type: dropdown + attributes: + label: Python version + description: What version of Python are you currently running? + options: + - "3.8" + - "3.9" + - "3.10" + - "3.11" + validations: + required: true + - type: textarea + attributes: + label: Steps to Reproduce + description: > + Please provide a minimal working example to demonstrate the bug. Begin with the + initialization of any necessary database objects and clearly enumerate each + operation carried out. Ensure that your example is as concise as possible + while adequately illustrating the issue. + + _Please refrain from including any confidential or sensitive + information in your example._ + validations: + required: true + - type: textarea + attributes: + label: Expected Behavior + description: What did you expect to happen? + placeholder: The script should execute without raising any errors or exceptions + validations: + required: true + - type: textarea + attributes: + label: Observed Behavior + description: What happened instead? + placeholder: A TypeError exception was raised + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..afeaea8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,12 @@ +# Reference: https://help.github.com/en/github/building-a-strong-community/configuring-issue-templates-for-your-repository#configuring-the-template-chooser +blank_issues_enabled: false +contact_links: + - name: 📖 Contributing Policy + url: https://github.com/netbox-community/netbox-napalm-plugin/blob/main/CONTRIBUTING.md + about: "Please read through our contributing policy before opening an issue or pull request." + - name: ❓ Discussion + url: https://github.com/netbox-community/netbox-napalm-plugin/discussions + about: "If you're just looking for help, try starting a discussion instead." + - name: 💬 Community Slack + url: https://netdev.chat + about: "Join #netbox on the NetDev Community Slack for assistance with installation issues and other problems." diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 11fc491..0000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: enhancement -assignees: '' - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml new file mode 100644 index 0000000..12c0e65 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -0,0 +1,59 @@ +--- +name: ✨ Feature Request +description: Propose a new NetBox Napalm Plugin feature or enhancement +labels: ["type: feature"] +body: + - type: markdown + attributes: + value: > + **NOTE:** This form is only for submitting well-formed proposals to extend or modify + NetBox Napalm Plugin in some way. If you're trying to solve a problem but can't figure out how, or if + you still need time to work on the details of a proposed new feature, please start a + [discussion](https://github.com/netbox-community/pynetbox/discussions) instead. + - type: input + attributes: + label: NetBox Napalm Plugin version + description: What version of NetBox Napalm Plugin are you currently running? + placeholder: v0.1.0 + validations: + required: true + - type: input + attributes: + label: NetBox version + description: What version of NetBox are you currently running? + placeholder: v3.6.0 + validations: + required: true + - type: dropdown + attributes: + label: Feature type + options: + - Data model extension + - New functionality + - Change to existing functionality + validations: + required: true + - type: textarea + attributes: + label: Proposed functionality + description: > + Describe in detail the new feature or behavior you are proposing. Include any specific changes + to work flows, data models, and/or the user interface. The more detail you provide here, the + greater chance your proposal has of being discussed. Feature requests which don't include an + actionable implementation plan will be rejected. + validations: + required: true + - type: textarea + attributes: + label: Use case + description: > + Explain how adding this functionality would benefit NetBox Napalm Plugin users. What need does it address? + validations: + required: true + - type: textarea + attributes: + label: External dependencies + description: > + List any new dependencies on external libraries or services that this new feature would + introduce. For example, does the proposal require the installation of a new Python package? + (Not all new features introduce new dependencies.) diff --git a/.github/ISSUE_TEMPLATE/housekeeping.yaml b/.github/ISSUE_TEMPLATE/housekeeping.yaml new file mode 100644 index 0000000..7778713 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/housekeeping.yaml @@ -0,0 +1,24 @@ +--- +name: 🏡 Housekeeping +description: A change pertaining to the codebase itself (developers only) +labels: ["type: housekeeping"] +body: + - type: markdown + attributes: + value: > + **NOTE:** This template is for use by maintainers only. Please do not submit + an issue using this template unless you have been specifically asked to do so. + - type: textarea + attributes: + label: Proposed Changes + description: > + Describe in detail the new feature or behavior you'd like to propose. + Include any specific changes to work flows, data models, or the user interface. + validations: + required: true + - type: textarea + attributes: + label: Justification + description: Please provide justification for the proposed change(s). + validations: + required: true diff --git a/.github/workflows/publish-pypi.yaml b/.github/workflows/publish-pypi.yaml new file mode 100644 index 0000000..b495f1f --- /dev/null +++ b/.github/workflows/publish-pypi.yaml @@ -0,0 +1,51 @@ +# see: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ +name: Publish Python 🐍 distribution 📦 to PyPI + +on: push + +jobs: + build: + name: Build distribution 📦 + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5.1.0 + with: + python-version: "3.x" + - name: Install pypa/build + run: >- + python3 -m + pip install + build + --user + - name: Build a binary wheel and a source tarball + run: python3 -m build + - name: Store the distribution packages + uses: actions/upload-artifact@v4 + with: + name: python-package-distributions + path: dist/ + + publish-to-pypi: + name: >- + Publish Python 🐍 distribution 📦 to PyPI + if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes + needs: + - build + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/netbox-napalm-plugin + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.gitignore b/.gitignore index 1504b76..99fe069 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,129 @@ +# https://github.com/github/gitignore/blob/main/Global/macOS.gitignore + +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +!.vscode/*.code-snippets + +# Local History for Visual Studio Code +.history/ + +# Built Visual Studio Code Extensions +*.vsix + +# https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore + +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# SonarLint plugin +.idea/sonarlint/ + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +# https://github.com/github/gitignore/blob/main/Python.gitignore + # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] @@ -8,7 +134,6 @@ __pycache__/ # Distribution / packaging .Python -env/ build/ develop-eggs/ dist/ @@ -21,9 +146,11 @@ parts/ sdist/ var/ wheels/ +share/python-wheels/ *.egg-info/ .installed.cfg *.egg +MANIFEST # PyInstaller # Usually these files are written by a python script from a template @@ -38,14 +165,17 @@ pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ +.nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover +*.py,cover .hypothesis/ .pytest_cache/ +cover/ # Translations *.mo @@ -54,6 +184,8 @@ coverage.xml # Django stuff: *.log local_settings.py +db.sqlite3 +db.sqlite3-journal # Flask stuff: instance/ @@ -66,27 +198,61 @@ instance/ docs/_build/ # PyBuilder +.pybuilder/ target/ # Jupyter Notebook .ipynb_checkpoints +# IPython +profile_default/ +ipython_config.py + # pyenv -.python-version +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml -# celery beat schedule file +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff celerybeat-schedule +celerybeat.pid # SageMath parsed files *.sage.py -# dotenv +# Environments .env - -# virtualenv .venv +env/ venv/ ENV/ +env.bak/ +venv.bak/ # Spyder project settings .spyderproject @@ -100,9 +266,16 @@ ENV/ # mypy .mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ -# IDE settings -.vscode/ -.idea/ +# Cython debug symbols +cython_debug/ /netbox_napalm_plugin/project-static/node_modules diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..da4e9c6 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,22 @@ +ci: + autoupdate_commit_msg: "chore: update pre-commit hooks" + autofix_commit_msg: "style: pre-commit fixes" + +repos: +- repo: https://github.com/psf/black + rev: 24.3.0 + hooks: + - id: black + args: [--line-length=120] + language_version: python3.11 + +- repo: https://github.com/PyCQA/flake8 + rev: 7.0.0 + hooks: + - id: flake8 + +- repo: https://github.com/mgedmin/check-manifest + rev: "0.49" + hooks: + - id: check-manifest + stages: [manual] diff --git a/MANIFEST.in b/MANIFEST.in index 8e0187d..fc5d3a7 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -5,7 +5,7 @@ include README.md recursive-include tests * recursive-exclude * __pycache__ recursive-exclude * *.py[co] -recursive-include netbox_napalm_plugin/templates * -recursive-include netbox_napalm_plugin/static * recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif + +graft templates diff --git a/mkdocs.yml b/mkdocs.yml index 87c1a53..94d15e3 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,12 +1,10 @@ site_name: NetBox Napalm Plugin -site_url: https://netbox-community.github.io/netbox-napalm -repo_url: https://github.com/netbox-community/netbox-napalm -repo_name: netbox-community/netbox-napalm +site_url: https://netbox-community.github.io/netbox-napalm-plugin +repo_url: https://github.com/netbox-community/netbox-napalm-plugin +repo_name: netbox-community/netbox-napalm-plugin #strict: true nav: - Home: index.md - - Configuration: configuration.md - - Integration: integration.md - Contributing: contributing.md - Changelog: changelog.md theme: @@ -22,9 +20,10 @@ theme: - navigation.instant - navigation.tabs.sticky markdown_extensions: + - attr_list - pymdownx.emoji: - emoji_index: !!python/name:materialx.emoji.twemoji - emoji_generator: !!python/name:materialx.emoji.to_svg + emoji_index: !!python/name:material.extensions.emoji.twemoji + emoji_generator: !!python/name:material.extensions.emoji.to_svg - pymdownx.critic - pymdownx.caret - pymdownx.mark @@ -50,7 +49,7 @@ plugins: lang: en - mkdocstrings: watch: - - netbox_napalm_plugin + - netbox-napalm-plugin extra: social: - icon: fontawesome/brands/twitter @@ -62,7 +61,7 @@ extra: link: https://github.com/netbox-community/cookiecutter-netbox-plugin name: Facebook - icon: fontawesome/brands/github - link: https://github.com/netbox-community/netbox-napalm + link: https://github.com/netbox-community/netbox-napalm-plugin name: Github - icon: material/email link: "mailto:ahanson@netboxlabs.com" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..db8627e --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,50 @@ +# See PEP 518 for the spec of this file +# https://www.python.org/dev/peps/pep-0518/ + +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[project] +name = "netbox-napalm-plugin" +version = "0.1.7" +authors = [ + {name = "Arthur Hanson", email = "ahanson@netboxlabs.com"}, +] +description = "NetBox plugin for Napalm." +readme = "README.md" + +classifiers=[ + 'Development Status :: 3 - Alpha', + 'Intended Audience :: Developers', + 'Natural Language :: English', + "Programming Language :: Python :: 3 :: Only", + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', +] + +requires-python = ">=3.8.1" + +[project.optional-dependencies] +test = [ + "black==24.3.0", + "check-manifest==0.49", + "flake8", + "flake8-pyproject", + "pre-commit==3.7.0", + "pytest==8.1.1", +] + +[project.urls] +Documentation = "https://github.com/netbox-community/netbox-napalm-plugin/blob/main/README.md" +Source = "https://github.com/netbox-community/netbox-napalm-plugin" +Tracker = "https://github.com/netbox-community/netbox-napalm-plugin/issues" + +[tool.black] +line-length = 120 +target_version = ['py39', 'py310', 'py311', 'py312'] + +[tool.setuptools.package-data] +netbox_napalm_plugin = ["templates/**"] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 2205854..0000000 --- a/setup.cfg +++ /dev/null @@ -1,46 +0,0 @@ -[flake8] -max-line-length = 120 -max-complexity = 18 -ignore = E203, E266, W503 -per-file-ignores = __init__.py:F401 -exclude = .git, - __pycache__, - setup.py, - build, - dist, - docs, - releases, - .venv, - .tox, - .mypy_cache, - .pytest_cache, - .vscode, - .github, - # By default test codes will be linted. - # tests - -[tox:tox] -isolated_build = true -envlist = py38, py39, py310, format, lint, build - -[gh-actions] -python = - 3.10: py310 - 3.9: py39 - 3.8: py38, format, lint, build - -[bumpversion] -current_version = 0.1.6 -commit = True -tag = True - -[bumpversion:file:setup.py] -search = version='{current_version}' -replace = version='{new_version}' - -[bumpversion:file:netbox_napalm_plugin/__init__.py] -search = __version__ = '{current_version}' -replace = __version__ = '{new_version}' - -[bdist_wheel] -universal = 1 diff --git a/setup.py b/setup.py deleted file mode 100644 index 9358c0b..0000000 --- a/setup.py +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env python - -"""The setup script.""" - -from setuptools import setup, find_packages - -with open('README.md') as readme_file: - readme = readme_file.read() - -requirements = ['napalm<5.0'] - -setup( - author="Arthur Hanson", - author_email='ahanson@netboxlabs.com', - python_requires='>=3.8', - classifiers=[ - 'Development Status :: 2 - Pre-Alpha', - 'Intended Audience :: Developers', - 'Natural Language :: English', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - ], - description="NetBox plugin for Napalm.", - install_requires=requirements, - long_description=readme, - long_description_content_type='text/markdown', - include_package_data=True, - keywords='netbox_napalm_plugin', - name='netbox_napalm_plugin', - packages=find_packages(include=['netbox_napalm_plugin', 'netbox_napalm_plugin.*']), - test_suite='tests', - url='https://github.com/netbox-community/netbox-napalm', - version='0.1.6', - zip_safe=False, -)