Skip to content

Commit

Permalink
Lint setup.py (mlflow#11167)
Browse files Browse the repository at this point in the history
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
Signed-off-by: Arthur Jenoudet <arthur.jenoudet@databricks.com>
  • Loading branch information
harupy authored and artjen committed Mar 26, 2024
1 parent 5e22438 commit 7c25ad0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
1 change: 0 additions & 1 deletion pyproject.toml
Expand Up @@ -20,7 +20,6 @@ target-version = "py38"
force-exclude = true
extend-include = ["*.ipynb"]
extend-exclude = [
"setup.py",
"examples/recipes",
"mlflow/protos",
"mlflow/ml_package_versions.py",
Expand Down
19 changes: 12 additions & 7 deletions setup.py
@@ -1,8 +1,9 @@
import os
import logging
from pathlib import Path
import os
from importlib.machinery import SourceFileLoader
from setuptools import setup, find_packages, Command
from pathlib import Path

from setuptools import find_packages, setup

_MLFLOW_SKINNY_ENV_VAR = "MLFLOW_SKINNY"

Expand Down Expand Up @@ -74,7 +75,7 @@ def remove_comments_and_empty_lines(lines):
GATEWAY_REQUIREMENTS = remove_comments_and_empty_lines(f.read().splitlines())

_is_mlflow_skinny = bool(os.environ.get(_MLFLOW_SKINNY_ENV_VAR))
logging.debug("{} env var is set: {}".format(_MLFLOW_SKINNY_ENV_VAR, _is_mlflow_skinny))
logging.debug(f"{_MLFLOW_SKINNY_ENV_VAR} env var is set: {_is_mlflow_skinny}")

MINIMUM_SUPPORTED_PYTHON_VERSION = Path("requirements", "python-version.txt").read_text().strip()

Expand All @@ -87,6 +88,12 @@ def remove_comments_and_empty_lines(lines):
*recipes_files,
]

with open("README_SKINNY.rst") as f:
README_SKINNY = f.read()

with open("README.rst") as f:
README = f.read()

setup(
name="mlflow" if not _is_mlflow_skinny else "mlflow-skinny",
version=version,
Expand Down Expand Up @@ -162,9 +169,7 @@ def remove_comments_and_empty_lines(lines):
zip_safe=False,
author="Databricks",
description="MLflow: A Platform for ML Development and Productionization",
long_description=open("README.rst").read()
if not _is_mlflow_skinny
else open("README_SKINNY.rst").read() + open("README.rst").read(),
long_description=README if not _is_mlflow_skinny else README_SKINNY + README,
long_description_content_type="text/x-rst",
license="Apache License 2.0",
classifiers=[
Expand Down
3 changes: 1 addition & 2 deletions tests/resources/mlflow-test-plugin/setup.py
@@ -1,5 +1,4 @@
from setuptools import setup, find_packages

from setuptools import find_packages, setup

setup(
name="mlflow-test-plugin",
Expand Down

0 comments on commit 7c25ad0

Please sign in to comment.