Skip to content

Commit

Permalink
Use pyproject.toml, requirements.txt and tox.ini
Browse files Browse the repository at this point in the history
Remove the now unneeded setup.cfg and setup.py files.

Signed-off-by: Simon Deziel <[email protected]>
  • Loading branch information
simondeziel committed Oct 16, 2023
1 parent b6a40ef commit fb4a8e9
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 146 deletions.
45 changes: 45 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[project]
name = "pylxd"
version = "2.3.2a"
description = "python library for LXD"
readme = "README.rst"
authors = [
{name = "Paul Hummer and others (see CONTRIBUTORS.rst"},
{email = "[email protected]"},
]
classifiers = [
"Intended Audience :: Information Technology",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: Apache Software License",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3",
]
license = {file = "LICENSE"}
requires-python = ">=3.8"
dependencies = [
"cryptography >= 3.2",
"python-dateutil >= 2.4.2",
"requests >= 2.20.0",
"requests-toolbelt >= 0.8.0",
"requests-unixsocket >= 0.1.5",
"urllib3 < 2",
"ws4py != 0.3.5, >= 0.3.4", # 0.3.5 is broken for websocket support
]

[project.urls]
Homepage = "https://ubuntu.com/lxd"
Documentation = "https://pylxd.readthedocs.io/en/latest/"
Repository = "https://github.com/canonical/pylxd"

[build-system]
requires = ["setuptools"]

[tool.setuptools]
packages = ["pylxd"]

[tool.mypy]
ignore_missing_imports = true
install_types = true
non_interactive = true
warn_return_any = true
warn_unused_configs = true
7 changes: 7 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cryptography >= 3.2
python-dateutil >= 2.4.2
requests >= 2.20.0
requests-toolbelt >= 0.8.0
requests-unixsocket >= 0.1.5
urllib3 < 2
ws4py != 0.3.5, >= 0.3.4 # 0.3.5 is broken for websocket support
130 changes: 0 additions & 130 deletions setup.cfg

This file was deleted.

16 changes: 0 additions & 16 deletions setup.py

This file was deleted.

71 changes: 71 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
[tox]
minversion = 1.6
skipsdist = True
envlist = lint,check,coverage

# Define dependency groups
# https://tox.wiki/en/latest/config.html#substitution-for-values-from-other-sections
[testing]
deps =
-rrequirements.txt
ddt >= 0.7.0
mock-services >= 0.3
pytest-cov >= 2.10.1
pytest >= 6.1.2
# mock-services is old and unmaintained. Doesn't work with newer versions
# of requests-mock. Thus, we have to pin it down.
requests-mock < 1.2
# Python 3.12 no longer installs `setuptools` in venv
# but mock-services depends on it for `pkg_resources`
setuptools

[format]
deps =
black == 23.1.0
flake8 >= 2.5.0
isort == 5.6.4

[testenv]
package = editable
setenv =
PYLXD_WARNINGS=none
deps = {[testing]deps}
commands = pytest {posargs:pylxd}

[testenv:integration]
deps = {[testing]deps}
commands = pytest integration {posargs}

[testenv:integration-in-lxd]
deps = {[testing]deps}
commands = {toxinidir}/integration/run-integration-tests-in-lxd

[testenv:migration]
deps = {[testing]deps}
commands = pytest migration {posargs}

[testenv:format]
deps = {[format]deps}
commands =
isort --profile black {toxinidir}
black {toxinidir}

[testenv:lint]
deps = {[format]deps}
commands =
black --check {toxinidir}
isort --profile black --check-only --diff {toxinidir}
flake8 {toxinidir}

[testenv:check]
deps = mypy
commands = mypy -p pylxd {posargs}

[testenv:coverage]
deps = {[testing]deps}
commands = pytest --cov=pylxd pylxd {posargs}

[flake8]
show-source = True
ignore = E203, E266, E501, W503, W504
exclude = .git, .tox, dist, doc, *egg, build

0 comments on commit fb4a8e9

Please sign in to comment.