Skip to content

Commit

Permalink
Move to tox4 and pure pyproject packaging (#15)
Browse files Browse the repository at this point in the history
(DIS-1750)
  • Loading branch information
pyrco authored Mar 16, 2023
1 parent 44daf17 commit 51deb19
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 72 deletions.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
exclude .gitignore
exclude .github
recursive-exclude .github/ *
43 changes: 41 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,39 @@
[build-system]
requires = ["setuptools>=43.0.0", "wheel", "setuptools_scm[toml]>=3.4.1"]
requires = ["setuptools>=65.5.0", "setuptools_scm[toml]>=6.4.0"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
[project]
name = "dissect.hypervisor"
description = "A Dissect module implementing parsers for various hypervisor disk, backup and configuration files"
readme = "README.md"
requires-python = "~=3.9"
license.text = "Affero General Public License v3"
authors = [
{name = "Dissect Team", email = "[email protected]"}
]
classifiers = [
"Programming Language :: Python :: 3",
]
dependencies = [
"dissect.cstruct>=3.0.dev,<4.0.dev",
"dissect.util>=3.0.dev,<4.0.dev",
]
dynamic = ["version"]

[project.urls]
homepage = "https://dissect.tools"
documentation = "https://docs.dissect.tools/en/latest/projects/dissect.hypervisor"
repository = "https://github.com/fox-it/dissect.hypervisor"

[project.optional-dependencies]
full = [
"pycryptodome",
"rich",
]

[project.scripts]
vma-extract = "dissect.hypervisor.tools.vma:main"
envelope-decrypt = "dissect.hypervisor.tools.envelope:main"

[tool.black]
line-length = 120
Expand All @@ -11,3 +42,11 @@ line-length = 120
profile = "black"
known_first_party = ["dissect.hypervisor"]
known_third_party = ["dissect"]

[tool.setuptools]
license-files = ["LICENSE", "COPYRIGHT"]

[tool.setuptools.packages.find]
include = ["dissect.*"]

[tool.setuptools_scm]
14 changes: 0 additions & 14 deletions setup.cfg

This file was deleted.

22 changes: 0 additions & 22 deletions setup.py

This file was deleted.

61 changes: 28 additions & 33 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,24 +1,14 @@
[tox]
envlist = lint, py3, pypy3
# This version of tox will autoprovision itself and the requirements defined in
# requires if they are not available on the host system.
minversion = 3.8.0
# This version of virtualenv installs a pip version of at least 19.0.1 in its
# venvs.
# Requiring minimally this version of virtualenv to be available prevents the
# need of having to explicitly specify a pip>=19.0 dependency in every testenv.
# pip>=19.0 is needed to ensure the sdist build by tox (which is build
# according to PEP 517 and PEP 518 by tox versions >= 3.4.0) is also installed
# properly (according to PEP 517 and PEP 518 by pip>=19.0) in the virtualenvs.
# If the dependency is not available on the host system, and the installed tox
# version is >= 3.3.0, tox will self bootstrap an environment with the proper
# versions (including the version of tox itself).
requires = virtualenv>=16.3.0
isolated_build = true
# Putting the dist dir in the project directory instead of in the {toxworkdir},
# makes the sdist more easily accesible and prevents the need of rebuilding it
# for the [testenv:build] target.
distdir = {toxinidir}/dist
# requires if they are not available on the host system. This requires the
# locally installed tox to have a minimum version 3.3.0. This means the names
# of the configuration options are still according to the tox 3.x syntax.
minversion = 4.2.4
# This version of virtualenv will install setuptools version 65.5.0 and pip
# 22.3. These versions fully support python projects defined only through a
# pyproject.toml file (PEP-517/PEP-518/PEP-621)
requires = virtualenv>=20.16.6

[testenv]
extras = full
Expand All @@ -31,29 +21,34 @@ commands =
coverage report
coverage xml

[testenv:build]
package = skip
deps =
build
commands =
pyproject-build

[testenv:fix]
package = skip
deps =
black==23.1.0
isort==5.11.4
commands =
black dissect tests
isort dissect tests

[testenv:lint]
# Force the Python version here, so linting will be done with the correct
# Python version. There should be no difference between the CPython and pypy
# implementations, so we pick one.
basepython = python3
package = skip
deps =
black==23.1.0
flake8
flake8-black
flake8-isort
isort==5.11.4
vermin
commands =
flake8 dissect tests setup.py
vermin -t=3.9- --no-tips --lint dissect tests setup.py

[testenv:build]
# Force the Python version here, so building will be done with the correct
# Python version. As the distributions are pure Python, there should be no
# difference between the CPython and pypy implementations, so we pick one.
basepython = python3
deps =
commands =
pip wheel --no-deps -w ./dist .
flake8 dissect tests
vermin -t=3.9- --no-tips --lint dissect tests

[flake8]
max-line-length = 120
Expand Down

0 comments on commit 51deb19

Please sign in to comment.