diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1908067 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/.idea/ + +/moretools/__version__.py diff --git a/moretools/__init__.py b/moretools/__init__.py index 4551c4c..99cc64b 100644 --- a/moretools/__init__.py +++ b/moretools/__init__.py @@ -17,7 +17,7 @@ """MOREtools >>> MORE Overly Reusable Essentials for python.""" -__import__('zetup').toplevel(__name__, [ +__all__ = ( 'SimpleTree', 'StrictBool', 'dictitems', @@ -31,18 +31,34 @@ 'qualname', 'simpledict', 'strictbool', - # TODO: fill in rest! -], aliases={ - # six-like aliases for dict... functions - 'iteritems': 'dictitems', - 'iterkeys': 'dictkeys', - 'itervalues': 'dictvalues', -}, deprecated_aliases={ - 'Bool': 'StrictBool', - 'boolclass': 'strictbool', - 'booltype': 'strictbool', - 'isbooltype': 'isboolclass', -}) +) + +# __import__('zetup').toplevel(__name__, [ +# 'SimpleTree', +# 'StrictBool', +# 'dictitems', +# 'dictkeys', +# 'dictvalues', +# 'func_types', +# 'getfunc', +# 'isboolclass', +# 'isbool', +# 'isfunc', +# 'qualname', +# 'simpledict', +# 'strictbool', +# # TODO: fill in rest! +# ], aliases={ +# # six-like aliases for dict... functions +# 'iteritems': 'dictitems', +# 'iterkeys': 'dictkeys', +# 'itervalues': 'dictvalues', +# }, deprecated_aliases={ +# 'Bool': 'StrictBool', +# 'boolclass': 'strictbool', +# 'booltype': 'strictbool', +# 'isbooltype': 'isboolclass', +# }) def qualname(cls): diff --git a/moretools/_cached.py b/moretools/_cached.py index 3509fd8..19f028e 100644 --- a/moretools/_cached.py +++ b/moretools/_cached.py @@ -26,7 +26,7 @@ """ __all__ = ['cached'] -from inspect import getargspec +from inspect import getfullargspec from decorator import decorator @@ -34,7 +34,7 @@ def cached(func): - argspec = getargspec(func) + argspec = getfullargspec(func) try: # Python >= 3.5 varkw = argspec.varkw except AttributeError: diff --git a/moretools/_context.py b/moretools/_context.py index 6a545e0..6cc10b6 100644 --- a/moretools/_context.py +++ b/moretools/_context.py @@ -29,7 +29,7 @@ __all__ = ['multimethod'] import sys -from inspect import getargspec +from inspect import getfullargspec from decorator import decorator @@ -59,7 +59,7 @@ def multimethod(func): func_name = func.__name__ func_qualname = qualname(func) - argspec = getargspec(func) + argspec = getfullargspec(func) def caller(func, self, *args, **kwargs): if method.fenter is not None: diff --git a/moretools/_simpledict.py b/moretools/_simpledict.py index 703c1d5..b32fc7b 100644 --- a/moretools/_simpledict.py +++ b/moretools/_simpledict.py @@ -27,7 +27,7 @@ """ from six import with_metaclass -import zetup +# import zetup __all__ = [ 'SimpleDictType', 'SimpleFrozenDictType', 'SimpleDictStructType', @@ -64,7 +64,7 @@ def __init__(self, attrname, key, attr_from_key): AttrToKeyToAttrMismatch.__name__ = 'simpledict.AttrToKeyToAttrMismatch' -class SimpleDictMeta(zetup.meta): +class SimpleDictMeta(type): # zetup.meta): """The basic metaclass for :class:`SimpleDictType`. - Provides methods and attributes @@ -103,7 +103,7 @@ def _reverse_check_attr(cls, attrname, key): raise AttrToKeyToAttrMismatch(attrname, key, attr_from_key) -class SimpleDictType(with_metaclass(SimpleDictMeta, zetup.object)): +class SimpleDictType(metaclass=SimpleDictMeta): # with_metaclass(SimpleDictMeta, zetup.object)): """A simple *mapping* type providing item value access with `__getattr__`/`__setattr__`, using custom *key*<-->*attrname* conversion functions diff --git a/moretools/_simpletree.py b/moretools/_simpletree.py index 84cae8a..fdca7d2 100644 --- a/moretools/_simpletree.py +++ b/moretools/_simpletree.py @@ -4,7 +4,7 @@ from inspect import isclass from six import PY2, reraise, with_metaclass -import zetup +# import zetup import moretools from moretools import qualname @@ -14,7 +14,7 @@ __all__ = ('SimpleTree', ) -class ContextStack(zetup.object): +class ContextStack: # (zetup.object): def __init__(self, _type): self._list = [] @@ -45,7 +45,7 @@ def __repr__(self): return repr(self._list) -class SimpleTreeMeta(zetup.meta, ABCMeta): +class SimpleTreeMeta(ABCMeta): # zetup.meta, ABCMeta): """ Metaclass for abstract :class:`moretools.SimpleTree`. @@ -86,7 +86,7 @@ class root(cls): return root -class SimpleTree(with_metaclass(SimpleTreeMeta, zetup.object)): +class SimpleTree(metaclass=SimpleTreeMeta): # with_metaclass(SimpleTreeMeta, zetup.object)): r""" The simple yet powerful tree creation and processing factory. diff --git a/moretools/func.py b/moretools/func.py index 3458593..e87f190 100644 --- a/moretools/func.py +++ b/moretools/func.py @@ -4,7 +4,7 @@ from doctest import DocTestParser from inspect import isfunction -from zetup import apifunction +# from zetup import apifunction import moretools @@ -16,10 +16,10 @@ #: All types of ``function`` objects. -func_types = (types.BuiltinFunctionType, types.FunctionType, apifunction) +func_types = (types.BuiltinFunctionType, types.FunctionType) # , apifunction) -@apifunction(moretools) +# @apifunction(moretools) def isfunc(obj): """ Check if `obj` is a built-in/user ``function`` or ``zetup.apifunction``. @@ -56,7 +56,7 @@ def isfunc(obj): return isinstance(obj, func_types) -@apifunction(moretools) +# @apifunction(moretools) def getfunc(obj): """ Get the actual ``function`` object of any ``callable`` `obj`. diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..ea369ec --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,43 @@ +[build-system] +build-backend = 'hatchling.build' +requires = [ + 'hatch-vcs~=0.5.0', + "hatchling~=1.32.0", + "setuptools-scm~=10.2.1", +] + +[project] +name = 'moretools' +description = 'MORE Overly Reusable Essentials for python' +dynamic = ['version'] + +authors = [{ name = 'Stefan Zimmermann', email = 'user@zimmermann.co' }] +urls = { Repository = 'https://github.com/zimmermanncode/moretools'} +license = 'LGPL-3.0-or-later' +license-files = ['COPYING', 'COPYING.LESSER'] + +requires-python = '>=3.14.7' +dependencies = [ + 'decorator~=5.3.1', + "six~=1.17.0", +] + +[dependency-groups] +dev = [ + 'ipython~=9.18.1', + 'mypy~=2.3.1', + 'pre-commit~=4.6.2', + 'pytest~=9.1.1', + 'pytest-cov~=7.1.0', + 'ruff~=0.16.3', + 'setuptools-scm~=10.2.1', +] + +[tool.hatch.version] +source = 'vcs' + +[tool.hatch.build.hooks.vcs] +version-file = 'moretools/__version__.py' + +[tool.setuptools_scm] +version_file = 'moretools/__version__.py'