Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize build (to Hatch) #774

Merged
merged 2 commits into from
Dec 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 16 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: build
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3
- run: pip install build
- run: python -m build .
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist
10 changes: 0 additions & 10 deletions MANIFEST.in

This file was deleted.

8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ PYTHON?=python3
.PHONY : all clean clean-build clean-pyc clean-test install test upload

all :
$(PYTHON) ./setup.py build

install : all
$(PYTHON) ./setup.py install --root=${DESTDIR}
$(PYTHON) -m pip install -e .

clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts

Expand All @@ -32,8 +31,9 @@ clean-test: ## remove test and coverage artifacts
rm -fr htmlcov/

test :
$(PYTHON) setup.py test
$(PYTHON) -m pytest .
$(MAKE) -C test test

upload : test
$(PYTHON) ./setup.py sdist upload
$(PYTHON) -m hatch build
$(PYTHON) -m hatch publish
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Once you have the code, it can be installed from your repository as well:
::

cd paho.mqtt.python
python setup.py install
pip install -e .

To perform all test (including MQTT v5 test), you also need to clone paho.mqtt.testing in paho.mqtt.python folder::

Expand Down
75 changes: 74 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,76 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "paho-mqtt"
dynamic = ["version"]
description = "MQTT version 5.0/3.1.1 client class"
readme = "README.rst"
# see https://lists.spdx.org/g/Spdx-legal/topic/request_for_adding_eclipse/67981884
# for why Eclipse Distribution License v1.0 is listed as BSD-3-Clause
license = "EPL-2.0 OR BSD-3-Clause"
requires-python = ">=3.7"
authors = [
{ name = "Roger Light", email = "roger@atchoo.org" },
]
keywords = [
"paho",
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved",
"Natural Language :: English",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Topic :: Communications",
"Topic :: Internet",
]
dependencies = []

[project.optional-dependencies]
proxy = [
"PySocks",
]

[project.urls]
Homepage = "http://eclipse.org/paho"

[tool.hatch.version]
path = "src/paho/mqtt/__init__.py"

[tool.hatch.build.targets.sdist]
include = [
"src/paho",
"/examples",
"/tests",
"about.html",
"CONTRIBUTING.md",
"edl-v10",
"epl-v20",
"LICENSE.txt",
"notice.html",
"README.rst",
]

[tool.hatch.build.targets.wheel]
sources = ["src"]
include = [
akx marked this conversation as resolved.
Show resolved Hide resolved
"src/paho",
]

[tool.pytest.ini_options]
addopts = ["-r", "xs"]
testpaths = "tests src"

[tool.ruff]
line-length = 167

Expand Down Expand Up @@ -28,4 +101,4 @@ extend-select = [
"F841",
"I",
"S",
]
]
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pylama==7.7.1
pytest==5.2.2; python_version >= '3.0'
pytest-runner==5.2
tox==3.14.0
8 changes: 0 additions & 8 deletions setup.cfg

This file was deleted.

57 changes: 0 additions & 57 deletions setup.py

This file was deleted.

2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ allowlist_externals =
make
commands =
ruff .
python setup.py test
pytest
make -C test test

[testenv:lint]
Expand Down
Loading