diff --git a/.bumpversion.cfg b/.bumpversion.cfg deleted file mode 100644 index fdba9e4f..00000000 --- a/.bumpversion.cfg +++ /dev/null @@ -1,8 +0,0 @@ -[bumpversion] -current_version = 0.0.1 -tag = True -commit = True - -[bumpversion:file:./pyproject.toml] -search = version = "{current_version}" -replace = version = "{new_version}" diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 4ee1a57d..7e3a8d75 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -26,30 +26,17 @@ jobs: PYTHON: ${{ matrix.python }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Python ${{ matrix.python }} - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: ${{ matrix.python }} - - - name: Get pip cache dir - id: pip-cache-dir - run: | - echo "::set-output name=dir::$(pip cache dir)" - - name: Restore pip cache - uses: actions/cache@v4 - with: - path: ${{ steps.pip-cache-dir.outputs.dir }} - key: pip-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('**/pyproject.toml') }} - restore-keys: | - pip-${{ runner.os }}-${{ env.pythonLocation }}- - - name: Install test dependencies - run: | - python -m pip install --upgrade pip wheel - pip install pytest-cov + cache: pip + cache-dependency-path: pyproject.toml - name: Install dependencies run: | - pip install --pre -e ".[dev,test]" + python -m pip install --upgrade "pip>=25.1" wheel + python -m pip install -e . --group test - name: Download artifact of test data if: matrix.python == '3.13' @@ -65,7 +52,7 @@ jobs: PLATFORM: ${{ matrix.os }} DISPLAY: :42 run: | - pytest -v --cov --color=yes --cov-report=xml + python -m pytest -v --cov --color=yes --cov-report=xml - name: Upload coverage to Codecov uses: codecov/codecov-action@v4 with: diff --git a/.mypy.ini b/.mypy.ini deleted file mode 100644 index 1e3bcb54..00000000 --- a/.mypy.ini +++ /dev/null @@ -1,27 +0,0 @@ -[mypy] -python_version = 3.10 - -ignore_errors = False -warn_redundant_casts = True -warn_unused_configs = True -warn_unused_ignores = True - -disallow_untyped_calls = False -disallow_untyped_defs = True -disallow_incomplete_defs = True -disallow_any_generics = True - -strict_optional = True -strict_equality = True -warn_return_any = True -warn_unreachable = False -check_untyped_defs = True -; because of docrep -allow_untyped_decorators = True -no_implicit_optional = True -no_implicit_reexport = True -no_warn_no_return = True - -show_error_codes = True -show_column_numbers = True -error_summary = True diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c2681a9f..0f6f4910 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,15 +6,11 @@ default_stages: - pre-push minimum_pre_commit_version: 2.16.0 repos: - - repo: https://github.com/rbubley/mirrors-prettier - rev: v3.8.3 - hooks: - - id: prettier - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.15.12 hooks: - id: ruff - args: [--fix, --exit-non-zero-on-fix, --unsafe-fixes] + args: [--fix, --exit-non-zero-on-fix] - id: ruff-format - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.20.2 @@ -26,11 +22,6 @@ repos: rev: v6.0.0 hooks: - id: detect-private-key - - id: check-ast - - id: end-of-file-fixer - - id: mixed-line-ending - args: [--fix=lf] - - id: trailing-whitespace - id: check-case-conflict - repo: local hooks: diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 31d8fef4..f8fcd935 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -1,15 +1,16 @@ version: 2 build: - os: ubuntu-24.04 - tools: - python: "3.12" + os: ubuntu-24.04 + tools: + python: "3.12" + sphinx: - configuration: docs/conf.py - fail_on_warning: true + configuration: docs/conf.py + fail_on_warning: true + python: - install: - - method: pip - path: . - extra_requirements: - - doc - - pre + install: + - method: uv + command: sync + groups: + - doc diff --git a/pyproject.toml b/pyproject.toml index 05c5baa2..34705a5d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,12 +39,11 @@ dependencies = [ "xmltodict", ] -[project.optional-dependencies] +[dependency-groups] dev = [ - # CLI for bumping the version number - "bump2version", - "pre-commit" + "pre-commit", ] + doc = [ "sphinx>=4.5,<9", "sphinx-book-theme>=1.0.0", @@ -53,22 +52,15 @@ doc = [ "sphinx-autodoc-typehints", "sphinx-design", "sphinx-click", - # For notebooks "ipython>=8.6.0", "sphinx-copybutton", ] + test = [ "pytest", "pytest-cov", - # https://github.com/scverse/spatialdata-io/issues/334 "pyarrow!=22", - "pytest-mock" -] -# this will be used by readthedocs and will make pip also look for pre-releases, generally installing the latest available version -# update: readthedocs doens't seem to try to install pre-releases even if when trying to install the pre optional-dependency. For -# the moment, if needed, let's add the latest pre-release explicitly here. -pre = [ - "spatialdata>=0.7.3a0" + "pytest-mock", ] [tool.coverage.run] @@ -85,7 +77,9 @@ addopts = [ ] [tool.ruff] +target-version = "py311" line-length = 120 +indent-width = 4 exclude = [ ".git", ".tox", @@ -95,7 +89,9 @@ exclude = [ "dist", "setup.py", ] -lint.select = [ + +[tool.ruff.lint] +select = [ "F", # Errors detected by Pyflakes "E", # Error detected by Pycodestyle "W", # Warning detected by Pycodestyle @@ -112,7 +108,7 @@ lint.select = [ # "PTH", # Use pathlib # "S" # Security ] -lint.ignore = [ +ignore = [ # Do not catch blind exception: `Exception` "BLE001", # Errors from function calls in argument defaults. These are fine when the result is immutable. @@ -140,7 +136,7 @@ lint.ignore = [ # Missing docstring in __init__ "D107", ## Disable one in each pair of mutually incompatible rules - # We don’t want a blank line before a class docstring + # We don't want a blank line before a class docstring "D203", # 1 blank line required after class docstring "D204", @@ -186,11 +182,48 @@ lint.ignore = [ # Unused imports "F401", ] + +[tool.ruff.lint.pydocstyle] +convention = "numpy" + [tool.ruff.lint.per-file-ignores] "src/spatialdata_io/__init__.py" = ["I001"] -[tool.jupytext] -formats = "ipynb,md" +[tool.ruff.format] +quote-style = "double" +indent-style = "space" +line-ending = "lf" + +[tool.mypy] +python_version = "3.11" + +ignore_errors = false +warn_redundant_casts = true +warn_unused_configs = true +warn_unused_ignores = true + +disallow_untyped_calls = false +disallow_untyped_defs = true +disallow_incomplete_defs = true +disallow_any_generics = true + +strict_optional = true +strict_equality = true +warn_return_any = true +warn_unreachable = false +check_untyped_defs = true + +# because of docrep +allow_untyped_decorators = true + +no_implicit_optional = true +no_implicit_reexport = true +no_warn_no_return = true + +show_error_codes = true +show_column_numbers = true +error_summary = true + [tool.hatch.metadata] allow-direct-references = true