From 84bc016f2720103273bed56aa186cceeed09691e Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Mon, 2 Nov 2020 00:13:56 -0800 Subject: [PATCH] move to multi-file module (required for type checking) --- lethe/VERSION.py | 4 ++++ lethe/__init__.py | 12 ++++++++++++ lethe/__main__.py | 4 ++++ lethe.py => lethe/lethe.py | 4 ---- lethe/py.typed | 0 setup.py | 17 ++++++++++++----- 6 files changed, 32 insertions(+), 9 deletions(-) create mode 100644 lethe/VERSION.py create mode 100644 lethe/__init__.py create mode 100644 lethe/__main__.py rename lethe.py => lethe/lethe.py (99%) create mode 100644 lethe/py.typed diff --git a/lethe/VERSION.py b/lethe/VERSION.py new file mode 100644 index 0000000..9de6fb9 --- /dev/null +++ b/lethe/VERSION.py @@ -0,0 +1,4 @@ +""" VERSION defintion. THIS FILE IS MANUALLY PARSED BY setup.py and REQUIRES A SPECIFIC FORMAT """ +__version__ = ''' +0.7 +''' diff --git a/lethe/__init__.py b/lethe/__init__.py new file mode 100644 index 0000000..337e2b9 --- /dev/null +++ b/lethe/__init__.py @@ -0,0 +1,12 @@ +""" +Git snapshotting tool +""" +from .lethe import ( + main, snap, snap_ref, snap_tree, find_merge_base, deref_symref, + update_ref, commit_tree, get_tree, get_commit, get_obj, get_root, get_latest_commit, + shorten_hash, _run, + ) + +from .VERSION import __version__ + +__author__ = 'Jan Petykeiwicz' diff --git a/lethe/__main__.py b/lethe/__main__.py new file mode 100644 index 0000000..ff534a2 --- /dev/null +++ b/lethe/__main__.py @@ -0,0 +1,4 @@ +from .lethe import main + +if __name__ == '__main__': + main() diff --git a/lethe.py b/lethe/lethe.py similarity index 99% rename from lethe.py rename to lethe/lethe.py index 23f15e5..a1ac0c2 100755 --- a/lethe.py +++ b/lethe/lethe.py @@ -12,10 +12,6 @@ from itertools import chain import sys -__author__ = 'Jan Petykeiwicz' -__version__ = '0.8' - - def _run(command: Union[str, List[str]], **kwargs) -> str: """ Wrapper for subprocess.run(): diff --git a/lethe/py.typed b/lethe/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/setup.py b/setup.py index fffcae1..8a03a7b 100644 --- a/setup.py +++ b/setup.py @@ -1,18 +1,26 @@ #!/usr/bin/env python3 -from setuptools import setup +from setuptools import setup, find_packages -with open('README.md', 'r') as f: + +with open('README.md', 'rt') as f: long_description = f.read() +with open('lethe/VERSION.py', 'rt') as f: + version = f.readlines()[2].strip() + setup(name='lethe', - version='0.8', + version=version, description='Git-based snapshotting', long_description=long_description, long_description_content_type='text/markdown', author='Jan Petykiewicz', author_email='anewusername@gmail.com', - py_modules=['lethe'], + url='https://mpxd.net/code/jan/lethe', + packages=find_packages(), + package_data={ + 'lethe': ['py.typed'], + }, entry_points={ 'console_scripts': [ 'lethe=lethe:main', @@ -21,7 +29,6 @@ setup(name='lethe', install_requires=[ 'typing', ], - url='https://mpxd.net/code/jan/lethe', keywords=[ 'git', 'snapshot',