sync up May15 2023

This commit is contained in:
amdsc21
2023-05-15 18:59:18 +02:00
37 changed files with 628 additions and 398 deletions

View File

@@ -1,26 +0,0 @@
[MASTER]
ignore=tests
extension-pkg-whitelist=numpy
disable=unexpected-special-method-signature,too-many-nested-blocks,useless-object-inheritance,import-outside-toplevel,unsubscriptable-object,attribute-defined-outside-init
dummy-variables-rgx=(unused|)_.*
reports=no
[BASIC]
# Enforce naming convention
const-naming-style=UPPER_CASE
class-naming-style=PascalCase
function-naming-style=snake_case
method-naming-style=snake_case
attr-naming-style=snake_case
argument-naming-style=snake_case
variable-naming-style=snake_case
class-attribute-naming-style=snake_case
# Allow single-letter variables
variable-rgx=[a-zA-Z_][a-z0-9_]{0,30}$

View File

@@ -26,23 +26,18 @@ class BuildConfiguration: # pylint: disable=R0902
# Special option: See explanation below
use_system_libxgboost: bool = False
def _set_config_setting(
self, config_settings: Dict[str, Any], field_name: str
) -> None:
if field_name in config_settings:
def _set_config_setting(self, config_settings: Dict[str, Any]) -> None:
for field_name in config_settings:
setattr(
self,
field_name,
(config_settings[field_name].lower() in ["true", "1", "on"]),
)
else:
raise ValueError(f"Field {field_name} is not a valid config_settings")
def update(self, config_settings: Optional[Dict[str, Any]]) -> None:
"""Parse config_settings from Pip (or other PEP 517 frontend)"""
if config_settings is not None:
for field_name in [x.name for x in dataclasses.fields(self)]:
self._set_config_setting(config_settings, field_name)
self._set_config_setting(config_settings)
def get_cmake_args(self) -> List[str]:
"""Convert build configuration to CMake args"""

View File

@@ -130,20 +130,21 @@ def locate_or_build_libxgboost(
"""Locate libxgboost; if not exist, build it"""
logger = logging.getLogger("xgboost.packager.locate_or_build_libxgboost")
libxgboost = locate_local_libxgboost(toplevel_dir, logger=logger)
if libxgboost is not None:
return libxgboost
if build_config.use_system_libxgboost:
# Find libxgboost from system prefix
sys_prefix = pathlib.Path(sys.prefix).absolute().resolve()
libxgboost = sys_prefix / "lib" / _lib_name()
if not libxgboost.exists():
libxgboost_sys = sys_prefix / "lib" / _lib_name()
if not libxgboost_sys.exists():
raise RuntimeError(
f"use_system_libxgboost was specified but {_lib_name()} is "
f"not found in {libxgboost.parent}"
f"not found in {libxgboost_sys.parent}"
)
logger.info("Using system XGBoost: %s", str(libxgboost))
logger.info("Using system XGBoost: %s", str(libxgboost_sys))
return libxgboost_sys
libxgboost = locate_local_libxgboost(toplevel_dir, logger=logger)
if libxgboost is not None:
return libxgboost
if toplevel_dir.joinpath("cpp_src").exists():

View File

@@ -79,7 +79,8 @@ def build_wheel(
libxgboost = locate_or_build_libxgboost(
TOPLEVEL_DIR, build_dir=build_dir, build_config=build_config
)
copy_with_logging(libxgboost, lib_path, logger=logger)
if not build_config.use_system_libxgboost:
copy_with_logging(libxgboost, lib_path, logger=logger)
with cd(workspace):
wheel_name = hatchling.build.build_wheel(

View File

@@ -9,13 +9,13 @@ build-backend = "packager.pep517"
name = "xgboost"
version = "2.0.0-dev"
authors = [
{name = "Hyunsu Cho", email = "chohyu01@cs.washington.edu"},
{name = "Jiaming Yuan", email = "jm.yuan@outlook.com"}
{ name = "Hyunsu Cho", email = "chohyu01@cs.washington.edu" },
{ name = "Jiaming Yuan", email = "jm.yuan@outlook.com" }
]
description = "XGBoost Python Package"
readme = {file = "README.rst", content-type = "text/x-rst"}
readme = { file = "README.rst", content-type = "text/x-rst" }
requires-python = ">=3.8"
license = {text = "Apache-2.0"}
license = { text = "Apache-2.0" }
classifiers = [
"License :: OSI Approved :: Apache Software License",
"Development Status :: 5 - Production/Stable",
@@ -24,13 +24,18 @@ classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10"
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11"
]
dependencies = [
"numpy",
"scipy"
]
[project.urls]
documentation = "https://xgboost.readthedocs.io/en/stable/"
repository = "https://github.com/dmlc/xgboost"
[project.optional-dependencies]
pandas = ["pandas"]
scikit-learn = ["scikit-learn"]
@@ -40,3 +45,39 @@ plotting = ["graphviz", "matplotlib"]
pyspark = ["pyspark", "scikit-learn", "cloudpickle"]
[tool.hatch.build.targets.wheel.hooks.custom]
[tool.isort]
profile = "black"
[tool.mypy]
ignore_missing_imports = true
disallow_untyped_defs = true
follow_imports = "silent"
[tool.pylint.main]
ignore = ["tests"]
extension-pkg-whitelist = ["numpy"]
disable = [
"attribute-defined-outside-init",
"import-outside-toplevel",
"too-many-nested-blocks",
"unexpected-special-method-signature",
"unsubscriptable-object",
"useless-object-inheritance"
]
dummy-variables-rgx = "(unused|)_.*"
reports = false
[tool.pylint.basic]
# Enforce naming convention
const-naming-style = "UPPER_CASE"
class-naming-style = "PascalCase"
function-naming-style = "snake_case"
method-naming-style = "snake_case"
attr-naming-style = "snake_case"
argument-naming-style = "snake_case"
variable-naming-style = "snake_case"
class-attribute-naming-style = "snake_case"
# Allow single-letter variables
variable-rgx = "[a-zA-Z_][a-z0-9_]{0,30}$"

View File

@@ -1,7 +0,0 @@
[metadata]
description_file = README.rst
[mypy]
ignore_missing_imports = True
disallow_untyped_defs = True
follow_imports = silent