named
Advanced tools
+31
-3
@@ -26,6 +26,34 @@ """Named types. | ||
| __license__ = "MIT" | ||
| __version__ = "1.1.0" | ||
| __version__ = "1.2.0" | ||
| from named.typing import NAME, Named, get_name, get_type_name, is_named | ||
| from named.typing import ( | ||
| MODULE, | ||
| NAME, | ||
| Moduled, | ||
| Named, | ||
| get_module, | ||
| get_name, | ||
| get_type_module, | ||
| get_type_name, | ||
| has_module, | ||
| has_name, | ||
| is_moduled, | ||
| is_named, | ||
| ) | ||
| __all__ = ("NAME", "Named", "get_name", "get_type_name", "is_named") | ||
| __all__ = ( | ||
| # named | ||
| "NAME", | ||
| "Named", | ||
| "get_name", | ||
| "get_type_name", | ||
| "has_name", | ||
| "is_named", | ||
| # moduled | ||
| "MODULE", | ||
| "Moduled", | ||
| "get_module", | ||
| "get_type_module", | ||
| "has_module", | ||
| "is_moduled", | ||
| ) |
+72
-1
@@ -6,3 +6,18 @@ from builtins import hasattr as has_attribute | ||
| __all__ = ("NAME", "Named", "get_name", "get_type_name", "is_named") | ||
| __all__ = ( | ||
| # named | ||
| "NAME", | ||
| "Named", | ||
| "get_name", | ||
| "get_type_name", | ||
| "has_name", | ||
| "is_named", | ||
| # moduled | ||
| "MODULE", | ||
| "Moduled", | ||
| "get_module", | ||
| "get_type_module", | ||
| "has_module", | ||
| "is_moduled", | ||
| ) | ||
@@ -17,2 +32,3 @@ | ||
| """The named protocol for types that contain the `__name__` attribute.""" | ||
| __name__: str | ||
@@ -55,1 +71,56 @@ | ||
| return has_attribute(item, NAME) | ||
| has_name = is_named | ||
| """An alias of [`is_named`][named.typing.is_named].""" | ||
| MODULE = "__module__" | ||
| """The literal `__module__` string.""" | ||
| @runtime_checkable | ||
| class Moduled(Protocol): | ||
| """The moduled protocol for types that contain the `__module__` attribute.""" | ||
| __module__: str | ||
| def get_module(item: Moduled) -> str: | ||
| """Fetches the `__module__` of the [`Moduled`][named.typing.Moduled] `item`. | ||
| Arguments: | ||
| item: The item to fetch the module of. | ||
| Returns: | ||
| The module of the item. | ||
| """ | ||
| return item.__module__ | ||
| def get_type_module(item: Any) -> str: | ||
| """Fetches the `__module__` of the `item` type. | ||
| Arguments: | ||
| item: The item to fetch the type module of. | ||
| Returns: | ||
| The module of the item type. | ||
| """ | ||
| return get_module(type(item)) # type: ignore | ||
| def is_moduled(item: Any) -> TypeGuard[Moduled]: | ||
| """Checks if the `item` implements the [`Moduled`][named.typing.Moduled] protocol. | ||
| Arguments: | ||
| item: The item to check. | ||
| Returns: | ||
| Whether the item implements the [`Moduled`][named.typing.Moduled] protocol. | ||
| """ | ||
| return has_attribute(item, MODULE) | ||
| has_module = is_moduled | ||
| """An alias of [`is_moduled`][named.typing.is_moduled].""" |
+3
-3
| Metadata-Version: 2.1 | ||
| Name: named | ||
| Version: 1.1.0 | ||
| Version: 1.2.0 | ||
| Summary: Named types. | ||
@@ -22,3 +22,3 @@ Home-page: https://github.com/nekitdev/named | ||
| Classifier: Typing :: Typed | ||
| Requires-Dist: typing-extensions (>=4.3.0) | ||
| Requires-Dist: typing-extensions (>=4.5.0) | ||
| Project-URL: Documentation, https://nekitdev.github.io/named | ||
@@ -77,3 +77,3 @@ Project-URL: Discord, https://nekit.dev/discord | ||
| [tool.poetry.dependencies] | ||
| named = "^1.1.0" | ||
| named = "^1.2.0" | ||
| ``` | ||
@@ -80,0 +80,0 @@ |
+23
-15
| [tool.poetry] | ||
| name = "named" | ||
| version = "1.1.0" | ||
| version = "1.2.0" | ||
| description = "Named types." | ||
@@ -34,3 +34,3 @@ authors = ["nekitdev"] | ||
| python = ">= 3.7" | ||
| typing-extensions = ">= 4.3.0" | ||
| typing-extensions = ">= 4.5.0" | ||
@@ -41,7 +41,12 @@ [tool.poetry.group.format] | ||
| [tool.poetry.group.format.dependencies] | ||
| black = "22.8.0" | ||
| black = "23.3.0" | ||
| flake8-pyproject = "1.2.3" | ||
| [tool.poetry.group.format.dependencies.flake8] | ||
| version = "6.0.0" | ||
| python = ">= 3.8.1" | ||
| [tool.poetry.group.format.dependencies.isort] | ||
| version = "5.10.1" | ||
| python = "^3.7" | ||
| version = "5.12.0" | ||
| python = ">= 3.8" | ||
@@ -52,3 +57,3 @@ [tool.poetry.group.check] | ||
| [tool.poetry.group.check.dependencies] | ||
| mypy = "0.982" | ||
| mypy = "1.3.0" | ||
@@ -59,4 +64,4 @@ [tool.poetry.group.test] | ||
| [tool.poetry.group.test.dependencies] | ||
| pytest = "7.1.3" | ||
| pytest-cov = "3.0.0" | ||
| pytest = "7.3.1" | ||
| pytest-cov = "4.0.0" | ||
@@ -67,11 +72,11 @@ [tool.poetry.group.docs] | ||
| [tool.poetry.group.docs.dependencies] | ||
| mkdocs = "1.3.1" | ||
| mkdocs-material = "8.5.3" | ||
| mkdocs = "1.4.3" | ||
| mkdocs-material = "9.1.14" | ||
| [tool.poetry.group.docs.dependencies.mkdocstrings] | ||
| version = "0.19.0" | ||
| version = "0.21.2" | ||
| extras = ["python"] | ||
| [tool.poetry.group.dev.dependencies] | ||
| changelogging = "1.0.0" | ||
| changelogging = "1.3.0" | ||
@@ -81,2 +86,5 @@ [tool.black] | ||
| [tool.flake8] | ||
| max_line_length = 100 | ||
| [tool.isort] | ||
@@ -100,3 +108,3 @@ line_length = 100 | ||
| "@overload", | ||
| "@abstractmethod", | ||
| "@required", | ||
| "raise NotImplementedError", | ||
@@ -137,3 +145,3 @@ "raise AssertionError", | ||
| name = "named" | ||
| version = "1.1.0" | ||
| version = "1.2.0" | ||
| url = "https://github.com/nekitdev/named" | ||
@@ -155,3 +163,3 @@ directory = "changes" | ||
| [build-system] | ||
| requires = ["poetry-core >= 1.3.2"] | ||
| requires = ["poetry-core >= 1.5.2"] | ||
| build-backend = "poetry.core.masonry.api" |
+1
-1
@@ -47,3 +47,3 @@ # `named` | ||
| [tool.poetry.dependencies] | ||
| named = "^1.1.0" | ||
| named = "^1.2.0" | ||
| ``` | ||
@@ -50,0 +50,0 @@ |
-30
| # -*- coding: utf-8 -*- | ||
| from setuptools import setup | ||
| packages = \ | ||
| ['named'] | ||
| package_data = \ | ||
| {'': ['*']} | ||
| install_requires = \ | ||
| ['typing-extensions>=4.3.0'] | ||
| setup_kwargs = { | ||
| 'name': 'named', | ||
| 'version': '1.1.0', | ||
| 'description': 'Named types.', | ||
| 'long_description': '# `named`\n\n[![License][License Badge]][License]\n[![Version][Version Badge]][Package]\n[![Downloads][Downloads Badge]][Package]\n[![Discord][Discord Badge]][Discord]\n\n[![Documentation][Documentation Badge]][Documentation]\n[![Check][Check Badge]][Actions]\n[![Test][Test Badge]][Actions]\n[![Coverage][Coverage Badge]][Coverage]\n\n> *Named types.*\n\n## Installing\n\n**Python 3.7 or above is required.**\n\n### pip\n\nInstalling the library with `pip` is quite simple:\n\n```console\n$ pip install named\n```\n\nAlternatively, the library can be installed from source:\n\n```console\n$ git clone https://github.com/nekitdev/named.git\n$ cd named\n$ python -m pip install .\n```\n\n### poetry\n\nYou can add `named` as a dependency with the following command:\n\n```console\n$ poetry add named\n```\n\nOr by directly specifying it in the configuration like so:\n\n```toml\n[tool.poetry.dependencies]\nnamed = "^1.1.0"\n```\n\nAlternatively, you can add it directly from the source:\n\n```toml\n[tool.poetry.dependencies.named]\ngit = "https://github.com/nekitdev/named.git"\n```\n\n## Example\n\n```python\n>>> from named import get_name, get_type_name, is_named\n>>> print(is_named(int))\nTrue\n>>> print(get_name(int))\nint\n>>> print(is_named(42))\nFalse\n>>> print(get_type_name(42))\nint\n```\n\n## Documentation\n\nYou can find the documentation [here][Documentation].\n\n## Support\n\nIf you need support with the library, you can send an [email][Email]\nor refer to the official [Discord server][Discord].\n\n## Changelog\n\nYou can find the changelog [here][Changelog].\n\n## Security Policy\n\nYou can find the Security Policy of `named` [here][Security].\n\n## Contributing\n\nIf you are interested in contributing to `named`, make sure to take a look at the\n[Contributing Guide][Contributing Guide], as well as the [Code of Conduct][Code of Conduct].\n\n## License\n\n`named` is licensed under the MIT License terms. See [License][License] for details.\n\n[Email]: mailto:support@nekit.dev\n\n[Discord]: https://nekit.dev/discord\n\n[Actions]: https://github.com/nekitdev/named/actions\n\n[Changelog]: https://github.com/nekitdev/named/blob/main/CHANGELOG.md\n[Code of Conduct]: https://github.com/nekitdev/named/blob/main/CODE_OF_CONDUCT.md\n[Contributing Guide]: https://github.com/nekitdev/named/blob/main/CONTRIBUTING.md\n[Security]: https://github.com/nekitdev/named/blob/main/SECURITY.md\n\n[License]: https://github.com/nekitdev/named/blob/main/LICENSE\n\n[Package]: https://pypi.org/project/named\n[Coverage]: https://codecov.io/gh/nekitdev/named\n[Documentation]: https://nekitdev.github.io/named\n\n[Discord Badge]: https://img.shields.io/badge/chat-discord-5865f2\n[License Badge]: https://img.shields.io/pypi/l/named\n[Version Badge]: https://img.shields.io/pypi/v/named\n[Downloads Badge]: https://img.shields.io/pypi/dm/named\n\n[Documentation Badge]: https://github.com/nekitdev/named/workflows/docs/badge.svg\n[Check Badge]: https://github.com/nekitdev/named/workflows/check/badge.svg\n[Test Badge]: https://github.com/nekitdev/named/workflows/test/badge.svg\n[Coverage Badge]: https://codecov.io/gh/nekitdev/named/branch/main/graph/badge.svg\n', | ||
| 'author': 'nekitdev', | ||
| 'author_email': 'None', | ||
| 'maintainer': 'None', | ||
| 'maintainer_email': 'None', | ||
| 'url': 'https://github.com/nekitdev/named', | ||
| 'packages': packages, | ||
| 'package_data': package_data, | ||
| 'install_requires': install_requires, | ||
| 'python_requires': '>=3.7', | ||
| } | ||
| setup(**setup_kwargs) |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
133
46.15%15311
-11.13%7
-12.5%