diff --git a/.flake8 b/.flake8
new file mode 100644
index 0000000..6deafc2
--- /dev/null
+++ b/.flake8
@@ -0,0 +1,2 @@
+[flake8]
+max-line-length = 120
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index f1b06a0..81b8f0b 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -3,20 +3,8 @@ ci:
autofix_commit_msg: "style: pre-commit fixes"
repos:
- - repo: https://github.com/pre-commit/pre-commit-hooks
- rev: v4.1.0
- hooks:
- - id: check-added-large-files
- - id: check-case-conflict
- - id: check-merge-conflict
- - id: check-symlinks
- - id: end-of-file-fixer
- - id: mixed-line-ending
- - id: requirements-txt-fixer
- - id: trailing-whitespace
-
- repo: https://github.com/mgedmin/check-manifest
- rev: "0.47"
+ rev: "0.49"
hooks:
- id: check-manifest
stages: [manual]
diff --git a/Makefile b/Makefile
index ba42015..a08611a 100644
--- a/Makefile
+++ b/Makefile
@@ -9,7 +9,7 @@ bake:
cookiecutter $(BAKE_OPTIONS) . --overwrite-if-exists
watch: bake
- watchmedo shell-command -p '*.*' -c 'make bake -e BAKE_OPTIONS=$(BAKE_OPTIONS)' -W -R -D \{{cookiecutter.project_slug}}/
+ watchmedo shell-command -p '*.*' -c 'make bake -e BAKE_OPTIONS=$(BAKE_OPTIONS)' -W -R -D \{{cookiecutter.underscored}}/
replay: BAKE_OPTIONS=--replay
replay: watch
diff --git a/cookiecutter.json b/cookiecutter.json
index d240e08..e8fa24d 100644
--- a/cookiecutter.json
+++ b/cookiecutter.json
@@ -1,14 +1,15 @@
{
"plugin_name": "ACL",
"project_name": "NetBox {{ cookiecutter.plugin_name }} Plugin",
- "project_slug": "{{ cookiecutter.project_name.lower().replace(' ', '_').replace('-', '_') }}",
+ "hyphenated": "{{ '-'.join(cookiecutter['project_name'].lower().split()).replace('_', '-') }}",
+ "underscored": "{{ cookiecutter.hyphenated.replace('-', '_') }}",
"project_short_description": "NetBox plugin for {{ cookiecutter.plugin_name }}.",
"__model_name": "{{ cookiecutter.plugin_name.replace(' ', '').replace('-', '') }}",
"__model_url": "{{ cookiecutter.plugin_name.lower().replace(' ', '-').replace('_', '-') }}",
"__model_url_name": "{{ cookiecutter.plugin_name.lower().replace(' ', '').replace('_', '').replace('-', '') }}",
- "full_name": "Arthur Hanson",
- "email": "ahanson@netboxlabs.com",
- "github_username": "arthanson",
+ "full_name": "John Doe",
+ "email": "",
+ "github_username": "",
"version": "0.1.0",
"open_source_license": ["Apache-2.0", "MIT", "BSD", "ISC", "GPL-3.0-only", "Not open source"],
"_copy_without_render": ["docs/changelog.md", "docs/contributing.md", "docs/index.md", ".github/workflows/*.yml"]
diff --git a/docs/prompts.md b/docs/prompts.md
index c6a5430..7814a94 100644
--- a/docs/prompts.md
+++ b/docs/prompts.md
@@ -20,10 +20,13 @@ to initialize most of the other settings.
The name of your new Python package project. This is used in
documentation, so spaces and any characters are fine here.
-project_slug
+hyphenated
The name of your Python package for PyPI, also as the repository name of GitHub.
Typically, it is the slugified version of project_name.
+underscored
+The name of the python module and directory in the project.
+
project_short_description
A 1-sentence description of what your Python package does.
diff --git a/docs/tutorial.md b/docs/tutorial.md
index 1923a78..064395c 100644
--- a/docs/tutorial.md
+++ b/docs/tutorial.md
@@ -30,7 +30,7 @@ cookiecutter https://github.com/netbox-community/cookiecutter-netbox-plugin.git
```
Finally, a new folder will be created under current folder, the name is the answer you
-provided to `project_slug`.
+provided to `hyphenated`.
Go to this generated folder, the project layout should look like:
@@ -94,7 +94,7 @@ At this point you can run tests and make sure everything is working properly.
## Step 5: Create a GitHub Repo
Go to your GitHub account and create a new repo named `netbox-healthcheck-plugin`, where
-`netbox-healthcheck-plugin` matches the `project_slug` from your answers to running
+`netbox-healthcheck-plugin` matches the `hyphenated` from your answers to running
cookiecutter.
Then go to repo > settings > secrets, click on 'New repository secret', add the following
@@ -106,7 +106,7 @@ Then go to repo > settings > secrets, click on 'New repository secret', add the
## Step 6: Upload code to GitHub
-Back to your develop environment, find the folder named after the `project_slug`.
+Back to your develop environment, find the folder named after the `hyphenated`.
Move into this folder, and then setup git to use your GitHub repo and upload the
code:
@@ -140,7 +140,7 @@ click on actions link, you should find screen like this:
![](http://images.jieyu.ai/images/202104/20210419170304.png)
There should be some workflows running. After they finished, go to [TestPyPI], check if a
-new artifact is published under the name `project_slug`.
+new artifact is published under the name `hyphenated`.
## Step 7. Check documentation
diff --git a/hooks/pre_gen_project.py b/hooks/pre_gen_project.py
index 2173bed..5724834 100644
--- a/hooks/pre_gen_project.py
+++ b/hooks/pre_gen_project.py
@@ -5,7 +5,7 @@
MODULE_REGEX = r"^[_a-zA-Z][_a-zA-Z0-9]+$"
-module_name = "{{ cookiecutter.project_slug}}"
+module_name = "{{ cookiecutter.underscored}}"
if not re.match(MODULE_REGEX, module_name):
print(
diff --git a/pyproject.toml b/pyproject.toml
index ec5a788..fb3da7d 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -2,10 +2,12 @@
# https://www.python.org/dev/peps/pep-0518/
[build-system]
-requires = ["setuptools>=63.2.0", "wheel"]
+requires = ["setuptools"]
+build-backend = "setuptools.build_meta"
[project]
name = "cookiecutter-netbox-plugin"
+version = "0.1.0"
authors = [
{name = "Arthur Hanson", email = "ahanson@netboxlabs.com"},
]
@@ -17,24 +19,22 @@ classifiers=[
'Intended Audience :: Developers',
'Natural Language :: English',
"Programming Language :: Python :: 3 :: Only",
- 'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
+ 'Programming Language :: Python :: 3.12',
]
requires-python = ">=3.8"
-dynamic = ["version"]
[project.optional-dependencies]
test = [
- "black==23.3.0",
+ "black==24.3.0",
"check-manifest==0.49",
- "pre-commit==3.3.1",
- "pylint==2.17.4",
- "pytest-mock<3.10.1",
- "pytest-runner",
- "pytest==7.3.1",
+ "pre-commit==3.7.0",
+ "pytest==8.1.1",
+ "flake8",
+ "flake8-pyproject",
"pytest-github-actions-annotate-failures",
]
@@ -45,10 +45,4 @@ Tracker = "https://github.com/netbox-community/cookiecutter-netbox-plugin/issues
[tool.black]
line-length = 120
-target_version = ['py38', 'py39', 'py310', 'py311']
-
-[tool.isort]
-profile = "black"
-
-[tool.pylint]
-max-line-length = 120
+target-version = ['py312']
diff --git a/requirements_dev.txt b/requirements_dev.txt
index 7249de7..8fa8107 100644
--- a/requirements_dev.txt
+++ b/requirements_dev.txt
@@ -1,6 +1,6 @@
-black==23.9.1
-bump2version==1.0.1
-cookiecutter>=2.3.1
-isort==5.12.0
-pytest==5.3.1
-pytest-cookies==0.5.1
+black==24.3.0
+flake8==7.0.0
+pip==24.0
+check-manifest==0.49
+pytest==8.1.1
+pytest-cookies==0.7.0
diff --git a/tests/test_bake_project.py b/tests/test_bake_project.py
index 6bb02ce..5c1d228 100644
--- a/tests/test_bake_project.py
+++ b/tests/test_bake_project.py
@@ -1,16 +1,12 @@
from __future__ import annotations
import datetime
-import importlib
import os
import shlex
import subprocess
import sys
from contextlib import contextmanager
-import pytest
-import yaml
-from click.testing import CliRunner
from cookiecutter.utils import rmtree
@@ -94,9 +90,7 @@ def test_bake_and_run_tests(cookies):
def test_bake_withspecialchars_and_run_tests(cookies):
"""Ensure that a `full_name` with double quotes does not break setup.py"""
- with bake_in_temp_dir(
- cookies, extra_context={"full_name": 'name "quote" name'}
- ) as result:
+ with bake_in_temp_dir(cookies, extra_context={"full_name": 'name "quote" name'}) as result:
assert result.project.isdir()
run_inside_dir("python setup.py test", str(result.project)) == 0
@@ -119,24 +113,19 @@ def test_make_help(cookies):
def test_bake_selecting_license(cookies):
license_strings = {
"MIT license": "MIT ",
- "BSD license": "Redistributions of source code must retain the "
- + "above copyright notice, this",
+ "BSD license": "Redistributions of source code must retain the " + "above copyright notice, this",
"ISC license": "ISC License",
"Apache Software License 2.0": "Licensed under the Apache License, Version 2.0",
"GNU General Public License v3": "GNU GENERAL PUBLIC LICENSE",
}
for license, target_string in license_strings.items():
- with bake_in_temp_dir(
- cookies, extra_context={"open_source_license": license}
- ) as result:
+ with bake_in_temp_dir(cookies, extra_context={"open_source_license": license}) as result:
assert target_string in result.project.join("LICENSE").read()
assert license in result.project.join("setup.py").read()
def test_bake_not_open_source(cookies):
- with bake_in_temp_dir(
- cookies, extra_context={"open_source_license": "Not open source"}
- ) as result:
+ with bake_in_temp_dir(cookies, extra_context={"open_source_license": "Not open source"}) as result:
found_toplevel_files = [f.basename for f in result.project.listdir()]
assert "setup.py" in found_toplevel_files
assert "LICENSE" not in found_toplevel_files
diff --git a/{{cookiecutter.hyphenated}}/.devcontainer/Dockerfile b/{{cookiecutter.hyphenated}}/.devcontainer/Dockerfile
new file mode 100644
index 0000000..9ba2f5a
--- /dev/null
+++ b/{{cookiecutter.hyphenated}}/.devcontainer/Dockerfile
@@ -0,0 +1,12 @@
+FROM mcr.microsoft.com/devcontainers/python:3
+
+RUN python -m pip install --upgrade pip \
+ && python -m pip install 'flit>=3.8.0'
+
+ENV FLIT_ROOT_INSTALL=1
+
+COPY pyproject.toml .
+RUN touch README.md \
+ && mkdir -p src/python_package \
+ && python -m flit install --only-deps --deps develop \
+ && rm -r pyproject.toml README.md src
diff --git a/{{cookiecutter.hyphenated}}/.devcontainer/devcontainer.json b/{{cookiecutter.hyphenated}}/.devcontainer/devcontainer.json
new file mode 100644
index 0000000..c4cf1ea
--- /dev/null
+++ b/{{cookiecutter.hyphenated}}/.devcontainer/devcontainer.json
@@ -0,0 +1,44 @@
+// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
+// https://github.com/microsoft/vscode-dev-containers/tree/v0.222.0/containers/python-3-miniconda
+{
+ "name": "Python Environment",
+ "build": {
+ "dockerfile": "Dockerfile",
+ "context": ".."
+ },
+ "customizations": {
+ "vscode": {
+ "extensions": [
+ "editorconfig.editorconfig",
+ "github.vscode-pull-request-github",
+ "ms-azuretools.vscode-docker",
+ "ms-python.python",
+ "ms-python.vscode-pylance",
+ "ms-python.pylint",
+ "ms-python.isort",
+ "ms-python.flake8",
+ "ms-python.black-formatter",
+ "ms-vsliveshare.vsliveshare",
+ "ryanluker.vscode-coverage-gutters",
+ "bungcip.better-toml",
+ "GitHub.copilot"
+ ],
+ "settings": {
+ "python.defaultInterpreterPath": "/usr/local/bin/python",
+ "black-formatter.path": [
+ "/usr/local/py-utils/bin/black"
+ ],
+ "pylint.path": [
+ "/usr/local/py-utils/bin/pylint"
+ ],
+ "flake8.path": [
+ "/usr/local/py-utils/bin/flake8"
+ ],
+ "isort.path": [
+ "/usr/local/py-utils/bin/isort"
+ ]
+ }
+ }
+ },
+ "onCreateCommand": "pre-commit install-hooks"
+}
diff --git a/{{cookiecutter.project_slug}}/.editorconfig b/{{cookiecutter.hyphenated}}/.editorconfig
similarity index 100%
rename from {{cookiecutter.project_slug}}/.editorconfig
rename to {{cookiecutter.hyphenated}}/.editorconfig
diff --git a/{{cookiecutter.hyphenated}}/.flake8 b/{{cookiecutter.hyphenated}}/.flake8
new file mode 100644
index 0000000..6deafc2
--- /dev/null
+++ b/{{cookiecutter.hyphenated}}/.flake8
@@ -0,0 +1,2 @@
+[flake8]
+max-line-length = 120
diff --git a/{{cookiecutter.project_slug}}/.github/ISSUE_TEMPLATE/bug_report.yaml b/{{cookiecutter.hyphenated}}/.github/ISSUE_TEMPLATE/bug_report.yaml
similarity index 100%
rename from {{cookiecutter.project_slug}}/.github/ISSUE_TEMPLATE/bug_report.yaml
rename to {{cookiecutter.hyphenated}}/.github/ISSUE_TEMPLATE/bug_report.yaml
diff --git a/{{cookiecutter.project_slug}}/.github/ISSUE_TEMPLATE/config.yml b/{{cookiecutter.hyphenated}}/.github/ISSUE_TEMPLATE/config.yml
similarity index 88%
rename from {{cookiecutter.project_slug}}/.github/ISSUE_TEMPLATE/config.yml
rename to {{cookiecutter.hyphenated}}/.github/ISSUE_TEMPLATE/config.yml
index 3c3c026..993e9a5 100644
--- a/{{cookiecutter.project_slug}}/.github/ISSUE_TEMPLATE/config.yml
+++ b/{{cookiecutter.hyphenated}}/.github/ISSUE_TEMPLATE/config.yml
@@ -2,10 +2,10 @@
blank_issues_enabled: false
contact_links:
- name: 📖 Contributing Policy
- url: https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}/blob/main/CONTRIBUTING.md
+ url: https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.hyphenated }}/blob/main/CONTRIBUTING.md
about: "Please read through our contributing policy before opening an issue or pull request."
- name: ❓ Discussion
- url: https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}/discussions
+ url: https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.hyphenated }}/discussions
about: "If you're just looking for help, try starting a discussion instead."
- name: 💬 Community Slack
url: https://netdev.chat
diff --git a/{{cookiecutter.project_slug}}/.github/ISSUE_TEMPLATE/feature_request.yaml b/{{cookiecutter.hyphenated}}/.github/ISSUE_TEMPLATE/feature_request.yaml
similarity index 100%
rename from {{cookiecutter.project_slug}}/.github/ISSUE_TEMPLATE/feature_request.yaml
rename to {{cookiecutter.hyphenated}}/.github/ISSUE_TEMPLATE/feature_request.yaml
diff --git a/{{cookiecutter.project_slug}}/.github/ISSUE_TEMPLATE/housekeeping.yaml b/{{cookiecutter.hyphenated}}/.github/ISSUE_TEMPLATE/housekeeping.yaml
similarity index 100%
rename from {{cookiecutter.project_slug}}/.github/ISSUE_TEMPLATE/housekeeping.yaml
rename to {{cookiecutter.hyphenated}}/.github/ISSUE_TEMPLATE/housekeeping.yaml
diff --git a/{{cookiecutter.project_slug}}/.github/workflows/mkdocs.yml b/{{cookiecutter.hyphenated}}/.github/workflows/mkdocs.yaml
similarity index 100%
rename from {{cookiecutter.project_slug}}/.github/workflows/mkdocs.yml
rename to {{cookiecutter.hyphenated}}/.github/workflows/mkdocs.yaml
diff --git a/{{cookiecutter.hyphenated}}/.github/workflows/publish-pypi.yaml b/{{cookiecutter.hyphenated}}/.github/workflows/publish-pypi.yaml
new file mode 100644
index 0000000..15bfe39
--- /dev/null
+++ b/{{cookiecutter.hyphenated}}/.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/{{ cookiecutter.hyphenated }}
+ 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/{{cookiecutter.project_slug}}/.github/workflows/publish-pypi.yml b/{{cookiecutter.hyphenated}}/.github/workflows/publish-pypi.yml
similarity index 100%
rename from {{cookiecutter.project_slug}}/.github/workflows/publish-pypi.yml
rename to {{cookiecutter.hyphenated}}/.github/workflows/publish-pypi.yml
diff --git a/{{cookiecutter.hyphenated}}/.gitignore b/{{cookiecutter.hyphenated}}/.gitignore
new file mode 100644
index 0000000..fa871cf
--- /dev/null
+++ b/{{cookiecutter.hyphenated}}/.gitignore
@@ -0,0 +1,279 @@
+# 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]
+*$py.class
+
+# C extensions
+*.so
+
+# Distribution / packaging
+.Python
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+.eggs/
+lib/
+lib64/
+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
+# before PyInstaller builds the exe, so as to inject date/other infos into it.
+*.manifest
+*.spec
+
+# Installer logs
+pip-log.txt
+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
+*.pot
+
+# Django stuff:
+*.log
+local_settings.py
+db.sqlite3
+db.sqlite3-journal
+
+# Flask stuff:
+instance/
+.webassets-cache
+
+# Scrapy stuff:
+.scrapy
+
+# Sphinx documentation
+docs/_build/
+
+# PyBuilder
+.pybuilder/
+target/
+
+# Jupyter Notebook
+.ipynb_checkpoints
+
+# IPython
+profile_default/
+ipython_config.py
+
+# pyenv
+# 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
+
+# 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
+
+# Environments
+.env
+.venv
+env/
+venv/
+ENV/
+env.bak/
+venv.bak/
+
+# Spyder project settings
+.spyderproject
+.spyproject
+
+# Rope project settings
+.ropeproject
+
+# mkdocs documentation
+/site
+
+# mypy
+.mypy_cache/
+.dmypy.json
+dmypy.json
+
+# Pyre type checker
+.pyre/
+
+# pytype static type analyzer
+.pytype/
+
+# Cython debug symbols
+cython_debug/
diff --git a/{{cookiecutter.hyphenated}}/.pre-commit-config.yaml b/{{cookiecutter.hyphenated}}/.pre-commit-config.yaml
new file mode 100644
index 0000000..da4e9c6
--- /dev/null
+++ b/{{cookiecutter.hyphenated}}/.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/{{cookiecutter.project_slug}}/.pypirc b/{{cookiecutter.hyphenated}}/.pypirc
similarity index 100%
rename from {{cookiecutter.project_slug}}/.pypirc
rename to {{cookiecutter.hyphenated}}/.pypirc
diff --git a/{{cookiecutter.project_slug}}/CHANGELOG.md b/{{cookiecutter.hyphenated}}/CHANGELOG.md
similarity index 100%
rename from {{cookiecutter.project_slug}}/CHANGELOG.md
rename to {{cookiecutter.hyphenated}}/CHANGELOG.md
diff --git a/{{cookiecutter.project_slug}}/CODE_OF_CONDUCT.md b/{{cookiecutter.hyphenated}}/CODE_OF_CONDUCT.md
similarity index 100%
rename from {{cookiecutter.project_slug}}/CODE_OF_CONDUCT.md
rename to {{cookiecutter.hyphenated}}/CODE_OF_CONDUCT.md
diff --git a/{{cookiecutter.project_slug}}/CONTRIBUTING.md b/{{cookiecutter.hyphenated}}/CONTRIBUTING.md
similarity index 90%
rename from {{cookiecutter.project_slug}}/CONTRIBUTING.md
rename to {{cookiecutter.hyphenated}}/CONTRIBUTING.md
index ec3ee3c..560d22e 100644
--- a/{{cookiecutter.project_slug}}/CONTRIBUTING.md
+++ b/{{cookiecutter.hyphenated}}/CONTRIBUTING.md
@@ -23,7 +23,7 @@ We love your input! We want to make contributing to this project as easy and tra
### Report Bugs
-Report bugs at https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}/issues.
+Report bugs at https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.hyphenated }}/issues.
If you are reporting a bug, please include:
@@ -49,7 +49,7 @@ articles, and such.
### Submit Feedback
-The best way to send feedback is to file an issue at https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}/issues.
+The best way to send feedback is to file an issue at https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.hyphenated }}/issues.
If you are proposing a feature:
@@ -60,13 +60,13 @@ If you are proposing a feature:
## Get Started!
-Ready to contribute? Here's how to set up `{{ cookiecutter.project_slug }}` for local development.
+Ready to contribute? Here's how to set up `{{ cookiecutter.hyphenated }}` for local development.
-1. Fork the `{{ cookiecutter.project_slug }}` repo on GitHub.
+1. Fork the `{{ cookiecutter.hyphenated }}` repo on GitHub.
2. Clone your fork locally
```
- $ git clone git@github.com:your_name_here/{{ cookiecutter.project_slug }}.git
+ $ git clone git@github.com:your_name_here/{{ cookiecutter.hyphenated }}.git
```
3. Install dependencies and start your virtualenv:
@@ -109,7 +109,7 @@ Before you submit a pull request, check that it meets these guidelines:
your new functionality into a function with a docstring, and add the
feature to the list in README.md.
3. The pull request should work for Python 3.6, 3.7, 3.8 and 3.9. Check
- https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}/actions
+ https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.hyphenated }}/actions
and make sure that the tests pass for all supported Python versions.
diff --git a/{{cookiecutter.hyphenated}}/LICENSE b/{{cookiecutter.hyphenated}}/LICENSE
new file mode 100644
index 0000000..43967b6
--- /dev/null
+++ b/{{cookiecutter.hyphenated}}/LICENSE
@@ -0,0 +1,245 @@
+{% if cookiecutter.open_source_license == 'MIT' %}
+The MIT License (MIT)
+Copyright (c) {% now 'utc', '%Y' %}, {{ cookiecutter.full_name }}
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+{%- elif cookiecutter.open_source_license == 'BSD' %}
+Copyright (c) {% now 'utc', '%Y' %}, {{ cookiecutter.full_name }}
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice, this
+ list of conditions and the following disclaimer in the documentation and/or
+ other materials provided with the distribution.
+
+* Neither the name of {{ cookiecutter.project_name }} nor the names of its
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+OF THE POSSIBILITY OF SUCH DAMAGE.
+{%- elif cookiecutter.open_source_license == 'GPLv3' %}
+Copyright (c) {% now 'utc', '%Y' %}, {{ cookiecutter.full_name }}
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+{%- elif cookiecutter.open_source_license == 'Apache Software License 2.0' %}
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ Copyright {% now 'utc', '%Y' %} {{ cookiecutter.full_name }}
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+{%- endif %}
diff --git a/{{cookiecutter.project_slug}}/MANIFEST.in b/{{cookiecutter.hyphenated}}/MANIFEST.in
similarity index 92%
rename from {{cookiecutter.project_slug}}/MANIFEST.in
rename to {{cookiecutter.hyphenated}}/MANIFEST.in
index ca948a2..fc5d3a7 100644
--- a/{{cookiecutter.project_slug}}/MANIFEST.in
+++ b/{{cookiecutter.hyphenated}}/MANIFEST.in
@@ -7,3 +7,5 @@ recursive-exclude * __pycache__
recursive-exclude * *.py[co]
recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif
+
+graft templates
diff --git a/{{cookiecutter.project_slug}}/Makefile b/{{cookiecutter.hyphenated}}/Makefile
similarity index 100%
rename from {{cookiecutter.project_slug}}/Makefile
rename to {{cookiecutter.hyphenated}}/Makefile
diff --git a/{{cookiecutter.project_slug}}/README.md b/{{cookiecutter.hyphenated}}/README.md
similarity index 87%
rename from {{cookiecutter.project_slug}}/README.md
rename to {{cookiecutter.hyphenated}}/README.md
index 754aff5..d4af01c 100644
--- a/{{cookiecutter.project_slug}}/README.md
+++ b/{{cookiecutter.hyphenated}}/README.md
@@ -5,7 +5,7 @@
{% if is_open_source %}
* Free software: {{ cookiecutter.open_source_license }}
-* Documentation: https://{{ cookiecutter.github_username }}.github.io/{{ cookiecutter.project_slug | replace("_", "-") }}/
+* Documentation: https://{{ cookiecutter.github_username }}.github.io/{{ cookiecutter.hyphenated | replace("_", "-") }}/
{% endif %}
## Features
@@ -16,7 +16,7 @@ The features the plugin provides should be listed here.
| NetBox Version | Plugin Version |
|----------------|----------------|
-| 3.4 | 0.1.0 |
+| 3.7 | 0.1.0 |
## Installing
@@ -26,13 +26,13 @@ For adding to a NetBox Docker setup see
While this is still in development and not yet on pypi you can install with pip:
```bash
-pip install git+https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}
+pip install git+https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.hyphenated }}
```
or by adding to your `local_requirements.txt` or `plugin_requirements.txt` (netbox-docker):
```bash
-git+https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}
+git+https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.hyphenated }}
```
Enable the plugin in `/opt/netbox/netbox/netbox/configuration.py`,
@@ -40,11 +40,11 @@ Enable the plugin in `/opt/netbox/netbox/netbox/configuration.py`,
```python
PLUGINS = [
- '{{ cookiecutter.plugin_name }}'
+ '{{ cookiecutter.hyphenated }}'
]
PLUGINS_CONFIG = {
- "{{ cookiecutter.plugin_name }}": {},
+ "{{ cookiecutter.hyphenated }}": {},
}
```
diff --git a/{{cookiecutter.project_slug}}/docs/changelog.md b/{{cookiecutter.hyphenated}}/docs/changelog.md
similarity index 100%
rename from {{cookiecutter.project_slug}}/docs/changelog.md
rename to {{cookiecutter.hyphenated}}/docs/changelog.md
diff --git a/{{cookiecutter.project_slug}}/docs/contributing.md b/{{cookiecutter.hyphenated}}/docs/contributing.md
similarity index 100%
rename from {{cookiecutter.project_slug}}/docs/contributing.md
rename to {{cookiecutter.hyphenated}}/docs/contributing.md
diff --git a/{{cookiecutter.project_slug}}/docs/index.md b/{{cookiecutter.hyphenated}}/docs/index.md
similarity index 100%
rename from {{cookiecutter.project_slug}}/docs/index.md
rename to {{cookiecutter.hyphenated}}/docs/index.md
diff --git a/{{cookiecutter.project_slug}}/mkdocs.yml b/{{cookiecutter.hyphenated}}/mkdocs.yml
similarity index 90%
rename from {{cookiecutter.project_slug}}/mkdocs.yml
rename to {{cookiecutter.hyphenated}}/mkdocs.yml
index 5197a4e..93871d6 100644
--- a/{{cookiecutter.project_slug}}/mkdocs.yml
+++ b/{{cookiecutter.hyphenated}}/mkdocs.yml
@@ -1,7 +1,7 @@
site_name: {{ cookiecutter.project_name }}
-site_url: https://{{ cookiecutter.github_username }}.github.io/{{ cookiecutter.project_slug }}
-repo_url: https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}
-repo_name: {{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}
+site_url: https://{{ cookiecutter.github_username }}.github.io/{{ cookiecutter.hyphenated }}
+repo_url: https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.hyphenated }}
+repo_name: {{ cookiecutter.github_username }}/{{ cookiecutter.hyphenated }}
#strict: true
nav:
- Home: index.md
@@ -49,7 +49,7 @@ plugins:
lang: en
- mkdocstrings:
watch:
- - {{ cookiecutter.project_slug }}
+ - {{ cookiecutter.hyphenated }}
extra:
social:
- icon: fontawesome/brands/twitter
@@ -61,7 +61,7 @@ extra:
link: https://github.com/netbox-community/cookiecutter-netbox-plugin
name: Facebook
- icon: fontawesome/brands/github
- link: https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}
+ link: https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.underscored }}
name: Github
- icon: material/email
link: "mailto:{{ cookiecutter.email }}"
diff --git a/{{cookiecutter.project_slug}}/pyproject.toml b/{{cookiecutter.hyphenated}}/pyproject.toml
similarity index 55%
rename from {{cookiecutter.project_slug}}/pyproject.toml
rename to {{cookiecutter.hyphenated}}/pyproject.toml
index 2071153..d781614 100644
--- a/{{cookiecutter.project_slug}}/pyproject.toml
+++ b/{{cookiecutter.hyphenated}}/pyproject.toml
@@ -2,10 +2,12 @@
# https://www.python.org/dev/peps/pep-0518/
[build-system]
-requires = ["setuptools>=63.2.0", "wheel", "setuptools_scm[toml]>=8.0"]
+requires = ["setuptools"]
+build-backend = "setuptools.build_meta"
[project]
-name = "{{ cookiecutter.project_slug }}"
+name = "{{ cookiecutter.hyphenated }}"
+version = "{{ cookiecutter.version }}"
authors = [
{name = "{{ cookiecutter.full_name.replace('\"', '\\\"') }}", email = "{{ cookiecutter.email }}"},
]
@@ -28,79 +30,32 @@ classifiers=[
{%- endif %}
'Natural Language :: English',
"Programming Language :: Python :: 3 :: Only",
- 'Programming Language :: Python :: 3.8',
'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"
-dynamic = ["version"]
[project.optional-dependencies]
test = [
- "bandit[toml]==1.7.5",
- "black==23.3.0",
+ "black==24.3.0",
"check-manifest==0.49",
- "flake8-bugbear==23.5.9",
"flake8",
"flake8-pyproject",
- "pre-commit==3.3.1",
- "pylint==2.17.4",
- "pytest-mock<3.10.1",
- "pytest-runner",
- "pytest==7.3.1",
- "pytest-github-actions-annotate-failures",
- "shellcheck-py==0.9.0.2"
+ "pre-commit==3.7.0",
+ "pytest==8.1.1",
]
[project.urls]
-Documentation = "https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}/blob/main/README.md"
-Source = "https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}"
-Tracker = "https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}/issues"
-
-[tool.bandit]
-exclude_dirs = ["build","dist","tests","scripts","docs"]
-number = 4
-recursive = true
-targets = "{{ cookiecutter.project_slug }}"
+Documentation = "https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.hyphenated }}/blob/main/README.md"
+Source = "https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.hyphenated }}"
+Tracker = "https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.hyphenated }}/issues"
[tool.black]
line-length = 120
-target_version = ['py38', 'py39', 'py310', 'py311']
-
-[tool.isort]
-profile = "black"
-
-[tool.pylint]
-max-line-length = 120
+target_version = ['py39', 'py310', 'py311', 'py312']
-[tool.flake8]
-max-line-length = 120
-exclude = [
- ".eggs",
- ".venv",
- ".tox",
- ".mypy_cache",
- ".pytest_cache",
- ".vscode",
- ".github",
- ".git",
- "dist",
- "docs",
- "tests",
-]
-ignore = [
- "E722",
- "B001",
- "W503",
- "E203",
- "D100", # These are all for ignoring missing docstring
- "D101",
- "D102",
- "D103",
- "D104",
- "D105",
- "D106",
- "F401" # unused import
-]
+[tool.setuptools.package-data]
+{{ cookiecutter.underscored }} = ["templates/**"]
diff --git a/{{cookiecutter.hyphenated}}/requirements_dev.txt b/{{cookiecutter.hyphenated}}/requirements_dev.txt
new file mode 100644
index 0000000..24f595e
--- /dev/null
+++ b/{{cookiecutter.hyphenated}}/requirements_dev.txt
@@ -0,0 +1,4 @@
+black==24.3.0
+flake8==7.0.0
+pip==24.0
+check-manifest==0.49
diff --git a/{{cookiecutter.hyphenated}}/tests/__init__.py b/{{cookiecutter.hyphenated}}/tests/__init__.py
new file mode 100644
index 0000000..994dd8b
--- /dev/null
+++ b/{{cookiecutter.hyphenated}}/tests/__init__.py
@@ -0,0 +1 @@
+"""Unit test package for {{ cookiecutter.underscored }}."""
diff --git a/{{cookiecutter.hyphenated}}/tests/test_{{cookiecutter.underscored}}.py b/{{cookiecutter.hyphenated}}/tests/test_{{cookiecutter.underscored}}.py
new file mode 100644
index 0000000..b978b37
--- /dev/null
+++ b/{{cookiecutter.hyphenated}}/tests/test_{{cookiecutter.underscored}}.py
@@ -0,0 +1,5 @@
+#!/usr/bin/env python
+
+"""Tests for `{{ cookiecutter.underscored }}` package."""
+
+from {{ cookiecutter.underscored }} import {{ cookiecutter.underscored }}
diff --git a/{{cookiecutter.hyphenated}}/{{cookiecutter.underscored}}/__init__.py b/{{cookiecutter.hyphenated}}/{{cookiecutter.underscored}}/__init__.py
new file mode 100644
index 0000000..77cb20f
--- /dev/null
+++ b/{{cookiecutter.hyphenated}}/{{cookiecutter.underscored}}/__init__.py
@@ -0,0 +1,19 @@
+"""Top-level package for {{ cookiecutter.project_name }}."""
+
+__author__ = """{{ cookiecutter.full_name }}"""
+__email__ = "{{ cookiecutter.email }}"
+__version__ = "{{ cookiecutter.version }}"
+
+
+from extras.plugins import PluginConfig
+
+
+class {{ cookiecutter.__model_name }}Config(PluginConfig):
+ name = "{{ cookiecutter.underscored }}"
+ verbose_name = "{{ cookiecutter.project_name }}"
+ description = "{{ cookiecutter.project_short_description }}"
+ version = "version"
+ base_url = "{{ cookiecutter.underscored }}"
+
+
+config = {{ cookiecutter.__model_name }}Config
diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/filtersets.py b/{{cookiecutter.hyphenated}}/{{cookiecutter.underscored}}/filtersets.py
similarity index 100%
rename from {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/filtersets.py
rename to {{cookiecutter.hyphenated}}/{{cookiecutter.underscored}}/filtersets.py
diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/forms.py b/{{cookiecutter.hyphenated}}/{{cookiecutter.underscored}}/forms.py
similarity index 100%
rename from {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/forms.py
rename to {{cookiecutter.hyphenated}}/{{cookiecutter.underscored}}/forms.py
diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/models.py b/{{cookiecutter.hyphenated}}/{{cookiecutter.underscored}}/models.py
similarity index 73%
rename from {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/models.py
rename to {{cookiecutter.hyphenated}}/{{cookiecutter.underscored}}/models.py
index d4af3fd..24524f9 100644
--- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/models.py
+++ b/{{cookiecutter.hyphenated}}/{{cookiecutter.underscored}}/models.py
@@ -13,4 +13,4 @@ def __str__(self):
return self.name
def get_absolute_url(self):
- return reverse("plugins:{{ cookiecutter.project_slug }}:{{ cookiecutter.__model_name|lower }}", args=[self.pk])
+ return reverse("plugins:{{ cookiecutter.underscored }}:{{ cookiecutter.__model_name|lower }}", args=[self.pk])
diff --git a/{{cookiecutter.hyphenated}}/{{cookiecutter.underscored}}/navigation.py b/{{cookiecutter.hyphenated}}/{{cookiecutter.underscored}}/navigation.py
new file mode 100644
index 0000000..eb12024
--- /dev/null
+++ b/{{cookiecutter.hyphenated}}/{{cookiecutter.underscored}}/navigation.py
@@ -0,0 +1,19 @@
+from extras.plugins import PluginMenuButton, PluginMenuItem
+from utilities.choices import ButtonColorChoices
+
+plugin_buttons = [
+ PluginMenuButton(
+ link="plugins:{{ cookiecutter.underscored }}:{{ cookiecutter.__model_url_name }}_add",
+ title="Add",
+ icon_class="mdi mdi-plus-thick",
+ color=ButtonColorChoices.GREEN,
+ )
+]
+
+menu_items = (
+ PluginMenuItem(
+ link="plugins:{{ cookiecutter.underscored }}:{{ cookiecutter.__model_url_name }}_list",
+ link_text="{{ cookiecutter.plugin_name }}",
+ buttons=plugin_buttons,
+ ),
+)
diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/tables.py b/{{cookiecutter.hyphenated}}/{{cookiecutter.underscored}}/tables.py
similarity index 100%
rename from {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/tables.py
rename to {{cookiecutter.hyphenated}}/{{cookiecutter.underscored}}/tables.py
diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/{{cookiecutter.project_slug}}/{{cookiecutter.__model_url}}.html b/{{cookiecutter.hyphenated}}/{{cookiecutter.underscored}}/templates/{{cookiecutter.underscored}}/{{cookiecutter.__model_url}}.html
similarity index 100%
rename from {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/{{cookiecutter.project_slug}}/{{cookiecutter.__model_url}}.html
rename to {{cookiecutter.hyphenated}}/{{cookiecutter.underscored}}/templates/{{cookiecutter.underscored}}/{{cookiecutter.__model_url}}.html
diff --git a/{{cookiecutter.hyphenated}}/{{cookiecutter.underscored}}/urls.py b/{{cookiecutter.hyphenated}}/{{cookiecutter.underscored}}/urls.py
new file mode 100644
index 0000000..59c5947
--- /dev/null
+++ b/{{cookiecutter.hyphenated}}/{{cookiecutter.underscored}}/urls.py
@@ -0,0 +1,19 @@
+from django.urls import path
+from netbox.views.generic import ObjectChangeLogView
+
+from . import models, views
+
+
+urlpatterns = (
+ path("{{ cookiecutter.__model_url }}s/", views.{{ cookiecutter.__model_name }}ListView.as_view(), name="{{ cookiecutter.__model_url_name }}_list"),
+ path("{{ cookiecutter.__model_url }}s/add/", views.{{ cookiecutter.__model_name }}EditView.as_view(), name="{{ cookiecutter.__model_url_name }}_add"),
+ path("{{ cookiecutter.__model_url }}s//", views.{{ cookiecutter.__model_name }}View.as_view(), name="{{ cookiecutter.__model_url_name }}"),
+ path("{{ cookiecutter.__model_url }}s//edit/", views.{{ cookiecutter.__model_name }}EditView.as_view(), name="{{ cookiecutter.__model_url_name }}_edit"),
+ path("{{ cookiecutter.__model_url }}s//delete/", views.{{ cookiecutter.__model_name }}DeleteView.as_view(), name="{{ cookiecutter.__model_url_name }}_delete"),
+ path(
+ "{{ cookiecutter.__model_url }}s//changelog/",
+ ObjectChangeLogView.as_view(),
+ name="{{ cookiecutter.__model_url_name }}_changelog",
+ kwargs={"model": models.{{ cookiecutter.__model_name }}},
+ ),
+)
diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/views.py b/{{cookiecutter.hyphenated}}/{{cookiecutter.underscored}}/views.py
similarity index 100%
rename from {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/views.py
rename to {{cookiecutter.hyphenated}}/{{cookiecutter.underscored}}/views.py
diff --git a/{{cookiecutter.project_slug}}/.pre-commit-config.yaml b/{{cookiecutter.project_slug}}/.pre-commit-config.yaml
deleted file mode 100644
index 47d6177..0000000
--- a/{{cookiecutter.project_slug}}/.pre-commit-config.yaml
+++ /dev/null
@@ -1,64 +0,0 @@
-ci:
- autoupdate_commit_msg: "chore: update pre-commit hooks"
- autofix_commit_msg: "style: pre-commit fixes"
-
-repos:
- - repo: https://github.com/pre-commit/pre-commit-hooks
- rev: v4.1.0
- hooks:
- - id: check-added-large-files
- - id: check-case-conflict
- - id: check-merge-conflict
- - id: check-symlinks
- - id: debug-statements
- - id: end-of-file-fixer
- - id: mixed-line-ending
- - id: requirements-txt-fixer
- - id: trailing-whitespace
-
- - repo: https://github.com/psf/black-pre-commit-mirror
- rev: 23.9.1
- hooks:
- - id: black
- # It is recommended to specify the latest version of Python
- # supported by your project here, or alternatively use
- # pre-commit's default_language_version, see
- # https://pre-commit.com/#top_level-default_language_version
- language_version: python3.11
-
- - repo: https://github.com/PyCQA/isort
- rev: 5.12.0
- hooks:
- - id: isort
-
- - repo: https://github.com/pycqa/flake8
- rev: '6.1.0'
- hooks:
- - id: flake8
- additional_dependencies: [
- 'flake8-bugbear==23.9.16',
- 'flake8-pyproject==1.2.3',
- ]
-
- - repo: https://github.com/pre-commit/pygrep-hooks
- rev: v1.9.0
- hooks:
- - id: python-check-blanket-noqa
- - id: python-check-blanket-type-ignore
- - id: python-no-log-warn
- - id: python-no-eval
- - id: python-use-type-annotations
- - id: rst-backticks
- - id: rst-directive-colons
- - id: rst-inline-touching-normal
-
- - repo: https://github.com/mgedmin/check-manifest
- rev: "0.47"
- hooks:
- - id: check-manifest
- stages: [manual]
-
- - repo: https://github.com/PyCQA/bandit
- rev: '1.7.5'
- hooks:
- - id: bandit
diff --git a/{{cookiecutter.project_slug}}/tests/__init__.py b/{{cookiecutter.project_slug}}/tests/__init__.py
deleted file mode 100644
index 79b42da..0000000
--- a/{{cookiecutter.project_slug}}/tests/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-"""Unit test package for {{ cookiecutter.project_slug }}."""