encode development requirements in pyproject.toml (#32616)

Add a `project` block to the toml config along with development and CI
dependencies and a minimal `build-system` block, doing basically
nothing, so that spack can be bootstrapped to a full development
environment with:

```shell
$ hatch -e dev shell
```

or for a minimal environment without hatch:

```shell
$ python3 -m venv venv
$ source venv/bin/activate
$ python3 -m pip install --upgrade pip
$ python3 -m pip install -e '.[dev]'
```

This means we can re-use the requirements list throughout the workflow
yaml files and otherwise maintain this list in *one place* rather than
several disparate ones.  We may be stuck with a couple more temporarily
to continue supporting python2.7, but aside from that it's less places
to get out of sync and a couple new bootstrap options.

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
This commit is contained in:
Tom Scogland
2022-11-07 15:00:22 -08:00
committed by GitHub
parent 28d669cb39
commit 6241cdb27b
5 changed files with 146 additions and 51 deletions

View File

@@ -1,3 +1,74 @@
[project]
name="spack"
description="The spack package manager"
dependencies=[
"clingo",
"setuptools",
"six",
"types-six",
]
dynamic = ["version"]
[project.scripts]
spack = "lib.spack.spack_installable.main:main"
[tool.hatch.version]
path = "lib/spack/spack/__init__.py"
[project.optional-dependencies]
dev = [
"pip>=21.3",
"pytest",
"pytest-xdist",
"setuptools",
"click==8.0.2",
'black==21.12b0',
"mypy",
"isort",
"flake8",
"vermin",
]
ci = [
"pytest-cov",
"codecov[toml]",
]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.wheel]
include = [
"/bin",
"/etc",
"/lib",
"/share",
"/var",
"CITATION.cff",
"COPYRIGHT",
"LICENSE-APACHE",
"LICENSE-MIT",
"NOTICE",
"README.md",
"SECURITY.md",
]
[tool.hatch.envs.default]
features = [
"dev",
]
[tool.hatch.envs.default.scripts]
spack = "./bin/spack"
style = "./bin/spack style"
test = "./bin/spack unit-test"
[tool.hatch.envs.ci]
features = [
"dev",
"ci",
]
[tool.black]
line-length = 99
target-version = ['py27', 'py35', 'py36', 'py37', 'py38', 'py39', 'py310']