From 40734dcc44c105a43282cc4029e7d6cf9fea4ad8 Mon Sep 17 00:00:00 2001 From: Jayaram Kancherla Date: Sun, 8 Dec 2024 07:36:26 -0800 Subject: [PATCH 1/3] chore: remove Python 3.8 support --- .github/workflows/pypi-publish.yml | 8 ++++---- .github/workflows/pypi-test.yml | 6 +++--- .pre-commit-config.yaml | 25 +++++++++++++------------ CHANGELOG.md | 11 +++++++---- docs/conf.py | 9 +++++++++ docs/requirements.txt | 1 + setup.cfg | 2 +- 7 files changed, 38 insertions(+), 24 deletions(-) diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index 7b591a2..030cd10 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -13,11 +13,11 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.9 - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + - name: Set up Python 3.11 + uses: actions/setup-python@v5 with: - python-version: 3.9 + python-version: 3.11 - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/.github/workflows/pypi-test.yml b/.github/workflows/pypi-test.yml index 9dc019a..22f6c4a 100644 --- a/.github/workflows/pypi-test.yml +++ b/.github/workflows/pypi-test.yml @@ -15,13 +15,13 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ] + python-version: [ '3.9', '3.10', '3.11', '3.12', '3.13' ] name: Python ${{ matrix.python-version }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} cache: 'pip' diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3c9601c..e60a5f4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,19 +17,19 @@ repos: - id: mixed-line-ending args: ['--fix=auto'] # replace 'auto' with 'lf' to enforce Linux/Mac line endings or 'crlf' for Windows -- repo: https://github.com/PyCQA/docformatter - rev: v1.7.5 - hooks: - - id: docformatter - additional_dependencies: [tomli] - args: [--in-place, --wrap-descriptions=120, --wrap-summaries=120] - # --config, ./pyproject.toml +# - repo: https://github.com/PyCQA/docformatter +# rev: master +# hooks: +# - id: docformatter +# additional_dependencies: [tomli] +# args: [--in-place, --wrap-descriptions=120, --wrap-summaries=120] +# # --config, ./pyproject.toml -- repo: https://github.com/psf/black - rev: 24.8.0 - hooks: - - id: black - language_version: python3 +# - repo: https://github.com/psf/black +# rev: 24.8.0 +# hooks: +# - id: black +# language_version: python3 - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. @@ -37,6 +37,7 @@ repos: hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] + - id: ruff-format ## If like to embrace black styles even in the docs: # - repo: https://github.com/asottile/blacken-docs diff --git a/CHANGELOG.md b/CHANGELOG.md index 205cc5e..0b7e538 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,10 @@ # Changelog -## Version 0.1 (development) +## Version 0.2.0 -- Feature A added -- FIX: nasty bug #1729 fixed -- add your changes here! +- chore: Remove Python 3.8 (EOL) +- precommit: Replace docformatter with ruff's formatter + +## Version 0.1.o + +- Initial version of the package. diff --git a/docs/conf.py b/docs/conf.py index 7a0cc34..c28e2e3 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -72,6 +72,7 @@ "sphinx.ext.ifconfig", "sphinx.ext.mathjax", "sphinx.ext.napoleon", + "sphinx_autodoc_typehints", ] # Add any paths that contain templates here, relative to this directory. @@ -166,6 +167,14 @@ # If this is True, todo emits a warning for each TODO entries. The default is False. todo_emit_warnings = True +autodoc_default_options = { + 'special-members': True, + 'undoc-members': False, + 'exclude-members': '__weakref__, __dict__, __str__, __module__, __init__' + } + +autosummary_generate = True +autosummary_imported_members = True # -- Options for HTML output ------------------------------------------------- diff --git a/docs/requirements.txt b/docs/requirements.txt index 0990c2a..e211756 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -4,3 +4,4 @@ # sphinx_rtd_theme myst-parser[linkify] sphinx>=3.2.1 +sphinx-autodoc-typehints diff --git a/setup.cfg b/setup.cfg index 3496c90..2cbb2d2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -41,7 +41,7 @@ package_dir = =src # Require a min/specific Python version (comma-separated conditions) -python_requires = >=3.8 +python_requires = >=3.9 # Add here dependencies of your project (line-separated), e.g. requests>=2.2,<3.0. # Version specifiers like >=2.2,<3.0 avoid problems due to API changes in From 762fa4b51e3ddfa8bc975ad3feab945649de75d4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 8 Dec 2024 15:38:24 +0000 Subject: [PATCH 2/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/tiledbarray/TileDBArraySeed.py | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/src/tiledbarray/TileDBArraySeed.py b/src/tiledbarray/TileDBArraySeed.py index 759cee7..a8a9c86 100644 --- a/src/tiledbarray/TileDBArraySeed.py +++ b/src/tiledbarray/TileDBArraySeed.py @@ -44,9 +44,7 @@ def __init__(self, path: str, attribute_name: str) -> None: _all_attr.append(_schema.attr(i).name) if self._attribute_name not in _all_attr: - raise ValueError( - f"Attribute '{self._attribute_name}' not in the tiledb schema." - ) + raise ValueError(f"Attribute '{self._attribute_name}' not in the tiledb schema.") _attr_schema = _schema.attr(self._attribute_name) self._dtype = _attr_schema.dtype @@ -166,15 +164,11 @@ def _extract_array(x: TileDbArraySeed, subset: Tuple[Sequence[int], ...]): _parsed_subset, ) - return (len(_first_subset), len(_second_subset)), numpy.array( - _data[x._attribute_name] - ) + return (len(_first_subset), len(_second_subset)), numpy.array(_data[x._attribute_name]) @extract_dense_array.register -def extract_dense_array_TileDbArraySeed( - x: TileDbArraySeed, subset: Tuple[Sequence[int], ...] -) -> numpy.ndarray: +def extract_dense_array_TileDbArraySeed(x: TileDbArraySeed, subset: Tuple[Sequence[int], ...]) -> numpy.ndarray: """See :py:meth:`~delayedarray.extract_dense_array.extract_dense_array`. Subset parameter is passed to tiledb's @@ -184,9 +178,7 @@ def extract_dense_array_TileDbArraySeed( return _output -def _SparseNdarray_contents_from_coordinates( - rows, cols, vals, shape, val_dtype, parsed_subset -): +def _SparseNdarray_contents_from_coordinates(rows, cols, vals, shape, val_dtype, parsed_subset): output = [None] * shape[-1] for i, val in enumerate(vals): _offset_col = parsed_subset[1].index(cols[i]) @@ -214,9 +206,7 @@ def _SparseNdarray_contents_from_coordinates( @extract_sparse_array.register -def extract_sparse_array_TileDbArraySeed( - x: TileDbArraySeed, subset: Tuple[Sequence[int], ...] -) -> SparseNdarray: +def extract_sparse_array_TileDbArraySeed(x: TileDbArraySeed, subset: Tuple[Sequence[int], ...]) -> SparseNdarray: """See :py:meth:`~delayedarray.extract_sparse_array.extract_sparse_array`. Subset parameter is passed to tiledb's @@ -233,9 +223,7 @@ def extract_sparse_array_TileDbArraySeed( _output[3], ) - return SparseNdarray( - shape=_subset_shape, contents=_content, dtype=x._dtype, index_dtype=numpy.int32 - ) + return SparseNdarray(shape=_subset_shape, contents=_content, dtype=x._dtype, index_dtype=numpy.int32) class TileDbArray(DelayedArray): From e0f5bb1c9a217f953c3f9fd66381ae3ce884799c Mon Sep 17 00:00:00 2001 From: Jayaram Kancherla Date: Fri, 20 Dec 2024 11:12:02 -0800 Subject: [PATCH 3/3] more config changes --- docs/conf.py | 13 ++++++++----- docs/requirements.txt | 2 ++ pyproject.toml | 4 ++++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index c28e2e3..29de8eb 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -168,19 +168,22 @@ todo_emit_warnings = True autodoc_default_options = { - 'special-members': True, - 'undoc-members': False, - 'exclude-members': '__weakref__, __dict__, __str__, __module__, __init__' - } + # 'members': 'var1, var2', + # 'member-order': 'bysource', + "special-members": True, + "undoc-members": True, + "exclude-members": "__weakref__, __dict__, __str__, __module__", +} autosummary_generate = True autosummary_imported_members = True + # -- Options for HTML output ------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = "alabaster" +html_theme = "furo" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the diff --git a/docs/requirements.txt b/docs/requirements.txt index e211756..c20cf60 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,3 +1,5 @@ +furo +myst-nb # Requirements file for ReadTheDocs, check .readthedocs.yml. # To build the module reference correctly, make sure every external package # under `install_requires` in `setup.cfg` is also listed here! diff --git a/pyproject.toml b/pyproject.toml index 0514df9..45716dd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,6 +17,10 @@ extend-ignore = ["F821"] [tool.ruff.pydocstyle] convention = "google" +[tool.ruff.format] +docstring-code-format = true +docstring-code-line-length = 20 + [tool.ruff.per-file-ignores] "__init__.py" = ["E402", "F401"]