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

Set max cpu count for pytest-xdist runs. Added tox-env descriptions #385

Merged
merged 2 commits into from
Jan 10, 2023
Merged
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
140 changes: 81 additions & 59 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,49 +1,53 @@
[build-system]
requires = [ "setuptools >= 35.0.2", "wheel >= 0.29.0", "setuptools_scm[toml]==7.0.5"]
requires = [
"setuptools >= 35.0.2",
"wheel >= 0.29.0",
"setuptools_scm[toml]==7.0.5",
]
build-backend = "setuptools.build_meta"



[project]
name = "hydra_zen"
dynamic = ["version"]
description = "Configurable, reproducible, and scalable workflows in Python, via Hydra"
readme = "README.md"
requires-python = ">=3.7"
dependencies=[
"hydra-core >= 1.1.0",
"typing-extensions >= 4.1.0",
dependencies = ["hydra-core >= 1.1.0", "typing-extensions >= 4.1.0"]
license = { text = "MIT" }
keywords = [
"machine learning",
"research",
"configuration",
"scalable",
"reproducible",
"yaml",
"Hydra",
"dataclass",
]
license = {text = "MIT"}
keywords= [ "machine learning", "research", "configuration", "scalable", "reproducible", "yaml", "Hydra", "dataclass"]

authors = [
{name = "Ryan Soklaski", email = "ryan.soklaski@ll.mit.edu" },
{name = "Justin Goodwin", email = "jgoodwin@ll.mit.edu" },
]
maintainers = [
{name = "Ryan Soklaski", email = "ryan.soklaski@ll.mit.edu" },
{ name = "Ryan Soklaski", email = "ryan.soklaski@ll.mit.edu" },
{ name = "Justin Goodwin", email = "jgoodwin@ll.mit.edu" },
]
maintainers = [{ name = "Ryan Soklaski", email = "ryan.soklaski@ll.mit.edu" }]

classifiers = [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Intended Audience :: Science/Research",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Scientific/Engineering",
"Programming Language :: Python :: 3 :: Only",
"Development Status :: 4 - Beta",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Intended Audience :: Science/Research",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Scientific/Engineering",
"Programming Language :: Python :: 3 :: Only",
]

[project.optional-dependencies]
test = [
"pytest >= 3.8",
"hypothesis >= 6.28.0",
]
test = ["pytest >= 3.8", "hypothesis >= 6.28.0"]
pydantic = ["pydantic>=1.8.2"]
beartype = ["beartype>=0.8.0"]

Expand All @@ -53,15 +57,13 @@ beartype = ["beartype>=0.8.0"]
"Source" = "https://github.com/mit-ll-responsible-ai/hydra-zen"



[tool.setuptools_scm]
write_to = "src/hydra_zen/_version.py"
version_scheme = "no-guess-dev"



[tool.setuptools]
package-dir = {"" = "src"}
package-dir = { "" = "src" }

[tool.setuptools.packages.find]
where = ["src"]
Expand All @@ -71,37 +73,33 @@ exclude = ["tests*", "tests.*"]
hydra_zen = ["py.typed"]



[tool.isort]
known_first_party = ["hydra_zen", "tests"]
profile = "black"
combine_as_imports = true



[tool.coverage.run]
branch = true
omit = [
"tests/test_docs_typecheck.py",
]
omit = ["tests/test_docs_typecheck.py"]

[tool.coverage.report]
omit = ["src/hydra_zen/_version.py"]
exclude_lines = [
'pragma: no cover',
'def __repr__',
'raise NotImplementedError',
'class .*\bProtocol(\[.+\])?\):',
'@(abc\.)?abstractmethod',
'@(typing\.)?overload',
'except ImportError:',
'except ModuleNotFoundError:',
'if (typing\.)?TYPE_CHECKING:',
'if sys\.version_info',
'pragma: no cover',
'def __repr__',
'raise NotImplementedError',
'class .*\bProtocol(\[.+\])?\):',
'@(abc\.)?abstractmethod',
'@(typing\.)?overload',
'except ImportError:',
'except ModuleNotFoundError:',
'if (typing\.)?TYPE_CHECKING:',
'if sys\.version_info',
]

[tool.pytest.ini_options]
xfail_strict=true
xfail_strict = true


[tool.pyright]
Expand Down Expand Up @@ -135,30 +133,37 @@ python =


[testenv]
description = Runs test suite parallelized in the specified python enviornment and
against number of available processes (up to 4).
Run `tox -e py39 -- -n 0` to run tests in a python 3.9 with
parallelization disabled.
passenv = *
deps = pytest
hypothesis
pytest-xdist
commands = pytest -n auto tests/ {posargs}
commands = pytest tests/ {posargs: -n auto --maxprocesses=4}


[testenv:min-deps] # test against minimum dependency versions
[testenv:min-deps]
description = Runs test suite against minimum supported versions of dependencies.
deps = hydra-core==1.1.0
omegaconf==2.1.1
typing-extensions==4.1.0
{[testenv]deps}
basepython = python3.7


[testenv:pre-release] # test against pre-releases of dependencies
[testenv:pre-release]
description = Runs test suite against pre-release versions of dependencies.
pip_pre = true
deps = {[testenv]deps}
pydantic
beartype
cloudpickle
basepython = python3.9

[testenv:omegaconf-2p2p2] # guard against regressions for type sanitization
[testenv:omegaconf-2p2p2]
description = Test againse OmegaConf 2.2.2 to guard against type-sanitization regressions.
pip_pre = true
deps = omegaconf==2.2.2
{[testenv]deps}
Expand All @@ -168,6 +173,8 @@ deps = omegaconf==2.2.2
basepython = python3.8

[testenv:coverage]
description = Runs test suite and measures test-coverage. Fails if coverage is
below 100 prcnt. Run `tox -e coverage -- -n 0` to disable parallelization.
setenv = NUMBA_DISABLE_JIT=1
usedevelop = true
basepython = python3.10
Expand All @@ -178,10 +185,13 @@ deps = {[testenv]deps}
pydantic
beartype
cloudpickle
commands = pytest --cov-report term-missing --cov-config=pyproject.toml --cov-fail-under=100 --cov=hydra_zen -n auto tests
commands = pytest --cov-report term-missing --cov-config=pyproject.toml --cov-fail-under=100 --cov=hydra_zen tests {posargs: -n auto --maxprocesses=4}


[testenv:pyright-scan-docs]
description = Installs pyright and scans hydra-zen docs & docstrings. Note that this can
be slow. Runs in parallel by default. Run
`tox -e pyright-scan-docs -- -n 0` to disable parallelization.
usedevelop = true
basepython = python3.9
deps = {[testenv]deps}
Expand All @@ -193,10 +203,12 @@ deps = {[testenv]deps}
pydantic
beartype
--requirement deps/requirements-pyright.txt
commands = pytest -n auto tests/test_docs_typecheck.py -vv
commands = pytest tests/test_docs_typecheck.py -vv {posargs: -n auto --maxprocesses=4}


[testenv:third-party]
description = Runs test suite against optional 3rd party packages that hydra-zen
provides specialized support for.
install_command = pip install --upgrade --upgrade-strategy eager {opts} {packages}
basepython = python3.9
deps = {[testenv]deps}
Expand All @@ -209,6 +221,9 @@ deps = {[testenv]deps}
beartype

[testenv:pyright]
description = Ensure that hydra-zen's source code and test suite scan clean
under pyright, and that hydra-zen's public API has a 100 prcnt
type-completeness score.
usedevelop = true
basepython = python3.9
deps =
Expand All @@ -218,6 +233,9 @@ commands = pyright --lib tests/annotations/ src/
pyright --ignoreexternal --verifytypes hydra_zen

[testenv:format]
description = Applies auto-flake (e.g. remove unsused imports), black, and isort
in-place on source files and test suite. Running this can help fix a
failing `enforce-format` run.
skip_install=true
deps =
autoflake
Expand All @@ -228,14 +246,9 @@ commands =
isort src/ tests/
black src/ tests/

[testenv:docs]
basepython=python3.9
changedir=docs
deps=-r{toxinidir}/docs/requirements.txt
commands=
sphinx-build -b html -d {envtmpdir}/doctrees ./source {envdir}/build/html

[testenv:enforce-format]
description = Ensures that source materials code and docs and test suite adhere to
formatting and code-quality standards.
skip_install=true
basepython=python3.9
deps=black
Expand All @@ -249,4 +262,13 @@ commands=
flake8 src/ tests/
codespell src/ docs/
pytest project_tooling/test_headers.py

[testenv:docs]
description = Uses Sphinx to generate html for the jatic-toolbox's docs. Stores the
results in `.tox/docs/build/html/`.
basepython=python3.9
changedir=docs
deps=-r{toxinidir}/docs/requirements.txt
commands=
sphinx-build -b html -d {envtmpdir}/doctrees ./source {envdir}/build/html
"""