diff --git a/.gitignore b/.gitignore index b260254..be77165 100644 --- a/.gitignore +++ b/.gitignore @@ -161,3 +161,6 @@ cython_debug/ # Tests tests.py + +# PyPi +.pypirc \ No newline at end of file diff --git a/examples/udict.md b/examples/udict.md index 3033026..7a20df5 100644 --- a/examples/udict.md +++ b/examples/udict.md @@ -174,11 +174,9 @@ print(('hi', 1) in d) # True print(('hi', 11) in d) # False ``` -## Convert to `str` type and using in `print` +## Using in `repr()` method -### Print dict - -`print` uses `repr()` therefore `UDict` supports `repr()` +`print()` uses `repr()` therefore you can use `UDict`s in `print()` ```python d = UDict(hi=1, hello=2) @@ -186,15 +184,6 @@ print(d) # u{'hi': 1, 'hello': 2} print(repr(d)) # u{'hi': 1, 'hello': 2} ``` -### Convert to str - -You can use inbuilt `str()` class for converting `UDict` to `str` type - -```python -d = UDict(hi=1, hello=2) -print(str(d)) # {'hi': 1, 'hello': 2} -``` - ## Comparing dicts You can compare `UDict`s using inbuilt compare operators diff --git a/setup.py b/setup.py index 65ee341..93029ba 100644 --- a/setup.py +++ b/setup.py @@ -5,8 +5,9 @@ with open('README.md', 'r', encoding='utf-8') as mdf: long_description = mdf.read() -with open('requirements.txt', 'r', encoding='utf-8') as rqf: - install_requires = rqf.readlines() +install_requires = [ + +] organization_name = 'honey-team' author, author_email = 'bleudev', 'aitiiigg1@gmail.com' @@ -23,7 +24,7 @@ long_description=long_description, long_description_content_type='text/markdown', url=github_url, - packages=[project_name], + packages=[project_name, f'{project_name}.typ'], classifiers=[ 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.12', diff --git a/ufpy/__init__.py b/ufpy/__init__.py index f737223..830349f 100644 --- a/ufpy/__init__.py +++ b/ufpy/__init__.py @@ -1,8 +1,12 @@ -__version__ = '0.1.1' +__version__ = '0.1.1.2' -from .cmp import * -from .math_op import * -from .path_tools import * -from .udict import * -from .ustack import * -from .utils import * +# Typing package +from ufpy import typ +from ufpy.cmp import * +from ufpy.math_op import * +from ufpy.path_tools import * +from ufpy.typ.protocols import * +from ufpy.typ.type_alias import * +from ufpy.udict import * +from ufpy.ustack import * +from ufpy.utils import * diff --git a/ufpy/typ/__init__.py b/ufpy/typ/__init__.py index d5820fa..05dac70 100644 --- a/ufpy/typ/__init__.py +++ b/ufpy/typ/__init__.py @@ -1,2 +1,2 @@ -from .protocols import * -from .type_alias import * +from ufpy.typ.protocols import * +from ufpy.typ.type_alias import * diff --git a/ufpy/typ/type_alias.py b/ufpy/typ/type_alias.py index 374ae00..bcb1303 100644 --- a/ufpy/typ/type_alias.py +++ b/ufpy/typ/type_alias.py @@ -1,6 +1,6 @@ from typing import Never -from .protocols import LikeDict +from ufpy.typ.protocols import LikeDict __all__ = ( 'AnyCollection', diff --git a/ufpy/udict.py b/ufpy/udict.py index f5faa58..5bba9a5 100644 --- a/ufpy/udict.py +++ b/ufpy/udict.py @@ -2,10 +2,10 @@ from typing import Generic, Iterator, overload, TypeVar, Callable -from .cmp import cmp_generator -from .math_op import i_generator, r_generator -from .typ import AnyDict, AnyCollection -from .utils import set_items_for_several_keys, get_items_for_several_keys, del_items_for_several_keys +from ufpy.cmp import cmp_generator +from ufpy.math_op import i_generator, r_generator +from ufpy.typ import AnyDict, AnyCollection +from ufpy.utils import set_items_for_several_keys, get_items_for_several_keys, del_items_for_several_keys __all__ = ( 'UDict', @@ -243,9 +243,6 @@ def __contains__(self, item: tuple[KT, VT] | list[KT | VT] | KT) -> bool: return item in self.__dict # Transform to other types - def __str__(self) -> str: - return str(self.__dict) - def __repr__(self) -> str: return f'u{self.__dict}' diff --git a/ufpy/ustack.py b/ufpy/ustack.py index 14dcd8d..f8aad74 100644 --- a/ufpy/ustack.py +++ b/ufpy/ustack.py @@ -2,9 +2,9 @@ from typing import Generic, TypeVar, Iterable, Callable -from .cmp import cmp_generator -from .math_op import r_generator, i_generator -from .typ import AnyCollection, NumberLiteral, SupportsMul, SupportsTrueDiv, Empty +from ufpy.cmp import cmp_generator +from ufpy.math_op import r_generator, i_generator +from ufpy.typ import AnyCollection, NumberLiteral, SupportsMul, SupportsTrueDiv, Empty __all__ = ( "UStack", diff --git a/ufpy/utils.py b/ufpy/utils.py index a975752..3d3a984 100644 --- a/ufpy/utils.py +++ b/ufpy/utils.py @@ -6,7 +6,7 @@ from typing import TypeVar -from .typ import SupportsGet, SupportsSetItem, SupportsDelItem, AnyCollection +from ufpy.typ import SupportsGet, SupportsSetItem, SupportsDelItem, AnyCollection KT = TypeVar('KT') VT = TypeVar('VT') diff --git a/upload_testpypi.bat b/upload_testpypi.bat new file mode 100644 index 0000000..13d00e9 --- /dev/null +++ b/upload_testpypi.bat @@ -0,0 +1,10 @@ +@echo off +py -3.12 -m pip install --upgrade pip +py -3.12 -m pip install setuptools twine +py -3.12 setup.py sdist + +py -3.12 -m twine upload --repository testpypi dist\* + +rd /s /q ufpy.egg-info +rd /s /q dist +rd /s /q build