Skip to content

Commit 3c88c27

Browse files
authored
Cookie initially baked targeting develop by NetworkToCode Cookie Drift Manager Tool (#343)
* 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" } ``` * address initial drift manager conflicts * final few fixes for drift management * last few fixes * remove doctest as it was never implemented for this lib
1 parent db3b68a commit 3c88c27

24 files changed

Lines changed: 611 additions & 310 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": "2015",
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Default owner(s) of all files in this repository
2-
* @jeffkala @pszulczewski @pke11y
2+
* @jeffkala @pszulczewski @pke11y

.github/ISSUE_TEMPLATE/bug_report.md

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

66
### Environment
7-
* Python version: <!-- Example: 3.11.2 -->
8-
* pyntc version: <!-- Example: 2.0.2 -->
7+
* Python version: <!-- Example: 3.10 -->
8+
* pyntc version: <!-- Example: 1.0.0 -->
99

1010
<!-- What did you expect to happen? -->
1111
### Expected Behavior

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ about: Propose a new feature or enhancement
55
---
66

77
### Environment
8-
* pyntc version: <!-- Example: 2.0.2 -->
8+
* pyntc version: <!-- Example: 1.0.0 -->
99

1010
<!--
1111
Describe in detail the new functionality you are proposing.

.github/workflows/ci.yml

Lines changed: 53 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ on: # yamllint disable-line rule:truthy rule:comments
88
branches:
99
- "main"
1010
- "develop"
11-
tags:
12-
- "v*"
1311
pull_request: ~
1412

1513
env:
@@ -18,7 +16,7 @@ env:
1816

1917
jobs:
2018
ruff-format:
21-
runs-on: "ubuntu-24.04"
19+
runs-on: "ubuntu-latest"
2220
env:
2321
INVOKE_PYNTC_LOCAL: "True"
2422
steps:
@@ -27,11 +25,11 @@ jobs:
2725
- name: "Setup environment"
2826
uses: "networktocode/gh-action-setup-poetry-environment@v6"
2927
with:
30-
poetry-version: "1.8.5"
28+
poetry-version: "2.1.3"
3129
- name: "Linting: ruff format"
3230
run: "poetry run invoke ruff --action format"
3331
ruff-lint:
34-
runs-on: "ubuntu-24.04"
32+
runs-on: "ubuntu-latest"
3533
env:
3634
INVOKE_PYNTC_LOCAL: "True"
3735
steps:
@@ -40,25 +38,25 @@ jobs:
4038
- name: "Setup environment"
4139
uses: "networktocode/gh-action-setup-poetry-environment@v6"
4240
with:
43-
poetry-version: "1.8.5"
41+
poetry-version: "2.1.3"
4442
- name: "Linting: ruff"
4543
run: "poetry run invoke ruff --action lint"
46-
# Temporarily disabled due to issues with the docs build and needing best practices for NTC python builds.
47-
# check-docs-build:
48-
# runs-on: "ubuntu-24.04"
49-
# env:
50-
# INVOKE_PYNTC_LOCAL: "True"
51-
# steps:
52-
# - name: "Check out repository code"
53-
# uses: "actions/checkout@v4"
54-
# - name: "Setup environment"
55-
# uses: "networktocode/gh-action-setup-poetry-environment@v6"
56-
# with:
57-
# poetry-version: "1.8.5"
58-
# - name: "Check Docs Build"
59-
# run: "poetry run invoke build-and-check-docs"
44+
check-docs-build:
45+
runs-on: "ubuntu-latest"
46+
env:
47+
INVOKE_PYNTC_LOCAL: "True"
48+
steps:
49+
- name: "Check out repository code"
50+
uses: "actions/checkout@v4"
51+
- name: "Setup environment"
52+
uses: "networktocode/gh-action-setup-poetry-environment@v6"
53+
with:
54+
poetry-version: "2.1.3"
55+
poetry-install-options: "--only dev,docs"
56+
- name: "Check Docs Build"
57+
run: "poetry run invoke build-and-check-docs"
6058
poetry:
61-
runs-on: "ubuntu-24.04"
59+
runs-on: "ubuntu-latest"
6260
env:
6361
INVOKE_PYNTC_LOCAL: "True"
6462
steps:
@@ -67,15 +65,11 @@ jobs:
6765
- name: "Setup environment"
6866
uses: "networktocode/gh-action-setup-poetry-environment@v6"
6967
with:
70-
poetry-version: "1.8.5"
68+
poetry-version: "2.1.3"
7169
- name: "Checking: poetry lock file"
72-
run: "poetry lock --check"
73-
needs:
74-
- "ruff-format"
75-
- "ruff-lint"
76-
- "yamllint"
70+
run: "poetry run invoke lock --check"
7771
yamllint:
78-
runs-on: "ubuntu-24.04"
72+
runs-on: "ubuntu-latest"
7973
env:
8074
INVOKE_PYNTC_LOCAL: "True"
8175
steps:
@@ -84,25 +78,29 @@ jobs:
8478
- name: "Setup environment"
8579
uses: "networktocode/gh-action-setup-poetry-environment@v6"
8680
with:
87-
poetry-version: "1.8.5"
81+
poetry-version: "2.1.3"
8882
- name: "Linting: yamllint"
8983
run: "poetry run invoke yamllint"
84+
check-in-docker:
9085
needs:
9186
- "ruff-format"
9287
- "ruff-lint"
93-
pylint:
94-
runs-on: "ubuntu-24.04"
88+
- "poetry"
89+
- "yamllint"
90+
runs-on: "ubuntu-latest"
9591
strategy:
9692
fail-fast: true
9793
matrix:
98-
python-version: ["3.9", "3.10", "3.11", "3.12"]
94+
python-version: ["3.10", "3.13"]
9995
env:
100-
PYTHON_VER: "${{ matrix.python-version }}"
96+
INVOKE_PYNTC_PYTHON_VER: "${{ matrix.python-version }}"
10197
steps:
10298
- name: "Check out repository code"
10399
uses: "actions/checkout@v4"
104100
- name: "Setup environment"
105101
uses: "networktocode/gh-action-setup-poetry-environment@v6"
102+
with:
103+
poetry-version: "2.1.3"
106104
- name: "Get image version"
107105
run: "echo INVOKE_PYNTC_IMAGE_VER=`poetry version -s`-py${{ matrix.python-version }} >> $GITHUB_ENV"
108106
- name: "Set up Docker Buildx"
@@ -120,26 +118,26 @@ jobs:
120118
cache-from: "type=gha,scope=${{ env.INVOKE_PYNTC_IMAGE_NAME }}-${{ env.INVOKE_PYNTC_IMAGE_VER }}-py${{ matrix.python-version }}"
121119
cache-to: "type=gha,scope=${{ env.INVOKE_PYNTC_IMAGE_NAME }}-${{ env.INVOKE_PYNTC_IMAGE_VER }}-py${{ matrix.python-version }}"
122120
build-args: |
123-
PYTHON_VER=${{ env.PYTHON_VER }}
124-
- name: "Debug: Show docker images"
125-
run: "docker image ls"
121+
PYTHON_VER=${{ matrix.python-version }}
126122
- name: "Linting: Pylint"
127123
run: "poetry run invoke pylint"
128-
needs:
129-
- "poetry"
130124
pytest:
125+
needs:
126+
- "check-in-docker"
131127
strategy:
132128
fail-fast: true
133129
matrix:
134-
python-version: ["3.9", "3.10", "3.11", "3.12"]
135-
runs-on: "ubuntu-24.04"
130+
python-version: ["3.10", "3.11", "3.12", "3.13"]
131+
runs-on: "ubuntu-latest"
136132
env:
137-
PYTHON_VER: "${{ matrix.python-version }}"
133+
INVOKE_PYNTC_PYTHON_VER: "${{ matrix.python-version }}"
138134
steps:
139135
- name: "Check out repository code"
140136
uses: "actions/checkout@v4"
141137
- name: "Setup environment"
142138
uses: "networktocode/gh-action-setup-poetry-environment@v6"
139+
with:
140+
poetry-version: "2.1.3"
143141
- name: "Get image version"
144142
run: "echo INVOKE_PYNTC_IMAGE_VER=`poetry version -s`-py${{ matrix.python-version }} >> $GITHUB_ENV"
145143
- name: "Set up Docker Buildx"
@@ -157,100 +155,24 @@ jobs:
157155
cache-from: "type=gha,scope=${{ env.INVOKE_PYNTC_IMAGE_NAME }}-${{ env.INVOKE_PYNTC_IMAGE_VER }}-py${{ matrix.python-version }}"
158156
cache-to: "type=gha,scope=${{ env.INVOKE_PYNTC_IMAGE_NAME }}-${{ env.INVOKE_PYNTC_IMAGE_VER }}-py${{ matrix.python-version }}"
159157
build-args: |
160-
PYTHON_VER=${{ env.PYTHON_VER }}
161-
- name: "Debug: Show docker images"
162-
run: "docker image ls"
158+
PYTHON_VER=${{ matrix.python-version }}
163159
- name: "Run Tests"
164160
run: "poetry run invoke pytest"
165-
needs:
166-
- "poetry"
167-
publish_gh:
168-
name: "Publish to GitHub"
169-
runs-on: "ubuntu-24.04"
170-
# yamllint disable-line rule:quoted-strings
171-
if: startsWith(github.ref, 'refs/tags/v')
161+
changelog:
162+
if: >
163+
contains(fromJson('["develop"]'), github.base_ref) &&
164+
(github.head_ref != 'main') && (!startsWith(github.head_ref, 'release'))
165+
runs-on: "ubuntu-latest"
172166
steps:
173167
- name: "Check out repository code"
174168
uses: "actions/checkout@v4"
175-
- name: "Set up Python"
176-
uses: "actions/setup-python@v5"
177169
with:
178-
python-version: "3.9"
179-
- name: "Install Python Packages"
180-
run: "pip install poetry"
181-
- name: "Set env"
182-
run: "echo RELEASE_VERSION=${GITHUB_REF:10} >> $GITHUB_ENV"
183-
- name: "Run Poetry Version"
184-
run: "poetry version $RELEASE_VERSION"
185-
- name: "Build Documentation"
186-
run: "poetry run invoke build-and-check-docs"
187-
- name: "Run Poetry Build"
188-
run: "poetry build"
189-
- name: "Upload binaries to release"
190-
run: "gh release upload ${{ github.ref_name }} dist/*.{tar.gz,whl}"
191-
env:
192-
GH_TOKEN: "${{ secrets.NTC_GITHUB_TOKEN }}"
193-
needs:
194-
- "pytest"
195-
publish_pypi:
196-
name: "Push Package to PyPI"
197-
runs-on: "ubuntu-24.04"
198-
# yamllint disable-line rule:quoted-strings
199-
if: startsWith(github.ref, 'refs/tags/v')
200-
steps:
201-
- name: "Check out repository code"
202-
uses: "actions/checkout@v4"
203-
- name: "Set up Python"
204-
uses: "actions/setup-python@v5"
205-
with:
206-
python-version: "3.9"
207-
- name: "Install Python Packages"
208-
run: "pip install poetry"
209-
- name: "Set env"
210-
run: "echo RELEASE_VERSION=${GITHUB_REF:10} >> $GITHUB_ENV"
211-
- name: "Run Poetry Version"
212-
run: "poetry version $RELEASE_VERSION"
213-
- name: "Run Poetry Build"
214-
run: "poetry build"
215-
- name: "Push to PyPI"
216-
uses: "pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc" # v1.12.4
217-
with:
218-
user: "__token__"
219-
password: "${{ secrets.PYPI_API_TOKEN }}"
220-
needs:
221-
- "pytest"
222-
slack-notify:
223-
needs:
224-
- "publish_gh"
225-
- "publish_pypi"
226-
runs-on: "ubuntu-24.04"
227-
env:
228-
SLACK_WEBHOOK_URL: "${{ secrets.SLACK_WEBHOOK_URL }}"
229-
SLACK_MESSAGE: >-
230-
*NOTIFICATION: NEW-RELEASE-PUBLISHED*\n
231-
Repository: <${{ github.server_url }}/${{ github.repository }}|${{ github.repository }}>\n
232-
Release: <${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ github.ref_name }}|${{ github.ref_name }}>\n
233-
Published by: <${{ github.server_url }}/${{ github.actor }}|${{ github.actor }}>
234-
steps:
235-
- name: "Send a notification to Slack"
236-
# ENVs cannot be used directly in job.if. This is a workaround to check
237-
# if SLACK_WEBHOOK_URL is present.
238-
if: "env.SLACK_WEBHOOK_URL != ''"
239-
uses: "slackapi/slack-github-action@fcfb566f8b0aab22203f066d80ca1d7e4b5d05b3" # v1.27.1
170+
fetch-depth: "0"
171+
- name: "Setup environment"
172+
uses: "networktocode/gh-action-setup-poetry-environment@v6"
240173
with:
241-
payload: |
242-
{
243-
"text": "${{ env.SLACK_MESSAGE }}",
244-
"blocks": [
245-
{
246-
"type": "section",
247-
"text": {
248-
"type": "mrkdwn",
249-
"text": "${{ env.SLACK_MESSAGE }}"
250-
}
251-
}
252-
]
253-
}
254-
env:
255-
SLACK_WEBHOOK_URL: "${{ secrets.SLACK_WEBHOOK_URL }}"
256-
SLACK_WEBHOOK_TYPE: "INCOMING_WEBHOOK"
174+
poetry-version: "2.1.3"
175+
- name: "Check for changelog entry"
176+
run: |
177+
git fetch --no-tags origin +refs/heads/${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }}
178+
poetry run towncrier check --compare-with origin/${{ github.base_ref }}

0 commit comments

Comments
 (0)