scverse-misc 0.0.2__tar.gz → 0.0.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. {scverse_misc-0.0.2 → scverse_misc-0.0.3}/.pre-commit-config.yaml +3 -3
  2. scverse_misc-0.0.3/CHANGELOG.md +30 -0
  3. {scverse_misc-0.0.2 → scverse_misc-0.0.3}/PKG-INFO +5 -4
  4. {scverse_misc-0.0.2 → scverse_misc-0.0.3}/README.md +1 -1
  5. {scverse_misc-0.0.2 → scverse_misc-0.0.3}/docs/api.md +9 -0
  6. {scverse_misc-0.0.2 → scverse_misc-0.0.3}/pyproject.toml +4 -3
  7. {scverse_misc-0.0.2 → scverse_misc-0.0.3}/src/scverse_misc/__init__.py +1 -0
  8. scverse_misc-0.0.3/src/scverse_misc/_deprecated.py +79 -0
  9. scverse_misc-0.0.3/src/scverse_misc/_version.py +24 -0
  10. scverse_misc-0.0.3/tests/test_deprecation_decorator.py +54 -0
  11. scverse_misc-0.0.2/CHANGELOG.md +0 -15
  12. scverse_misc-0.0.2/src/scverse_misc/_version.py +0 -34
  13. {scverse_misc-0.0.2 → scverse_misc-0.0.3}/.codecov.yaml +0 -0
  14. {scverse_misc-0.0.2 → scverse_misc-0.0.3}/.cruft.json +0 -0
  15. {scverse_misc-0.0.2 → scverse_misc-0.0.3}/.editorconfig +0 -0
  16. {scverse_misc-0.0.2 → scverse_misc-0.0.3}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
  17. {scverse_misc-0.0.2 → scverse_misc-0.0.3}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  18. {scverse_misc-0.0.2 → scverse_misc-0.0.3}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
  19. {scverse_misc-0.0.2 → scverse_misc-0.0.3}/.github/workflows/build.yaml +0 -0
  20. {scverse_misc-0.0.2 → scverse_misc-0.0.3}/.github/workflows/release.yaml +0 -0
  21. {scverse_misc-0.0.2 → scverse_misc-0.0.3}/.github/workflows/test.yaml +0 -0
  22. {scverse_misc-0.0.2 → scverse_misc-0.0.3}/.gitignore +0 -0
  23. {scverse_misc-0.0.2 → scverse_misc-0.0.3}/.readthedocs.yaml +0 -0
  24. {scverse_misc-0.0.2 → scverse_misc-0.0.3}/LICENSE +0 -0
  25. {scverse_misc-0.0.2 → scverse_misc-0.0.3}/biome.jsonc +0 -0
  26. {scverse_misc-0.0.2 → scverse_misc-0.0.3}/docs/Makefile +0 -0
  27. {scverse_misc-0.0.2 → scverse_misc-0.0.3}/docs/_static/.gitkeep +0 -0
  28. {scverse_misc-0.0.2 → scverse_misc-0.0.3}/docs/_static/css/custom.css +0 -0
  29. {scverse_misc-0.0.2 → scverse_misc-0.0.3}/docs/_templates/.gitkeep +0 -0
  30. {scverse_misc-0.0.2 → scverse_misc-0.0.3}/docs/_templates/autosummary/class.rst +0 -0
  31. {scverse_misc-0.0.2 → scverse_misc-0.0.3}/docs/changelog.md +0 -0
  32. {scverse_misc-0.0.2 → scverse_misc-0.0.3}/docs/conf.py +0 -0
  33. {scverse_misc-0.0.2 → scverse_misc-0.0.3}/docs/contributing.md +0 -0
  34. {scverse_misc-0.0.2 → scverse_misc-0.0.3}/docs/extensions/typed_returns.py +0 -0
  35. {scverse_misc-0.0.2 → scverse_misc-0.0.3}/docs/index.md +0 -0
  36. {scverse_misc-0.0.2 → scverse_misc-0.0.3}/docs/references.bib +0 -0
  37. {scverse_misc-0.0.2 → scverse_misc-0.0.3}/docs/references.md +0 -0
  38. {scverse_misc-0.0.2 → scverse_misc-0.0.3}/src/scverse_misc/_extensions.py +0 -0
  39. {scverse_misc-0.0.2 → scverse_misc-0.0.3}/tests/conftest.py +0 -0
  40. {scverse_misc-0.0.2 → scverse_misc-0.0.3}/tests/test_extensions.py +0 -0
@@ -7,16 +7,16 @@ default_stages:
7
7
  minimum_pre_commit_version: 2.16.0
8
8
  repos:
9
9
  - repo: https://github.com/biomejs/pre-commit
10
- rev: v2.4.6
10
+ rev: v2.4.10
11
11
  hooks:
12
12
  - id: biome-format
13
13
  exclude: ^\.cruft\.json$ # inconsistent indentation with cruft - file never to be modified manually.
14
14
  - repo: https://github.com/tox-dev/pyproject-fmt
15
- rev: v2.16.2
15
+ rev: v2.21.0
16
16
  hooks:
17
17
  - id: pyproject-fmt
18
18
  - repo: https://github.com/astral-sh/ruff-pre-commit
19
- rev: v0.15.5
19
+ rev: v0.15.9
20
20
  hooks:
21
21
  - id: ruff-check
22
22
  types_or: [python, pyi, jupyter]
@@ -0,0 +1,30 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog][],
6
+ and this project adheres to [Semantic Versioning][].
7
+
8
+ [keep a changelog]: https://keepachangelog.com/en/1.1.0/
9
+ [semantic versioning]: https://semver.org/spec/v2.0.0.html
10
+
11
+ ## [0.0.3]
12
+
13
+ ## Added
14
+
15
+ - A `deprecated` decorator wrapping `warnings.deprecated` that additionally modifies the
16
+ docstring to include a deprecation notice.
17
+
18
+ ## [0.0.2]
19
+
20
+ ## Removed
21
+
22
+ - The Pandas utility functions
23
+
24
+ ## [0.0.1]
25
+
26
+ - Initial release
27
+
28
+ [0.0.3]: https://github.com/scverse/scverse-misc/compare/v0.0.2...v0.0.3
29
+ [0.0.2]: https://github.com/scverse/scverse-misc/compare/v0.0.1...v0.0.2
30
+ [0.0.1]: https://github.com/scverse/scverse-misc/releases/tag/v0.0.1
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scverse-misc
3
- Version: 0.0.2
3
+ Version: 0.0.3
4
4
  Summary: Miscellaneous utility code used by scverse packages
5
5
  Project-URL: Documentation, https://scverse-misc.readthedocs.io/
6
6
  Project-URL: Homepage, https://github.com/scverse/scverse-misc
@@ -38,13 +38,14 @@ License: BSD 3-Clause License
38
38
  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39
39
  License-File: LICENSE
40
40
  Classifier: Programming Language :: Python :: 3 :: Only
41
+ Classifier: Programming Language :: Python :: 3.10
41
42
  Classifier: Programming Language :: Python :: 3.11
42
43
  Classifier: Programming Language :: Python :: 3.12
43
44
  Classifier: Programming Language :: Python :: 3.13
44
45
  Classifier: Programming Language :: Python :: 3.14
45
- Requires-Python: >=3.11
46
- Requires-Dist: pandas>=1
46
+ Requires-Python: >=3.10
47
47
  Requires-Dist: session-info2
48
+ Requires-Dist: typing-extensions; python_version < '3.13'
48
49
  Description-Content-Type: text/markdown
49
50
 
50
51
  # scverse-misc
@@ -101,7 +102,7 @@ If you found a bug, please use the [issue tracker][].
101
102
  [scverse discourse]: https://discourse.scverse.org/
102
103
  [issue tracker]: https://github.com/scverse/scverse-misc/issues
103
104
  [tests]: https://github.com/scverse/scverse-misc/actions/workflows/test.yaml
104
- [codecov]: https://codecov.io/gh/bioFAM/mofaflex
105
+ [codecov]: https://codecov.io/gh/scverse/scverse-misc
105
106
  [documentation]: https://scverse-misc.readthedocs.io
106
107
  [changelog]: https://scverse-misc.readthedocs.io/en/latest/changelog.html
107
108
  [api documentation]: https://scverse-misc.readthedocs.io/latest/api.html
@@ -52,7 +52,7 @@ If you found a bug, please use the [issue tracker][].
52
52
  [scverse discourse]: https://discourse.scverse.org/
53
53
  [issue tracker]: https://github.com/scverse/scverse-misc/issues
54
54
  [tests]: https://github.com/scverse/scverse-misc/actions/workflows/test.yaml
55
- [codecov]: https://codecov.io/gh/bioFAM/mofaflex
55
+ [codecov]: https://codecov.io/gh/scverse/scverse-misc
56
56
  [documentation]: https://scverse-misc.readthedocs.io
57
57
  [changelog]: https://scverse-misc.readthedocs.io/en/latest/changelog.html
58
58
  [api documentation]: https://scverse-misc.readthedocs.io/latest/api.html
@@ -20,3 +20,12 @@ Types used by the former:
20
20
 
21
21
  ExtensionNamespace
22
22
  ```
23
+
24
+ ## Deprecations
25
+ ``` {eval-rst}
26
+ .. autosummary::
27
+ :toctree: generated
28
+
29
+ deprecated
30
+ Deprecation
31
+ ```
@@ -13,9 +13,10 @@ maintainers = [
13
13
  authors = [
14
14
  { name = "Ilia Kats" },
15
15
  ]
16
- requires-python = ">=3.11"
16
+ requires-python = ">=3.10"
17
17
  classifiers = [
18
18
  "Programming Language :: Python :: 3 :: Only",
19
+ "Programming Language :: Python :: 3.10",
19
20
  "Programming Language :: Python :: 3.11",
20
21
  "Programming Language :: Python :: 3.12",
21
22
  "Programming Language :: Python :: 3.13",
@@ -23,9 +24,9 @@ classifiers = [
23
24
  ]
24
25
  dynamic = [ "version" ]
25
26
  dependencies = [
26
- "pandas>=1",
27
27
  # for debug logging (referenced from the issue template)
28
28
  "session-info2",
29
+ "typing-extensions; python_version<'3.13'",
29
30
  ]
30
31
  # https://docs.pypi.org/project_metadata/#project-urls
31
32
  urls.Documentation = "https://scverse-misc.readthedocs.io/"
@@ -64,7 +65,7 @@ envs.docs.scripts.clean = "git clean -fdX -- {args:docs}"
64
65
  envs.hatch-test.dependency-groups = [ "dev", "test" ]
65
66
  envs.hatch-test.matrix = [
66
67
  # Test the lowest and highest supported Python versions with normal deps
67
- { deps = [ "stable" ], python = [ "3.11", "3.14" ] },
68
+ { deps = [ "stable" ], python = [ "3.10", "3.14" ] },
68
69
  # Test the newest supported Python version also with pre-release deps
69
70
  { deps = [ "pre" ], python = [ "3.14" ] },
70
71
  ]
@@ -1,2 +1,3 @@
1
+ from ._deprecated import Deprecation, deprecated
1
2
  from ._extensions import ExtensionNamespace, make_register_namespace_decorator
2
3
  from ._version import __version__, __version_tuple__
@@ -0,0 +1,79 @@
1
+ from __future__ import annotations
2
+
3
+ import sys
4
+ from inspect import getdoc
5
+ from typing import TYPE_CHECKING, TypeVar
6
+
7
+ if sys.version_info >= (3, 11):
8
+ from typing import LiteralString
9
+ else:
10
+ from typing_extensions import LiteralString
11
+
12
+ if sys.version_info >= (3, 13):
13
+ from warnings import deprecated as _deprecated
14
+ else:
15
+ from typing_extensions import deprecated as _deprecated
16
+
17
+ if TYPE_CHECKING:
18
+ from collections.abc import Callable
19
+
20
+ F = TypeVar("F", bound=Callable)
21
+
22
+
23
+ class Deprecation(str):
24
+ """Utility class storing information on deprecated functionality.
25
+
26
+ Args:
27
+ version_deprecated: The version of the package where the functionality was deprecated.
28
+ msg: The deprecation message.
29
+ """
30
+
31
+ def __new__(cls, version_deprecated: LiteralString, msg: LiteralString = "") -> LiteralString:
32
+ obj = super().__new__(cls, msg)
33
+ obj.version_deprecated = version_deprecated
34
+ return obj
35
+
36
+
37
+ def _deprecated_at(msg: Deprecation, *, category=FutureWarning, stacklevel=1) -> Callable[[F], F]:
38
+ """Decorator to indicate that a class, function, or overload is deprecated.
39
+
40
+ Wraps :func:`warnings.deprecated` and additionally modifies the docstring to include a deprecation notice.
41
+
42
+ Args:
43
+ msg: The deprecation message.
44
+ category: The category of the warning that will be emitted at runtime.
45
+ stacklevel: The stack level of the warning.
46
+
47
+ Examples:
48
+ >>> @deprecated(Deprecation("0.2", "Use bar() instead."))
49
+ ... def foo(baz):
50
+ ... pass
51
+ """
52
+
53
+ def decorate(func: F) -> F:
54
+ kind = "function" if func.__name__ == func.__qualname__ else "method"
55
+ warnmsg = f"The {kind} {func.__name__} is deprecated and will be removed in the future."
56
+
57
+ doc = getdoc(func)
58
+ docmsg = f".. version-deprecated:: {msg.version_deprecated}"
59
+ if len(msg) is not None:
60
+ docmsg += f"\n {msg}"
61
+ warnmsg += f" {msg}"
62
+
63
+ if doc is None:
64
+ doc = docmsg
65
+ else:
66
+ lines = doc.splitlines()
67
+ body = "\n".join(lines[1:])
68
+ doc = f"{lines[0]}\n\n{docmsg}\n{body}"
69
+ func.__doc__ = doc
70
+
71
+ return _deprecated(warnmsg, category=category, stacklevel=stacklevel)(func)
72
+
73
+ return decorate
74
+
75
+
76
+ if TYPE_CHECKING:
77
+ deprecated = _deprecated
78
+ else:
79
+ deprecated = _deprecated_at
@@ -0,0 +1,24 @@
1
+ # file generated by vcs-versioning
2
+ # don't change, don't track in version control
3
+ from __future__ import annotations
4
+
5
+ __all__ = [
6
+ "__version__",
7
+ "__version_tuple__",
8
+ "version",
9
+ "version_tuple",
10
+ "__commit_id__",
11
+ "commit_id",
12
+ ]
13
+
14
+ version: str
15
+ __version__: str
16
+ __version_tuple__: tuple[int | str, ...]
17
+ version_tuple: tuple[int | str, ...]
18
+ commit_id: str | None
19
+ __commit_id__: str | None
20
+
21
+ __version__ = version = '0.0.3'
22
+ __version_tuple__ = version_tuple = (0, 0, 3)
23
+
24
+ __commit_id__ = commit_id = None
@@ -0,0 +1,54 @@
1
+ import pytest
2
+
3
+ from scverse_misc import Deprecation, deprecated
4
+
5
+
6
+ @pytest.fixture(params=[None, "Test message."])
7
+ def msg(request: pytest.FixtureRequest):
8
+ return request.param
9
+
10
+
11
+ @pytest.fixture(
12
+ params=[
13
+ None,
14
+ "Test function",
15
+ """Test function
16
+
17
+ This is a test.
18
+
19
+ Parameters
20
+ ----------
21
+ foo
22
+ bar
23
+ bar
24
+ baz
25
+ """,
26
+ ]
27
+ )
28
+ def docstring(request):
29
+ return request.param
30
+
31
+
32
+ @pytest.fixture
33
+ def deprecated_func(msg, docstring):
34
+ def func(foo, bar):
35
+ return 42
36
+
37
+ func.__doc__ = docstring
38
+ return deprecated(Deprecation("foo", msg))(func)
39
+
40
+
41
+ def test_deprecation_decorator(deprecated_func, docstring, msg):
42
+ with pytest.warns(FutureWarning, match="deprecated"):
43
+ assert deprecated_func(1, 2) == 42
44
+
45
+ lines = deprecated_func.__doc__.expandtabs().splitlines()
46
+ if docstring is None:
47
+ assert lines[0].startswith(".. version-deprecated::")
48
+ else:
49
+ lines_orig = docstring.expandtabs().splitlines()
50
+ assert lines[0] == lines_orig[0]
51
+ assert len(lines[1].strip()) == 0
52
+ assert lines[2].startswith(".. version-deprecated")
53
+ if msg is not None:
54
+ assert lines[3] == f" {msg}"
@@ -1,15 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog][],
6
- and this project adheres to [Semantic Versioning][].
7
-
8
- [keep a changelog]: https://keepachangelog.com/en/1.0.0/
9
- [semantic versioning]: https://semver.org/spec/v2.0.0.html
10
-
11
- ## [Unreleased]
12
-
13
- ### Added
14
-
15
- - Basic tool, preprocessing and plotting functions
@@ -1,34 +0,0 @@
1
- # file generated by setuptools-scm
2
- # don't change, don't track in version control
3
-
4
- __all__ = [
5
- "__version__",
6
- "__version_tuple__",
7
- "version",
8
- "version_tuple",
9
- "__commit_id__",
10
- "commit_id",
11
- ]
12
-
13
- TYPE_CHECKING = False
14
- if TYPE_CHECKING:
15
- from typing import Tuple
16
- from typing import Union
17
-
18
- VERSION_TUPLE = Tuple[Union[int, str], ...]
19
- COMMIT_ID = Union[str, None]
20
- else:
21
- VERSION_TUPLE = object
22
- COMMIT_ID = object
23
-
24
- version: str
25
- __version__: str
26
- __version_tuple__: VERSION_TUPLE
27
- version_tuple: VERSION_TUPLE
28
- commit_id: COMMIT_ID
29
- __commit_id__: COMMIT_ID
30
-
31
- __version__ = version = '0.0.2'
32
- __version_tuple__ = version_tuple = (0, 0, 2)
33
-
34
- __commit_id__ = commit_id = None
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes