-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
executable file
·46 lines (38 loc) · 1.4 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
#!/usr/bin/env python3
# to install locally: `pip install -e .`
# to install latest from pypi: `pip3 install -U --upgrade-strategy=eager --no-cache-dir kpa`
# to publish: `./setup.py publish`
from setuptools import setup
import importlib.util, types, sys
def load_module_from_path(filepath:str) -> types.ModuleType:
module_name = filepath.split('/')[-1].removesuffix('.py')
spec = importlib.util.spec_from_file_location(module_name, filepath); assert spec and spec.loader
module = importlib.util.module_from_spec(spec); assert module
spec.loader.exec_module(module)
return module
version = load_module_from_path('kpa/version.py').version
if sys.argv[-1] in ['publish', 'pub']:
pypi_utils = load_module_from_path('kpa/pypi_utils.py')
pypi_utils.upload_package(package_name='Kpa')
sys.exit(0)
setup(
name='Kpa',
version=version,
description="Simple python utils",
author="Peter VandeHaar",
author_email="[email protected]",
url="https://github.com/pjvandehaar/kpa",
classifiers=[
'Programming Language :: Python :: 3 :: Only',
'Operating System :: Unix',
],
package_data={'kpa': ['py.typed']}, # tells mypy this has types
packages=['kpa'],
entry_points={'console_scripts': [
'kpa=kpa.command_line:main',
]},
include_package_data=True,
zip_safe=False,
python_requires=">=3.6",
install_requires=[],
)