-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor - better underscore / hyphenated handling, pypi publish work…
…flow (#17)
- Loading branch information
Showing
50 changed files
with
796 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[flake8] | ||
max-line-length = 120 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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": "[email protected]", | ||
"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"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 = "[email protected]"}, | ||
] | ||
|
@@ -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'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
44 changes: 44 additions & 0 deletions
44
{{cookiecutter.hyphenated}}/.devcontainer/devcontainer.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[flake8] | ||
max-line-length = 120 |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
51 changes: 51 additions & 0 deletions
51
{{cookiecutter.hyphenated}}/.github/workflows/publish-pypi.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/[email protected] | ||
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 |
File renamed without changes.
Oops, something went wrong.