Skip to content

Commit

Permalink
Convert to pyproject.toml (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
DanSheps authored Sep 19, 2024
2 parents e00219e + 007030c commit be89bb7
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 48 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build Test
on: [push, pull_request]

jobs:
build:
name: Build Distribution
runs-on: ubuntu-latest
environment:
name: build
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade setuptools wheel
python -m pip install build --user
- name: Build a binary wheel and a source tarball
run: python -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
branches:
- 'master'
concurrency:
group: ci-${{ github.action }}-${{ github.ref }}-${{ github.actor }}
group: ci-${{ github.event_name }}-${{ github.ref }}-${{ github.actor }}
cancel-in-progress: true
permissions:
contents: read
Expand Down
62 changes: 42 additions & 20 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,63 @@ on:
types: released

jobs:

build:
name: Build Distribution for PyPI
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9]
environment: release
steps:

- name: Checkout repo
uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

python-version: 3.12
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade setuptools wheel
- name: Build
run: python setup.py sdist bdist_wheel

python -m pip install build --user
- name: Build a binary wheel and a source tarball
run: python -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
publish-to-testpypi:
name: Publish Python 🐍 distribution 📦 to PyPI
needs:
- build
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/netbox-lifecycle
permissions:
id-token: write
steps:
- name: Publish package to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
skip_existing: true

publish-to-pypi:
name: Publish Python 🐍 distribution 📦 to PyPI
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/netbox-lifecycle
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
skip_existing: true
4 changes: 2 additions & 2 deletions netbox_lifecycle/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

class NetBoxLifeCycle(PluginConfig):
name = metadata.get('Name').replace('-', '_')
verbose_name = metadata.get('Summary')
description = metadata.get('Description')
verbose_name = metadata.get('Name').replace('-', ' ').title()
description = metadata.get('Summary')
version = metadata.get('Version')
author = metadata.get('Author')
author_email = metadata.get('Author-email')
Expand Down
38 changes: 38 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[build-system]
requires = [
"setuptools",
"wheel"
]
build-backend = "setuptools.build_meta"

[project]
name = "netbox-lifecycle"
authors = [
{name = "Daniel Sheppard", email = "[email protected]"}
]
maintainers = [
{name = "Daniel Sheppard", email = "[email protected]"},
]
description = "NetBox Support Contract and EOL/EOS management"
readme = "README.md"
requires-python = ">=3.10"
keywords = ["netbox-plugin", ]
version = "1.1.3-beta1"
license = {file = "LICENSE"}
classifiers = [
"Programming Language :: Python :: 3",
]
dependencies = [
'django-polymorphic',
]

[project.urls]
Documentation = "https://github.com/dansheps/netbox-lifecycle/blob/main/README.md"
Source = "https://github.com/dansheps/netbox-lifecycle"
Tracker = "https://github.com/dansheps/netbox-lifecycle/issues"

[tool.setuptools.packages.find]
exclude=["netbox_lifecycle.tests"]

[tool.black]
skip-string-normalization = 1
25 changes: 0 additions & 25 deletions setup.py

This file was deleted.

0 comments on commit be89bb7

Please sign in to comment.