Skip to content

Commit 8ec746d

Browse files
committed
Cookie initially baked targeting develop by NetworkToCode Cookie Drift Manager Tool
Template: ``` { "template": "https://github.com/networktocode-llc/cookiecutter-ntc.git", "dir": "python", "ref": "main", "path": null } ``` Cookie: ``` { "remote": "https://github.com/networktocode/pyntc.git", "path": "/Users/jeffkala/Documents/GitHub/outputs/pyntc", "repository_path": "/Users/jeffkala/Documents/GitHub/outputs/pyntc", "dir": "", "branch_prefix": "drift-manager/develop", "context": { "codeowner_github_usernames": "@jeffkala @pszulczewski @pke11y", "full_name": "Network to Code, LLC", "email": "info@networktocode.com", "github_org": "networktocode", "description": "Python library focused on tasks related to device level and OS management.", "project_name": "pyntc", "project_slug": "pyntc", "repo_url": "https://github.com/networktocode/pyntc", "base_url": "pyntc", "project_python_name": "pyntc", "project_python_base_version": "3.10", "project_with_config_settings": "no", "generate_docs": "no", "version": "2.0.2", "original_publish_year": "2016", "_template": "https://github.com/networktocode-llc/cookiecutter-ntc.git", "_output_dir": "/Users/jeffkala/Documents/GitHub/outputs", "_repo_dir": "/Users/jeffkala/.cookiecutters/cookiecutter-ntc/python", "_checkout": "main" }, "drift_managed_branch": "develop", "remote_name": "origin", "pull_request_strategy": "PullRequestStrategy.CREATE", "post_actions": [], "baked_commit_ref": "", "draft": false } ``` CLI Arguments: ``` { "cookie_dir": "", "input": true, "json_filename": "", "output_dir": "../outputs", "push": true, "template": "https://github.com/networktocode-llc/cookiecutter-ntc.git", "template_dir": "python", "template_ref": "main", "pull_request": null, "post_action": [], "disable_post_actions": false, "draft": null, "drift_managed_branch": "develop" } ```
1 parent 848377c commit 8ec746d

28 files changed

Lines changed: 895 additions & 3 deletions

.cookiecutter.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"cookiecutter": {
3+
"codeowner_github_usernames": "@jeffkala @pszulczewski @pke11y",
4+
"full_name": "Network to Code, LLC",
5+
"email": "info@networktocode.com",
6+
"github_org": "networktocode",
7+
"description": "Python library focused on tasks related to device level and OS management.",
8+
"project_name": "pyntc",
9+
"project_slug": "pyntc",
10+
"repo_url": "https://github.com/networktocode/pyntc",
11+
"base_url": "pyntc",
12+
"project_python_name": "pyntc",
13+
"project_python_base_version": "3.10",
14+
"project_with_config_settings": "no",
15+
"generate_docs": "no",
16+
"version": "2.0.2",
17+
"original_publish_year": "2016",
18+
"_drift_manager": {
19+
"template": "https://github.com/networktocode-llc/cookiecutter-ntc.git",
20+
"template_dir": "python",
21+
"template_ref": "main",
22+
"cookie_dir": "",
23+
"pull_request_strategy": "create",
24+
"post_actions": [],
25+
"draft": false,
26+
"baked_commit_ref": "a5add2662f26a3b877635bbf1fd787682414d2bf",
27+
"drift_managed_branch": "develop"
28+
}
29+
}
30+
}

.github/CODEOWNERS

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
# Default owner(s) of all files in this repository
2-
* @jeffkala @pszulczewski @pke11y
2+
<<<<<<< HEAD
3+
* @jeffkala @pszulczewski @pke11y
4+
=======
5+
* @jeffkala @pszulczewski @pke11y
6+
>>>>>>> 2122990 (Cookie initially baked targeting develop by NetworkToCode Cookie Drift Manager Tool)

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@ about: Report a reproducible bug in the current release of pyntc
44
---
55

66
### Environment
7+
<<<<<<< HEAD
78
* Python version: <!-- Example: 3.11.2 -->
89
* pyntc version: <!-- Example: 2.0.2 -->
10+
=======
11+
* Python version: <!-- Example: 3.10 -->
12+
* pyntc version: <!-- Example: 1.0.0 -->
13+
>>>>>>> 2122990 (Cookie initially baked targeting develop by NetworkToCode Cookie Drift Manager Tool)
914
1015
<!-- What did you expect to happen? -->
1116
### Expected Behavior

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ about: Propose a new feature or enhancement
55
---
66

77
### Environment
8+
<<<<<<< HEAD
89
* pyntc version: <!-- Example: 2.0.2 -->
10+
=======
11+
* pyntc version: <!-- Example: 1.0.0 -->
12+
>>>>>>> 2122990 (Cookie initially baked targeting develop by NetworkToCode Cookie Drift Manager Tool)
913
1014
<!--
1115
Describe in detail the new functionality you are proposing.

.github/workflows/ci.yml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ on: # yamllint disable-line rule:truthy rule:comments
88
branches:
99
- "main"
1010
- "develop"
11+
<<<<<<< HEAD
1112
tags:
1213
- "v*"
14+
=======
15+
>>>>>>> 2122990 (Cookie initially baked targeting develop by NetworkToCode Cookie Drift Manager Tool)
1316
pull_request: ~
1417

1518
env:
@@ -18,7 +21,11 @@ env:
1821

1922
jobs:
2023
ruff-format:
24+
<<<<<<< HEAD
2125
runs-on: "ubuntu-24.04"
26+
=======
27+
runs-on: "ubuntu-latest"
28+
>>>>>>> 2122990 (Cookie initially baked targeting develop by NetworkToCode Cookie Drift Manager Tool)
2229
env:
2330
INVOKE_PYNTC_LOCAL: "True"
2431
steps:
@@ -27,11 +34,19 @@ jobs:
2734
- name: "Setup environment"
2835
uses: "networktocode/gh-action-setup-poetry-environment@v6"
2936
with:
37+
<<<<<<< HEAD
3038
poetry-version: "1.8.5"
3139
- name: "Linting: ruff format"
3240
run: "poetry run invoke ruff --action format"
3341
ruff-lint:
3442
runs-on: "ubuntu-24.04"
43+
=======
44+
poetry-version: "2.1.3"
45+
- name: "Linting: ruff format"
46+
run: "poetry run invoke ruff --action format"
47+
ruff-lint:
48+
runs-on: "ubuntu-latest"
49+
>>>>>>> 2122990 (Cookie initially baked targeting develop by NetworkToCode Cookie Drift Manager Tool)
3550
env:
3651
INVOKE_PYNTC_LOCAL: "True"
3752
steps:
@@ -40,6 +55,7 @@ jobs:
4055
- name: "Setup environment"
4156
uses: "networktocode/gh-action-setup-poetry-environment@v6"
4257
with:
58+
<<<<<<< HEAD
4359
poetry-version: "1.8.5"
4460
- name: "Linting: ruff"
4561
run: "poetry run invoke ruff --action lint"
@@ -59,6 +75,27 @@ jobs:
5975
# run: "poetry run invoke build-and-check-docs"
6076
poetry:
6177
runs-on: "ubuntu-24.04"
78+
=======
79+
poetry-version: "2.1.3"
80+
- name: "Linting: ruff"
81+
run: "poetry run invoke ruff --action lint"
82+
check-docs-build:
83+
runs-on: "ubuntu-latest"
84+
env:
85+
INVOKE_PYNTC_LOCAL: "True"
86+
steps:
87+
- name: "Check out repository code"
88+
uses: "actions/checkout@v4"
89+
- name: "Setup environment"
90+
uses: "networktocode/gh-action-setup-poetry-environment@v6"
91+
with:
92+
poetry-version: "2.1.3"
93+
poetry-install-options: "--only dev,docs"
94+
- name: "Check Docs Build"
95+
run: "poetry run invoke build-and-check-docs"
96+
poetry:
97+
runs-on: "ubuntu-latest"
98+
>>>>>>> 2122990 (Cookie initially baked targeting develop by NetworkToCode Cookie Drift Manager Tool)
6299
env:
63100
INVOKE_PYNTC_LOCAL: "True"
64101
steps:
@@ -67,6 +104,7 @@ jobs:
67104
- name: "Setup environment"
68105
uses: "networktocode/gh-action-setup-poetry-environment@v6"
69106
with:
107+
<<<<<<< HEAD
70108
poetry-version: "1.8.5"
71109
- name: "Checking: poetry lock file"
72110
run: "poetry lock --check"
@@ -76,6 +114,13 @@ jobs:
76114
- "yamllint"
77115
yamllint:
78116
runs-on: "ubuntu-24.04"
117+
=======
118+
poetry-version: "2.1.3"
119+
- name: "Checking: poetry lock file"
120+
run: "poetry run invoke lock --check"
121+
yamllint:
122+
runs-on: "ubuntu-latest"
123+
>>>>>>> 2122990 (Cookie initially baked targeting develop by NetworkToCode Cookie Drift Manager Tool)
79124
env:
80125
INVOKE_PYNTC_LOCAL: "True"
81126
steps:
@@ -84,6 +129,7 @@ jobs:
84129
- name: "Setup environment"
85130
uses: "networktocode/gh-action-setup-poetry-environment@v6"
86131
with:
132+
<<<<<<< HEAD
87133
poetry-version: "1.8.5"
88134
- name: "Linting: yamllint"
89135
run: "poetry run invoke yamllint"
@@ -98,13 +144,38 @@ jobs:
98144
python-version: ["3.9", "3.10", "3.11", "3.12"]
99145
env:
100146
PYTHON_VER: "${{ matrix.python-version }}"
147+
=======
148+
poetry-version: "2.1.3"
149+
- name: "Linting: yamllint"
150+
run: "poetry run invoke yamllint"
151+
check-in-docker:
152+
needs:
153+
- "ruff-format"
154+
- "ruff-lint"
155+
- "poetry"
156+
- "yamllint"
157+
runs-on: "ubuntu-latest"
158+
strategy:
159+
fail-fast: true
160+
matrix:
161+
python-version: ["3.10", "3.13"]
162+
env:
163+
INVOKE_PYNTC_PYTHON_VER: "${{ matrix.python-version }}"
164+
>>>>>>> 2122990 (Cookie initially baked targeting develop by NetworkToCode Cookie Drift Manager Tool)
101165
steps:
102166
- name: "Check out repository code"
103167
uses: "actions/checkout@v4"
104168
- name: "Setup environment"
105169
uses: "networktocode/gh-action-setup-poetry-environment@v6"
170+
<<<<<<< HEAD
106171
- name: "Get image version"
107172
run: "echo INVOKE_PYNTC_IMAGE_VER=`poetry version -s`-py${{ matrix.python-version }} >> $GITHUB_ENV"
173+
=======
174+
with:
175+
poetry-version: "2.1.3"
176+
- name: "Get image version"
177+
run: "echo INVOKE_PYNTC_IMAGE_VER=`poetry version -s`-py$${{ matrix.python-version }} >> $GITHUB_ENV"
178+
>>>>>>> 2122990 (Cookie initially baked targeting develop by NetworkToCode Cookie Drift Manager Tool)
108179
- name: "Set up Docker Buildx"
109180
id: "buildx"
110181
uses: "docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2" # v3.10.0
@@ -121,6 +192,7 @@ jobs:
121192
cache-to: "type=gha,scope=${{ env.INVOKE_PYNTC_IMAGE_NAME }}-${{ env.INVOKE_PYNTC_IMAGE_VER }}-py${{ matrix.python-version }}"
122193
build-args: |
123194
PYTHON_VER=${{ env.PYTHON_VER }}
195+
<<<<<<< HEAD
124196
- name: "Debug: Show docker images"
125197
run: "docker image ls"
126198
- name: "Linting: Pylint"
@@ -135,11 +207,30 @@ jobs:
135207
runs-on: "ubuntu-24.04"
136208
env:
137209
PYTHON_VER: "${{ matrix.python-version }}"
210+
=======
211+
- name: "Linting: Pylint"
212+
run: "poetry run invoke pylint"
213+
pytest:
214+
needs:
215+
- "check-in-docker"
216+
strategy:
217+
fail-fast: true
218+
matrix:
219+
python-version: ["3.10", "3.11", "3.12", "3.13"]
220+
runs-on: "ubuntu-latest"
221+
env:
222+
INVOKE_PYNTC_PYTHON_VER: "${{ matrix.python-version }}"
223+
>>>>>>> 2122990 (Cookie initially baked targeting develop by NetworkToCode Cookie Drift Manager Tool)
138224
steps:
139225
- name: "Check out repository code"
140226
uses: "actions/checkout@v4"
141227
- name: "Setup environment"
142228
uses: "networktocode/gh-action-setup-poetry-environment@v6"
229+
<<<<<<< HEAD
230+
=======
231+
with:
232+
poetry-version: "2.1.3"
233+
>>>>>>> 2122990 (Cookie initially baked targeting develop by NetworkToCode Cookie Drift Manager Tool)
143234
- name: "Get image version"
144235
run: "echo INVOKE_PYNTC_IMAGE_VER=`poetry version -s`-py${{ matrix.python-version }} >> $GITHUB_ENV"
145236
- name: "Set up Docker Buildx"
@@ -158,6 +249,7 @@ jobs:
158249
cache-to: "type=gha,scope=${{ env.INVOKE_PYNTC_IMAGE_NAME }}-${{ env.INVOKE_PYNTC_IMAGE_VER }}-py${{ matrix.python-version }}"
159250
build-args: |
160251
PYTHON_VER=${{ env.PYTHON_VER }}
252+
<<<<<<< HEAD
161253
- name: "Debug: Show docker images"
162254
run: "docker image ls"
163255
- name: "Run Tests"
@@ -254,3 +346,25 @@ jobs:
254346
env:
255347
SLACK_WEBHOOK_URL: "${{ secrets.SLACK_WEBHOOK_URL }}"
256348
SLACK_WEBHOOK_TYPE: "INCOMING_WEBHOOK"
349+
=======
350+
- name: "Run Tests"
351+
run: "poetry run invoke pytest"
352+
changelog:
353+
if: >
354+
contains(fromJson('["develop"]'), github.base_ref) &&
355+
(github.head_ref != 'main') && (!startsWith(github.head_ref, 'release'))
356+
runs-on: "ubuntu-latest"
357+
steps:
358+
- name: "Check out repository code"
359+
uses: "actions/checkout@v4"
360+
with:
361+
fetch-depth: "0"
362+
- name: "Setup environment"
363+
uses: "networktocode/gh-action-setup-poetry-environment@v6"
364+
with:
365+
poetry-version: "2.1.3"
366+
- name: "Check for changelog entry"
367+
run: |
368+
git fetch --no-tags origin +refs/heads/${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }}
369+
poetry run towncrier check --compare-with origin/${{ github.base_ref }}
370+
>>>>>>> 2122990 (Cookie initially baked targeting develop by NetworkToCode Cookie Drift Manager Tool)

.github/workflows/release.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
---
2+
name: "Release"
3+
on: # yamllint disable-line rule:truthy rule:comments
4+
release:
5+
types: ["published"]
6+
7+
jobs:
8+
build:
9+
name: "Build package with poetry"
10+
runs-on: "ubuntu-latest"
11+
if: "startsWith(github.ref, 'refs/tags/v')"
12+
steps:
13+
- uses: "actions/checkout@v4"
14+
- name: "Setup environment"
15+
uses: "networktocode/gh-action-setup-poetry-environment@v6"
16+
with:
17+
poetry-version: "2.1.3"
18+
python-version: "3.13"
19+
poetry-install-options: "--no-root"
20+
- name: "Run Poetry Build"
21+
run: "poetry build"
22+
23+
- name: "Check that the release tag matches the version in pyproject.toml"
24+
run: |
25+
if [ "${{ github.ref_name }}" != "v$(poetry version -s)" ]; then exit 1; fi
26+
27+
- uses: "actions/upload-artifact@v4"
28+
with:
29+
name: "distfiles"
30+
path: "dist/"
31+
if-no-files-found: "error"
32+
33+
publish-github:
34+
name: "Publish to GitHub"
35+
runs-on: "ubuntu-latest"
36+
if: "startsWith(github.ref, 'refs/tags/v')"
37+
permissions:
38+
contents: "write"
39+
needs: "build"
40+
steps:
41+
- uses: "actions/checkout@v4"
42+
- name: "Retrieve built package from cache"
43+
uses: "actions/download-artifact@v4"
44+
with:
45+
name: "distfiles"
46+
path: "dist/"
47+
48+
- name: "Upload binaries to release"
49+
run: "gh release upload ${{ github.ref_name }} dist/*.{tar.gz,whl}"
50+
env:
51+
GH_TOKEN: "${{ secrets.NTC_GITHUB_TOKEN }}"
52+
53+
publish-pypi:
54+
name: "Push Package to PyPI"
55+
runs-on: "ubuntu-latest"
56+
if: "startsWith(github.ref, 'refs/tags/v')"
57+
needs: "build"
58+
environment: "pypi"
59+
# Steps to publish to PyPI.
60+
steps:
61+
- name: "Retrieve built package from cache"
62+
uses: "actions/download-artifact@v4"
63+
with:
64+
name: "distfiles"
65+
path: "dist/"
66+
- name: "Publish package distributions to PyPI"
67+
uses: "pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e" # v1.13.0
68+
## Used for networktocode org since trusted publisher isn't supported for GitHub Plan.
69+
with:
70+
user: "__token__"
71+
password: "${{ secrets.PYPI_API_TOKEN }}"
72+
# End publish to PyPI job.
73+
74+
slack-notify:
75+
needs:
76+
- "publish-github"
77+
- "publish-pypi"
78+
runs-on: "ubuntu-latest"
79+
env:
80+
# Secrets cannot be directly referenced in if: conditionals. They must be set as a job env var first.
81+
# Ref: https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#example-using-secrets
82+
SLACK_WEBHOOK_URL: "${{ secrets.OSS_PYPI_SLACK_WEBHOOK_URL }}"
83+
SLACK_WEBHOOK_TYPE: "INCOMING_WEBHOOK"
84+
SLACK_MESSAGE: >-
85+
*NOTIFICATION: NEW-RELEASE-PUBLISHED*\n
86+
Repository: <${{ github.server_url }}/${{ github.repository }}|${{ github.repository }}>\n
87+
Release: <${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ github.ref_name }}|${{ github.ref_name }}>\n
88+
Published by: <${{ github.server_url }}/${{ github.actor }}|${{ github.actor }}>
89+
steps:
90+
- name: "Send a notification to Slack"
91+
if: "${{ env.SLACK_WEBHOOK_URL != '' }}"
92+
uses: "slackapi/slack-github-action@fcfb566f8b0aab22203f066d80ca1d7e4b5d05b3" # v1.27.1
93+
with:
94+
payload: |
95+
{
96+
"text": "${{ env.SLACK_MESSAGE }}",
97+
"blocks": [
98+
{
99+
"type": "section",
100+
"text": {
101+
"type": "mrkdwn",
102+
"text": "${{ env.SLACK_MESSAGE }}"
103+
}
104+
}
105+
]
106+
}

0 commit comments

Comments
 (0)