Skip to content

Commit 4ce41f3

Browse files
authored
chore: remove Python 3.8 support (#15)
1 parent c2c04da commit 4ce41f3

9 files changed

Lines changed: 103 additions & 121 deletions

File tree

.github/workflows/pypi-publish.yml

Lines changed: 38 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -9,43 +9,44 @@ on:
99

1010
jobs:
1111
build:
12-
1312
runs-on: ubuntu-latest
1413

1514
steps:
16-
- uses: actions/checkout@v2
17-
- name: Set up Python 3.9
18-
uses: actions/setup-python@v2
19-
with:
20-
python-version: 3.9
21-
- name: Install dependencies
22-
run: |
23-
python -m pip install --upgrade pip
24-
pip install flake8 pytest tox
25-
# - name: Lint with flake8
26-
# run: |
27-
# # stop the build if there are Python syntax errors or undefined names
28-
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
29-
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
30-
# # flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
31-
- name: Test with tox
32-
run: |
33-
tox
34-
- name: Build docs
35-
run: |
36-
tox -e docs
37-
- run: touch ./docs/_build/html/.nojekyll
38-
- name: GH Pages Deployment
39-
uses: JamesIves/github-pages-deploy-action@4.1.3
40-
with:
41-
branch: gh-pages # The branch the action should deploy to.
42-
folder: ./docs/_build/html
43-
clean: true # Automatically remove deleted files from the deploy branch
44-
- name: Build Project and Publish
45-
run: |
46-
python -m tox -e clean,build
47-
- name: Publish package
48-
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
49-
with:
50-
user: __token__
51-
password: ${{ secrets.PYPI_PASSWORD }}
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up Python 3.11
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: 3.11
21+
22+
- name: Install dependencies
23+
run: |
24+
python -m pip install --upgrade pip
25+
pip install tox
26+
27+
- name: Test with tox
28+
run: |
29+
tox
30+
31+
- name: Build docs
32+
run: |
33+
tox -e docs
34+
35+
- run: touch ./docs/_build/html/.nojekyll
36+
37+
- name: GH Pages Deployment
38+
uses: JamesIves/github-pages-deploy-action@v4
39+
with:
40+
branch: gh-pages # The branch the action should deploy to.
41+
folder: ./docs/_build/html
42+
clean: true # Automatically remove deleted files from the deploy branch
43+
44+
- name: Build Project and Publish
45+
run: |
46+
python -m tox -e clean,build
47+
48+
- name: Publish package
49+
uses: pypa/gh-action-pypi-publish@v1.12.2
50+
with:
51+
user: __token__
52+
password: ${{ secrets.PYPI_PASSWORD }}

.github/workflows/pypi-test.yml

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,33 @@
1-
# This workflow will install Python dependencies, run tests and lint with a single version of Python
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3-
4-
name: Test the library
1+
name: Run tests
52

63
on:
74
push:
8-
branches: [ master ]
5+
branches: [master]
96
pull_request:
10-
branches: [ master ]
7+
branches: [master]
118

129
jobs:
1310
build:
14-
1511
runs-on: ubuntu-latest
1612
strategy:
1713
matrix:
18-
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
14+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
1915

2016
name: Python ${{ matrix.python-version }}
2117
steps:
22-
- uses: actions/checkout@v2
23-
- name: Setup Python
24-
uses: actions/setup-python@v2
25-
with:
26-
python-version: ${{ matrix.python-version }}
27-
cache: 'pip'
28-
- name: Install dependencies
29-
run: |
30-
python -m pip install --upgrade pip
31-
pip install flake8 pytest tox
32-
# - name: Lint with flake8
33-
# run: |
34-
# # stop the build if there are Python syntax errors or undefined names
35-
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
36-
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
37-
# # flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
38-
- name: Test with tox
39-
run: |
40-
tox
18+
- uses: actions/checkout@v4
19+
20+
- name: Setup Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
cache: "pip"
25+
26+
- name: Install dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install tox
30+
31+
- name: Test with tox
32+
run: |
33+
tox

.pre-commit-config.yaml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,27 @@ repos:
1717
- id: mixed-line-ending
1818
args: ['--fix=auto'] # replace 'auto' with 'lf' to enforce Linux/Mac line endings or 'crlf' for Windows
1919

20-
- repo: https://github.com/PyCQA/docformatter
21-
rev: v1.7.5
22-
hooks:
23-
- id: docformatter
24-
additional_dependencies: [tomli]
25-
args: [--in-place, --wrap-descriptions=120, --wrap-summaries=120]
26-
# --config, ./pyproject.toml
20+
# - repo: https://github.com/PyCQA/docformatter
21+
# rev: master
22+
# hooks:
23+
# - id: docformatter
24+
# additional_dependencies: [tomli]
25+
# args: [--in-place, --wrap-descriptions=120, --wrap-summaries=120]
26+
# # --config, ./pyproject.toml
2727

28-
- repo: https://github.com/psf/black
29-
rev: 24.8.0
30-
hooks:
31-
- id: black
32-
language_version: python3
28+
# - repo: https://github.com/psf/black
29+
# rev: 24.8.0
30+
# hooks:
31+
# - id: black
32+
# language_version: python3
3333

3434
- repo: https://github.com/astral-sh/ruff-pre-commit
3535
# Ruff version.
3636
rev: v0.6.8
3737
hooks:
3838
- id: ruff
3939
args: [--fix, --exit-non-zero-on-fix]
40+
- id: ruff-format
4041

4142
## If like to embrace black styles even in the docs:
4243
# - repo: https://github.com/asottile/blacken-docs

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## Version 0.3.0
4+
5+
- chore: Remove Python 3.8 (EOL)
6+
- precommit: Replace docformatter with ruff's formatter
7+
38
## Version 0.2.0
49

510
- Compatibility with NumPy 2.0

docs/conf.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,15 @@ def setup(app):
170170
# If this is True, todo emits a warning for each TODO entries. The default is False.
171171
todo_emit_warnings = True
172172

173+
autodoc_default_options = {
174+
'special-members': True,
175+
'undoc-members': False,
176+
'exclude-members': '__weakref__, __dict__, __str__, __module__, __init__'
177+
}
178+
179+
autosummary_generate = True
180+
autosummary_imported_members = True
181+
173182

174183
# -- Options for HTML output -------------------------------------------------
175184

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ extend-ignore = ["F821"]
1717
[tool.ruff.pydocstyle]
1818
convention = "google"
1919

20+
[tool.ruff.format]
21+
docstring-code-format = true
22+
docstring-code-line-length = 20
23+
2024
[tool.ruff.per-file-ignores]
2125
"__init__.py" = ["E402", "F401"]
2226

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ package_dir =
4141
=src
4242

4343
# Require a min/specific Python version (comma-separated conditions)
44-
python_requires = >=3.8
44+
python_requires = >=3.9
4545

4646
# Add here dependencies of your project (line-separated), e.g. requests>=2.2,<3.0.
4747
# Version specifiers like >=2.2,<3.0 avoid problems due to API changes in

src/hdf5array/Hdf5CompressedSparseMatrixSeed.py

Lines changed: 12 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -98,22 +98,14 @@ def __init__(
9898

9999
with File(self._path, "r") as handle:
100100
self._indptr = handle[self._indptr_name][:]
101-
if len(self._indptr.shape) != 1 or not issubdtype(
102-
self._indptr.dtype, integer
103-
):
104-
raise ValueError(
105-
"'indptr' dataset should be 1-dimensional and contain integers"
106-
)
101+
if len(self._indptr.shape) != 1 or not issubdtype(self._indptr.dtype, integer):
102+
raise ValueError("'indptr' dataset should be 1-dimensional and contain integers")
107103
if by_column:
108104
if len(self._indptr) != shape[1] + 1:
109-
raise ValueError(
110-
"'indptr' dataset should have length equal to the number of columns + 1"
111-
)
105+
raise ValueError("'indptr' dataset should have length equal to the number of columns + 1")
112106
else:
113107
if len(self._indptr) != shape[0] + 1:
114-
raise ValueError(
115-
"'indptr' dataset should have length equal to the number of columns + 1"
116-
)
108+
raise ValueError("'indptr' dataset should have length equal to the number of columns + 1")
117109
if self._indptr[0] != 0:
118110
raise ValueError("first entry of 'indptr' dataset should be zero")
119111
for i in range(1, len(self._indptr)):
@@ -122,9 +114,7 @@ def __init__(
122114

123115
ddset = handle[self._data_name]
124116
if len(ddset.shape) != 1 or ddset.shape[0] != self._indptr[-1]:
125-
raise ValueError(
126-
"'data' dataset should have length equal to the number of non-zero elements"
127-
)
117+
raise ValueError("'data' dataset should have length equal to the number of non-zero elements")
128118
self._modify_dtype = dtype is not None and dtype != ddset.dtype
129119
if not self._modify_dtype:
130120
dtype = ddset.dtype
@@ -133,14 +123,10 @@ def __init__(
133123
# Not going to check for consistency of the indices themselves.
134124
idset = handle[self._indices_name]
135125
if len(idset.shape) != 1 or idset.shape[0] != self._indptr[-1]:
136-
raise ValueError(
137-
"'indices' dataset should have length equal to the number of non-zero elements"
138-
)
126+
raise ValueError("'indices' dataset should have length equal to the number of non-zero elements")
139127
if not issubdtype(idset.dtype, integer):
140128
raise ValueError("'indices' dataset should contain integers")
141-
self._modify_index_dtype = (
142-
index_dtype is not None and index_dtype != idset.dtype
143-
)
129+
self._modify_index_dtype = index_dtype is not None and index_dtype != idset.dtype
144130
if not self._modify_index_dtype:
145131
index_dtype = idset.dtype
146132
self._index_dtype = index_dtype
@@ -269,9 +255,7 @@ def _extract_array(
269255
start_idx = bisect_left(curindices, secondary_start)
270256
end_idx = len(curindices)
271257
if search_end:
272-
end_idx = bisect_left(
273-
curindices, secondary_end, lo=start_idx, hi=end_idx
274-
)
258+
end_idx = bisect_left(curindices, secondary_end, lo=start_idx, hi=end_idx)
275259

276260
if is_consecutive:
277261
mod_indices = curindices[start_idx:end_idx]
@@ -406,14 +390,7 @@ def _consecutive(r, cols, values):
406390
class Hdf5CompressedSparseMatrix(DelayedArray):
407391
"""Compressed sparse matrix in a HDF5 file as a ``DelayedArray``."""
408392

409-
def __init__(
410-
self,
411-
path: str,
412-
group_name: Optional[str],
413-
shape: Tuple[int, int],
414-
by_column: bool,
415-
**kwargs
416-
):
393+
def __init__(self, path: str, group_name: Optional[str], shape: Tuple[int, int], by_column: bool, **kwargs):
417394
"""To construct a ``Hdf5CompressedSparseMatrix`` from an existing :py:class:`~Hdf5CompressedSparseMatrixSeed`,
418395
use :py:meth:`~delayedarray.wrap.wrap` instead.
419396
@@ -439,9 +416,7 @@ def __init__(
439416
if isinstance(path, Hdf5CompressedSparseMatrixSeed):
440417
seed = path
441418
else:
442-
seed = Hdf5CompressedSparseMatrixSeed(
443-
path, group_name, shape, by_column, **kwargs
444-
)
419+
seed = Hdf5CompressedSparseMatrixSeed(path, group_name, shape, by_column, **kwargs)
445420
super(Hdf5CompressedSparseMatrix, self).__init__(seed)
446421

447422
@property
@@ -530,13 +505,9 @@ def to_scipy_sparse_matrix_from_Hdf5CompressedSparseMatrix(
530505
_indptr = handle[x.indptr_name][:]
531506

532507
if x.by_column:
533-
_matrix = scipy.sparse.csc_matrix(
534-
(_data, _indices, _indptr), shape=x.shape, dtype=x.dtype
535-
)
508+
_matrix = scipy.sparse.csc_matrix((_data, _indices, _indptr), shape=x.shape, dtype=x.dtype)
536509
else:
537-
_matrix = scipy.sparse.csr_matrix(
538-
(_data, _indices, _indptr), shape=x.shape, dtype=x.dtype
539-
)
510+
_matrix = scipy.sparse.csr_matrix((_data, _indices, _indptr), shape=x.shape, dtype=x.dtype)
540511

541512
if format == "csc":
542513
return _matrix.tocsc()

src/hdf5array/Hdf5DenseArraySeed.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,7 @@ def chunk_grid_Hdf5DenseArraySeed(x: Hdf5DenseArraySeed):
122122

123123

124124
@extract_dense_array.register
125-
def extract_dense_array_Hdf5DenseArraySeed(
126-
x: Hdf5DenseArraySeed, subset: Tuple[Sequence[int], ...]
127-
) -> numpy.ndarray:
125+
def extract_dense_array_Hdf5DenseArraySeed(x: Hdf5DenseArraySeed, subset: Tuple[Sequence[int], ...]) -> numpy.ndarray:
128126
"""See :py:meth:`~delayedarray.extract_dense_array.extract_dense_array`."""
129127
converted = []
130128
num_lists = 0

0 commit comments

Comments
 (0)