-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consolidate config to pyproject only, and update packaging (#453)
- Now uses ruff for isort, formatting and linting - Everything merged down to pyproject.toml - Updated CI to use new tooling
- Loading branch information
Showing
11 changed files
with
151 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from __future__ import annotations | ||
|
||
import subprocess | ||
import json | ||
|
||
failures = 0 | ||
try: | ||
output = subprocess.run( | ||
["ruff", "check", "--exit-zero", "--output-format", "json", "."], | ||
capture_output=True, | ||
check=True, | ||
timeout=300, | ||
) | ||
except (subprocess.CalledProcessError, subprocess.TimeoutExpired) as e: | ||
print( | ||
"##vso[task.logissue type=error;]ruff validation failed with", | ||
str(e.__class__.__name__), | ||
) | ||
print(e.stdout) | ||
print(e.stderr) | ||
print("##vso[task.complete result=Failed;]ruff validation failed") | ||
exit() | ||
|
||
results = json.loads(output.stdout) | ||
|
||
for violation in results: | ||
# filename, lineno, column, error = line.split(":", maxsplit=3) | ||
# errcode, error = error.strip().split(" ", maxsplit=1) | ||
# filename = os.path.normpath(filename) | ||
failures += 1 | ||
print( | ||
f"##vso[task.logissue type=error;sourcepath={violation['filename']};" | ||
f"linenumber={violation['location']['row']};columnnumber={violation['location']['column']};code={violation['code']};]" | ||
+ violation["message"] | ||
) | ||
|
||
if failures: | ||
print(f"##vso[task.logissue type=warning]Found {failures} ruff violation(s)") | ||
print(f"##vso[task.complete result=Failed;]Found {failures} ruff violation(s)") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
pytest plugin functions | ||
""" | ||
|
||
|
||
from __future__ import annotations | ||
|
||
import pytest | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,100 @@ | ||
[build-system] | ||
requires = ["setuptools >= 40.6.0", "wheel"] | ||
requires = ["setuptools>=61.2"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "dials_data" | ||
version = "2.4.0" | ||
description = "DIALS Regression Data Manager" | ||
authors = [ | ||
{ name = "DIALS development team", email = "[email protected]" }, | ||
] | ||
license = { text = "BSD 3-Clause License" } | ||
classifiers = [ | ||
"Development Status :: 5 - Production/Stable", | ||
"Intended Audience :: Developers", | ||
"License :: OSI Approved :: BSD License", | ||
"Natural Language :: English", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
] | ||
keywords = ["dials", "dials_data"] | ||
dynamic = ["readme"] | ||
requires-python = ">=3.8" | ||
dependencies = ["importlib_resources>=1.1,<6.2", "pytest", "pyyaml", "requests"] | ||
|
||
[project.urls] | ||
Homepage = "https://github.com/dials/data" | ||
"Bug Tracker" = "https://github.com/dials/data/issues" | ||
Documentation = "https://dials-data.readthedocs.io/" | ||
"Source Code" = "https://github.com/dials/data" | ||
|
||
[project.entry-points] | ||
"libtbx.dispatcher.script" = { "dials.data" = "dials.data" } | ||
"libtbx.precommit" = { dials_data = "dials_data" } | ||
pytest11 = { dials_data = "dials_data.pytest11" } | ||
|
||
[project.scripts] | ||
"dials.data" = "dials_data.cli:main" | ||
|
||
[tool.setuptools] | ||
include-package-data = true | ||
zip-safe = false | ||
license-files = ["LICENSE"] | ||
|
||
[tool.setuptools.packages] | ||
find = { namespaces = false } | ||
|
||
[tool.setuptools.package-data] | ||
dials_data = ["py.typed"] | ||
|
||
[tool.setuptools.dynamic] | ||
readme = { file = ["README.rst", "HISTORY.rst"], content-type = "text/x-rst" } | ||
|
||
[tool.ruff.lint] | ||
# Black disagrees with flake8 on a few points. Ignore those. | ||
# E203 whitespace before ':' | ||
# E266 too many leading '#' for block comment | ||
# E501 line too long | ||
ignore = ["E203", "E266", "E501"] | ||
|
||
select = [ | ||
"E401", | ||
"E711", | ||
"E712", | ||
"E713", | ||
"E714", | ||
"E721", | ||
"E722", | ||
"F401", | ||
"F402", | ||
"F403", | ||
"F405", | ||
"F541", | ||
"F631", | ||
"F632", | ||
"F633", | ||
"F811", | ||
"F821", | ||
"F822", | ||
"F841", | ||
"F901", | ||
"W191", | ||
"W291", | ||
"W292", | ||
"W293", | ||
"W605", | ||
"C4", | ||
] | ||
# For converting to pyproject/ruff, only duplicate isort. Can add more later. | ||
fixable = ["I"] | ||
|
||
[tool.ruff.lint.isort] | ||
required-imports = ["from __future__ import annotations"] | ||
|
||
[[tool.mypy.overrides]] | ||
module = [ "py", "py.path", "pytest", "importlib_resources" ] | ||
module = ["py", "py.path", "pytest", "importlib_resources"] | ||
ignore_missing_imports = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
collective.checkdocs==0.2 | ||
coverage==7.3.1 | ||
importlib_resources==6.0.1 | ||
py==1.11.0 | ||
|
Oops, something went wrong.