Skip to content

Commit

Permalink
switch from setup.py to pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
M0r13n committed Oct 31, 2023
1 parent 0c859cb commit 9eb2b7f
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 72 deletions.
33 changes: 17 additions & 16 deletions .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
name: Upload Python Package
name: Release

# Only run for releases (tagged)
on:
release:
types: [published]

jobs:
deploy:
build-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: '3.7'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: '__token__'
TWINE_PASSWORD: ${{ secrets.pypi_password }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
python-version: '3.11'
- name: Install build dependencies
run: python -m pip install -U setuptools wheel build
- name: Build
run: python -m build .
- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
user: '__token__'
password: ${{ secrets.pypi_password }}
12 changes: 7 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ flake:

.PHONY: build
build:
rm -rf dist/ && rm -rf build/ && python setup.py sdist bdist_wheel
rm -rf dist
rm -rf build
python -m build

check-build:
twine check dist/*
Expand All @@ -18,14 +20,14 @@ clean:
rm -rf .mypy_cache
rm -rf build
rm -rf dist
rm coverage.xml
rm .coverage
rm -f coverage.xml
rm -f .coverage

ensure-no-print:
grep -r --exclude main.py --exclude '*.pyc' -i 'print(' ./pyais && (echo "Debug print statement found"; exit 1)||true

test: run_tests flake type-check ensure-no-print

install:
pip install wheel
pip install -U .[dev]
pip install -U setuptools wheel build
pip install -U -e .[dev]
57 changes: 57 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
[project]
name = "pyais"
dynamic = ["version"]
description = "AIS message decoding"
readme = "README.md"
requires-python = ">=3.7"
license = {file = "LICENSE"}
keywords = ["AIS", "ship", "decoding", "NMEA", "maritime"]

authors = [
{name = "Leon Morten Richter", email = "[email protected]" }
]
maintainers = [
{name = "Leon Morten Richter", email = "[email protected]" }]

classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Communications",
"Topic :: System :: Networking",
"Typing :: Typed",
]

dependencies = [
"bitarray",
"attrs"
]

[project.optional-dependencies]
dev = ['mypy', 'flake8', 'coverage', 'twine', 'sphinx', 'pytest', 'pytest-cov']

[project.urls]
"Homepage" = "https://github.com/M0r13n/pyais"
"Source" = "https://github.com/M0r13n/pyais"

[project.scripts]
ais-decode = "pyais.main:main"

[tool.setuptools]
package-data = {"pyais" = ["py.typed"]}


[build-system]
requires = ["setuptools>=43.0.0", "wheel"]
build-backend = "setuptools.build_meta"

[tool.setuptools.dynamic]
version = {attr = "pyais.__version__"}
51 changes: 0 additions & 51 deletions setup.py

This file was deleted.

0 comments on commit 9eb2b7f

Please sign in to comment.