-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
89 lines (66 loc) · 2.22 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
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019 Rich Lewis <[email protected]>
# License: MIT
import shlex
import sys
from setuptools import Command
from setuptools import find_packages
from setuptools import setup
from setuptools.command.test import test as TestCommand
class Flake8Command(Command):
""" Command to lint code with Flake8 """
user_options = [("flake8-args-", "a", "Arguments to pass to flake8")]
def initialize_options(self):
self.flake_args = ""
def finalize_options(self):
pass
def run(self):
from flake8.main.cli import main
main(shlex.split(self.flake_args))
class BlackCommand(Command):
""" Command to format code with Black """
user_options = [("black-args-", "a", "Arguments to pass to black")]
def initialize_options(self):
self.black_args = "."
def finalize_options(self):
pass
def run(self):
import black
black.main(shlex.split(self.black_args))
class PyTestCommand(TestCommand):
""" command to run tests using pytest """
user_options = [("pytest-args-", "a", "arguments to pass to pytest")]
def initialize_options(self):
super().initialize_options()
self.pytest_args = ""
def run_tests(self):
import pytest
errno = pytest.main(shlex.split(self.pytest_args))
sys.exit(errno)
if __name__ == "__main__":
setup(
name="jagged-array",
version="0.0.1-dev.0",
packages=find_packages(),
author="Rich Lewis",
author_email="[email protected]",
description="Multidimensional [jr]agged array support for the PyData ecosystem",
license="MIT",
keywords="jagged ragged multidimensional array",
url="https://github.com/lewisacidic/jagged",
install_requires=["numpy"],
tests_require=["pytest", "pytest-cov", "pytest-flake8"],
extras_require={
"dev": [
"pytest",
"black",
"flake8",
"pytest-cov",
"pytest-flake8",
"pytest-cov",
]
},
cmdclass={"test": PyTestCommand, "format": BlackCommand, "lint": Flake8Command},
)