From 24263bd14c89ea8d161147e95efeada1bed9c677 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Wed, 28 Jun 2023 23:43:16 +0200 Subject: [PATCH] Use poetry --- .builds/debian.yml | 6 ++--- .gitignore | 1 + .pre-commit-config.yaml | 8 ++----- MANIFEST.in | 11 --------- pyproject.toml | 49 +++++++++++++++++++++++++++++++++++++++-- setup.cfg | 49 ----------------------------------------- setup.py | 3 --- tox.ini | 3 ++- 8 files changed, 55 insertions(+), 75 deletions(-) delete mode 100644 MANIFEST.in delete mode 100644 setup.py diff --git a/.builds/debian.yml b/.builds/debian.yml index 0562ba1..9e9fc35 100644 --- a/.builds/debian.yml +++ b/.builds/debian.yml @@ -7,9 +7,9 @@ packages: - python3-bluetooth - python3-sphinx - python3-sphinx-rtd-theme - - python3-pytest - - python3-setuptools - python3-sphinx-autodoc-typehints + - python3-pytest + - python3-poetry sources: - https://git.sr.ht/~ni/nxt-python tasks: @@ -23,7 +23,7 @@ tasks: tar czf ../../nxt-python.tar.gz latest - install: | cd nxt-python - python3 setup.py install --user + poetry install - upload: | cd nxt-python # Only on master branch. diff --git a/.gitignore b/.gitignore index 95ee127..1ab978d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ docs/_build/ htmlcov/ __pycache__/ .coverage +poetry.lock diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5b06e0a..dc2ca56 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,6 +3,7 @@ repos: rev: v4.4.0 hooks: - id: check-merge-conflict + - id: check-toml - id: check-yaml - id: end-of-file-fixer - id: fix-byte-order-marker @@ -24,11 +25,6 @@ repos: - id: pytest name: pytest language: system - entry: python3 -m pytest + entry: poetry run pytest types: [python] pass_filenames: false - - repo: https://github.com/mgedmin/check-manifest - rev: "0.49" - hooks: - - id: check-manifest - stages: [push, manual] diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 1818417..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,11 +0,0 @@ -include logo.svg -include tox.ini -include tests/*.py -include scripts/python-nxt-filer.desktop -include contrib/60-libnxt.rules -include docs/Makefile -include docs/conf.py -include docs/favicon.ico -include .pre-commit-config.yaml -recursive-include docs *.rst -recursive-include examples *.py diff --git a/pyproject.toml b/pyproject.toml index 9787c3b..a72cadf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,48 @@ +[tool.poetry] +name = "nxt-python" +version = "3.2.0" +description = "LEGO Mindstorms NXT Control Package" +authors = ["Nicolas Schodet "] +license = "GPL-3.0-or-later" +readme = "README.md" +homepage = "https://ni.srht.site/nxt-python/latest/" +packages = [{ include = "nxt" }] +include = [ + { path = "logo.svg", format = "sdist" }, + { path = "tox.ini", format = "sdist" }, + { path = "scripts/python-nxt-filer.desktop", format = "sdist" }, + { path = "scripts/nxt_*", format = "sdist" }, + { path = "contrib", format = "sdist" }, + { path = "docs/Makefile", format = "sdist" }, + { path = "docs/conf.py", format = "sdist" }, + { path = "docs/favicon.ico", format = "sdist" }, + { path = ".pre-commit-config.yaml", format = "sdist" }, + { path = "docs/**/*.rst", format = "sdist" }, + { path = "examples", format = "sdist" }, + { path = "setup.cfg", format = "sdist" }, + { path = "tests", format = "sdist" }, +] + +[tool.poetry.dependencies] +python = "^3.8" +pyusb = "^1.2.1" +pybluez = { version = "^0.23", optional = true } + +[tool.poetry.extras] +bluetooth = ["pybluez"] + +[tool.poetry.group.dev.dependencies] +pytest = "^7.2.1" +coverage = "^6.5.0" +pre-commit = "^3.0.4" +isort = "^5.12.0" +black = "^23.1.0" +flake8 = "^5.0.4" +sphinx = "^5.3.0" +sphinx-rtd-theme = "^1.2.0" +sphinx-autodoc-typehints = "^1.12.0" +tox = "^3.28.0" + [build-system] -requires = ["setuptools", "wheel"] -build-backend = "setuptools.build_meta" +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" diff --git a/setup.cfg b/setup.cfg index 10257d3..de01d73 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,52 +1,3 @@ -[metadata] -name = nxt-python -version = 3.2.0 -author = Nicolas Schodet -author_email = nico@ni.fr.eu.org -description = LEGO Mindstorms NXT Control Package -long_description = file: README.md -long_description_content_type = text/markdown -url = https://github.com/schodet/nxt-python/ -classifiers = - Programming Language :: Python :: 3 - Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+) - Operating System :: OS Independent - -[options] -zip_safe = True -packages = - nxt - nxt.backend - nxt.sensor -scripts = - scripts/nxt_filer - scripts/nxt_push - scripts/nxt_server - scripts/nxt_test -python_requires = >=3.8 -install_requires = - pyusb >= 1.2.1 - -[options.extras_require] -bluetooth = - pybluez >= 0.23; platform_system == 'Linux' - pybluez >= 0.23; platform_system == 'Windows' - pybluez >= 0.23; platform_system == 'Darwin' -dev = - pytest >= 6.0.2 - coverage >= 5.1 - pre-commit >= 2.10.1 - check-manifest >= 0.48 - sphinx >= 3.4.3 - sphinx-rtd-theme >= 0.5.1 - sphinx-autodoc-typehints >= 1.12.0 - tox >= 3.21.4 - [flake8] max-line-length = 88 diff --git a/setup.py b/setup.py deleted file mode 100644 index b908cbe..0000000 --- a/setup.py +++ /dev/null @@ -1,3 +0,0 @@ -import setuptools - -setuptools.setup() diff --git a/tox.ini b/tox.ini index b802126..eb01c55 100644 --- a/tox.ini +++ b/tox.ini @@ -5,10 +5,11 @@ [tox] envlist = py38, py39, py310, py311 +isolated_build = True [testenv] deps = pytest pyusb commands = - pytest tests + pytest