Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
da0f982
add .gitignore
mfiedorowicz May 28, 2024
9c632f5
add CODEOWNERS
mfiedorowicz May 28, 2024
2d4746f
.github: pull request labeler
mfiedorowicz May 28, 2024
dd12528
.github: lint and test workflow
mfiedorowicz May 28, 2024
e012eab
.github: release workflow
mfiedorowicz May 28, 2024
f4db359
LICENSE adjustments
mfiedorowicz May 28, 2024
06e3d56
README and supported entities documentation
mfiedorowicz May 28, 2024
16e46be
add pyproject.toml
mfiedorowicz May 28, 2024
df71c4a
migrate diode-sdk-python
mfiedorowicz May 28, 2024
f20bb5b
migrate tests
mfiedorowicz May 28, 2024
caa34e2
.github: update ruff command
mfiedorowicz May 28, 2024
5a3a713
pyproject: exclude tests and proto generated code from coverage
mfiedorowicz May 28, 2024
54a829b
fix: .github - set correct tag format for releaserc
mfiedorowicz May 29, 2024
1d78202
fix: .github - tidy up release-version
mfiedorowicz May 29, 2024
b32417d
fix: client type hints
mfiedorowicz May 31, 2024
6239191
fix: .github - code coverage
mfiedorowicz May 31, 2024
e9974f0
fix: .github - code coverage - omit generated code
mfiedorowicz Jun 3, 2024
4974992
fix: .github - add concurrency, timeouts and python 3.10 to the matrix
mfiedorowicz Jun 4, 2024
700e430
fix: README - tidy up development notes
mfiedorowicz Jun 4, 2024
fd4e25e
fix: pyproject - min python 3.10, classifiers adjustment
mfiedorowicz Jun 4, 2024
9e4cf43
fix: README - document target requirement to not contain scheme
mfiedorowicz Jun 4, 2024
4cde87f
fix: client - tidy up docstrings, naming + PEP 604
mfiedorowicz Jun 4, 2024
e4002d6
fix: ingester - PEP 604
mfiedorowicz Jun 4, 2024
bef8de9
fix: README - typo
mfiedorowicz Jun 4, 2024
68b370e
refactor diode client target with grpc:// and grpcs://, removed redun…
mfiedorowicz Jun 4, 2024
914bbff
tidy up
mfiedorowicz Jun 4, 2024
b459af8
README tidy up
mfiedorowicz Jun 4, 2024
4fad1e4
README tidy up (indentation)
mfiedorowicz Jun 4, 2024
9440a5e
Merge pull request #1 from netboxlabs/feat/migrate-diode-sdk-python
mfiedorowicz Jun 6, 2024
68bf79d
feat: change to trigger minor release
mfiedorowicz Jun 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @mfiedorowicz @natm
54 changes: 54 additions & 0 deletions .github/pull_request_labeler.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
documentation:
- changed-files:
- any-glob-to-any-file:
- '**/docs/**/*'

github-actions:
- changed-files:
- any-glob-to-any-file:
- '**/.github/workflows/*'
- '**/.github/workflows/**/*'
- '**/.github/dependabot.yaml'
- '**/.github/pull_request_labeler.yaml'

github-templates:
- changed-files:
- any-glob-to-any-file:
- '**/.github/ISSUE_TEMPLATE/*'
- '**/.github/PULL_REQUEST_TEMPLATE.md'
- '**/.github/.chglog/*'
- '**/.github/.chglog/**/*'

internal:
- changed-files:
- any-glob-to-any-file:
- '**/.flake8'
- '**/.bandit.baseline'
- '**/.gitignore'
- '**/.pre-commit-config.yaml'
- '**/MANIFEST.in'
- '**/Makefile'
- '**/CONTRIBUTING.md'
- '**/MAINTAINERS.md'
- '**/CODE_OF_CONDUCT.md'
- '**/LICENSE'
- '**/LICENSE.txt'
- '**/THIRD-PARTY-LICENSES'
- '**/.dockerignore'
- '**/.editorconfig'
- '**/setup.cfg'

dependencies:
- changed-files:
- any-glob-to-any-file:
- '**/pyproject.toml'
- '**/poetry.lock'
- '**/requirements.txt'

markdown:
- changed-files:
- any-glob-to-any-file: '**/*.md'

python:
- changed-files:
- any-glob-to-any-file: '**/*.py'
20 changes: 20 additions & 0 deletions .github/workflows/labeler.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: PR labeler
on:
- pull_request_target

concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false

jobs:
triage:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/labeler@v5
with:
configuration-path: '.github/pull_request_labeler.yaml'
49 changes: 49 additions & 0 deletions .github/workflows/lint-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Lint and tests
on:
workflow_dispatch:
pull_request:
push:
branches:
- "!release"

concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false

jobs:
tests:
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
matrix:
python: [ "3.10", "3.11" ]
steps:
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .
pip install .[dev]
pip install .[test]

- name: Run tests with coverage
run: |
set -o pipefail
pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=netboxlabs.diode.sdk tests/ | tee pytest-coverage.txt

- name: Pytest coverage comment
uses: MishaKav/pytest-coverage-comment@main
with:
pytest-coverage-path: ./pytest-coverage.txt
junitxml-path: ./pytest.xml

- name: Lint with Ruff
run: |
ruff check --output-format=github netboxlabs/ tests/
continue-on-error: true
170 changes: 170 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
name: Release
on:
workflow_dispatch:
push:
branches: [ release ]

concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false

env:
GH_TOKEN: ${{ secrets.ORB_CI_GH_TOKEN }}
SEMANTIC_RELEASE_PACKAGE: ${{ github.repository }}
PYTHON_RUNTIME_VERSION: "3.11"
APP_NAME: diode-sdk-python
PYTHON_PACKAGE_NAME: netboxlabs-diode-sdk

jobs:
get-next-version:
name: Semantic release get next version
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "lts/*"
- name: Write package.json
uses: DamianReeves/write-file-action@master
with:
path: ./package.json
write-mode: overwrite
contents: |
{
"name": "${{ env.APP_NAME }}",
"version": "1.0.0",
"devDependencies": {
"semantic-release-export-data": "^1.0.1",
"@semantic-release/changelog": "^6.0.3"
}
}
- name: Write .releaserc.json
uses: DamianReeves/write-file-action@master
with:
path: ./.releaserc.json
write-mode: overwrite
contents: |
{
"branches": "release",
"repositoryUrl": "https://github.com/netboxlabs/diode-sdk-python",
"debug": "true",
"tagFormat": "v${version}",
"plugins": [
["semantic-release-export-data"],
["@semantic-release/commit-analyzer", {
"releaseRules": [
{ "message": "*", "release": "patch"},
{ "message": "fix*", "release": "patch" },
{ "message": "feat*", "release": "minor" },
{ "message": "perf*", "release": "major" }
]
}],
"@semantic-release/release-notes-generator",
[
"@semantic-release/changelog",
{
"changelogFile": "CHANGELOG.md",
"changelogTitle": "# Semantic Versioning Changelog"
}
],
[
"@semantic-release/github",
{
"assets": [
{
"path": "release/**"
}
]
}
]
]
}
- name: setup semantic-release
run: npm i
- name: release dry-run
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_SEMANTIC_RELEASE_WEBHOOK }}
run: npx semantic-release --debug --dry-run
id: get-next-version
- name: Set short sha output
id: short-sha
run: echo "::set-output name=short-sha::${GITHUB_SHA::7}"
- name: Set release version
id: release-version
run: |
echo "::set-output name=release-version::`echo ${{ steps.get-next-version.outputs.new-release-version }} | sed 's/v//g'`"
outputs:
new-release-published: ${{ steps.get-next-version.outputs.new-release-published }}
new-release-version: ${{ steps.release-version.outputs.release-version }}
short-sha: ${{ steps.short-sha.outputs.short-sha }}

confirm-version:
name: Next version ${{ needs.get-next-version.outputs.new-release-version }}
runs-on: ubuntu-latest
timeout-minutes: 5
needs: get-next-version
if: needs.get-next-version.outputs.new-release-published == 'true'
steps:
- uses: actions/checkout@v4
- run: echo "The new release version is ${{ needs.get-next-version.outputs.new-release-version }} commit ${{ needs.get-next-version.outputs.short-sha }}"

build:
name: Build
needs: [ get-next-version ]
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
id-token: write
contents: read
env:
BUILD_VERSION: ${{ needs.get-next-version.outputs.new-release-version }}
BUILD_TRACK: release
BUILD_COMMIT: ${{ needs.get-next-version.outputs.short-sha }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_RUNTIME_VERSION }}
- name: Insert version variables into Python
run: |
sed -i "s/__commit_hash__ = .*/__commit_hash__ = \"${BUILD_COMMIT}\"/" netboxlabs/diode/sdk/version.py
sed -i "s/__track__ = .*/__track__ = \"${BUILD_TRACK}\"/" netboxlabs/diode/sdk/version.py
sed -i "s/__version__ = .*/__version__ = \"${BUILD_VERSION}\"/" netboxlabs/diode/sdk/version.py
- name: Display contents of version.py
run: cat netboxlabs/diode/sdk/version.py
- name: Build sdist package
run: |
pip install toml-cli
toml set --toml-path pyproject.toml project.version ${{ env.BUILD_VERSION }}
cat pyproject.toml | grep version
python3 -m pip install --upgrade build
python3 -m build --sdist --outdir dist/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.PYTHON_PACKAGE_NAME }}-${{ env.BUILD_VERSION }}.tar.gz
path: ./dist/${{ env.PYTHON_PACKAGE_NAME }}-${{ env.BUILD_VERSION }}.tar.gz
retention-days: 30
if-no-files-found: error
- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: ./dist

semantic-release:
name: Semantic release
needs: [ build ]
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "21.4.0"
- name: setup semantic-release
run: npm i
- name: Release
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_OBSERVABILITY_RELEASE_WEBHOOK }}
run: npx semantic-release --debug
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# IntelliJ
.idea/

# VS Code
.vscode

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# macOS
.DS_Store

# Python
__pycache__/
*.py[cod]
*$py.class
.Python
build/
dist/
.eggs/
*.egg-info
2 changes: 1 addition & 1 deletion LICENSE → LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright 2024 NetBox Labs, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Loading