forked from facebookresearch/hydra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
128 lines (112 loc) · 3.79 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# type: ignore
import codecs
import os
import re
import shutil
from distutils import cmd
from os.path import exists, isdir, join
from typing import Any, List
from setuptools import find_packages, setup
here = os.path.abspath(os.path.dirname(__file__))
def read(*parts):
with codecs.open(os.path.join(here, *parts), "r") as fp:
return fp.read()
def find_version(*file_paths):
version_file = read(*file_paths)
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version string.")
class CleanCommand(cmd.Command):
"""
Our custom command to clean out junk files.
"""
description = "Cleans out junk files we don't want in the repo"
user_options: List[Any] = []
def initialize_options(self):
pass
def finalize_options(self):
pass
@staticmethod
def find(root, includes, excludes=[]):
res = []
for parent, dirs, files in os.walk(root):
for f in dirs + files:
add = list()
for include in includes:
if re.findall(include, f):
add.append(join(parent, f))
res.extend(add)
final_list = []
# Exclude things that matches an exclude pattern
for ex in excludes:
for file in res:
if not re.findall(ex, file):
final_list.append(file)
return final_list
def run(self):
delete_patterns = [
".eggs",
".egg-info",
".pytest_cache",
"build",
"dist",
"__pycache__",
".pyc",
]
deletion_list = CleanCommand.find(
".", includes=delete_patterns, excludes=["\\.nox/.*"]
)
for f in deletion_list:
if exists(f):
if isdir(f):
shutil.rmtree(f, ignore_errors=True)
else:
os.unlink(f)
with open("README.md", "r") as fh:
LONG_DESC = fh.read()
setup(
cmdclass={"clean": CleanCommand},
name="hydra-core",
version=find_version("hydra", "__init__.py"),
author="Omry Yadan",
author_email="[email protected]",
description="A framework for elegantly configuring complex applications",
long_description=LONG_DESC,
long_description_content_type="text/markdown",
url="https://github.com/facebookresearch/hydra",
keywords="command-line configuration yaml tab-completion",
packages=find_packages(),
include_package_data=True,
classifiers=[
"License :: OSI Approved :: MIT License",
"Development Status :: 4 - Beta",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows",
],
install_requires=["omegaconf>=2.0.0rc4", "typing_extensions"],
# Install development dependencies with
# pip install -e .[dev]
extras_require={
"dev": [
"black",
"coverage",
"flake8",
"flake8-copyright",
"isort@git+git://github.com/timothycrosley/isort.git@c54b3dd#egg=isort",
"mypy",
"nox",
"pre-commit",
"pytest",
"pytest-snail",
"setuptools",
"towncrier",
"twine",
]
},
)