sync up May15 2023
This commit is contained in:
@@ -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}$
|
||||
@@ -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"""
|
||||
|
||||
@@ -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():
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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}$"
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
[metadata]
|
||||
description_file = README.rst
|
||||
|
||||
[mypy]
|
||||
ignore_missing_imports = True
|
||||
disallow_untyped_defs = True
|
||||
follow_imports = silent
|
||||
Reference in New Issue
Block a user