From 660438fddc863f485b7aee33f56ffe5f1f5b464f Mon Sep 17 00:00:00 2001 From: Aki Nitta Date: Wed, 26 May 2021 16:11:33 +0900 Subject: [PATCH] Make setup.py independent of flash (#339) * Make independent of flash * Exclude .git from flake8 check Co-authored-by: Justus Schock <12886177+justusschock@users.noreply.github.com> --- setup.cfg | 1 + setup.py | 33 +++++++++++++++++++++++++-------- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/setup.cfg b/setup.cfg index 20cb2c0fe5..428a383b7d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -46,6 +46,7 @@ exclude = build temp flash_notebooks + .git select = E,W,F doctests = True verbose = 2 diff --git a/setup.py b/setup.py index 8dc85d47cc..3fe52e9f28 100644 --- a/setup.py +++ b/setup.py @@ -1,29 +1,46 @@ #!/usr/bin/env python +# Copyright The PyTorch Lightning team. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import os from importlib.util import module_from_spec, spec_from_file_location from setuptools import find_packages, setup -import flash -import flash.__about__ as about - # https://packaging.python.org/guides/single-sourcing-package-version/ # http://blog.ionelmc.ro/2014/05/25/python-packaging/ -_PATH_ROOT = os.path.dirname(os.path.dirname(flash.__file__)) +_PATH_ROOT = os.path.dirname(__file__) +_PATH_REQUIRE = os.path.join(_PATH_ROOT, "requirements") def _load_py_module(fname, pkg="flash"): - spec = spec_from_file_location(os.path.join(pkg, fname), os.path.join(_PATH_ROOT, pkg, fname)) + spec = spec_from_file_location( + os.path.join(pkg, fname), + os.path.join(_PATH_ROOT, pkg, fname), + ) py = module_from_spec(spec) spec.loader.exec_module(py) return py +about = _load_py_module('__about__.py') setup_tools = _load_py_module('setup_tools.py') -long_description = setup_tools._load_readme_description(_PATH_ROOT, homepage=about.__homepage__, ver=about.__version__) - -_PATH_REQUIRE = os.path.join(_PATH_ROOT, "requirements") +long_description = setup_tools._load_readme_description( + _PATH_ROOT, + homepage=about.__homepage__, + ver=about.__version__, +) extras = { "docs": setup_tools._load_requirements(path_dir=_PATH_REQUIRE, file_name="docs.txt"),