Skip to content

Commit

Permalink
- INTERNAL: Switch from setup.py to pyproject.toml #109
Browse files Browse the repository at this point in the history
- INTERNAL: Use `ruff` instead of `black` + `flake8` + `isort`
  • Loading branch information
remi-braun committed Dec 16, 2024
1 parent 380f68f commit bf9b8f1
Show file tree
Hide file tree
Showing 13 changed files with 132 additions and 247 deletions.
33 changes: 0 additions & 33 deletions .coveragerc

This file was deleted.

13 changes: 5 additions & 8 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,11 @@ lint:
stage: lint
script:
- python -m pip install --upgrade pip
- pip install flake8
- flake8 eoreader
rules:
- if: $CI_COMMIT_TAG
when: never
- if: '$CI_PIPELINE_SOURCE == "schedule"'
when: never
- when: always
- pip install ruff
- ruff format
- ruff check
except:
- tags

# Test with data on local disk
pytest:
Expand Down
30 changes: 12 additions & 18 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,35 +1,29 @@
exclude: |
(?x)^(docs/.*)$ |
(?x)^(
docs/.*
)$ |
.*\.md
fail_fast: false
ci:
autoupdate_schedule: monthly
repos:

- repo: https://github.com/pre-commit/pre-commit-hooks.git
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-json
- id: check-yaml
args: [ --allow-multiple-documents, --unsafe ]
- id: check-xml
- id: check-added-large-files
args: [ '--maxkb=1600' ]
- id: debug-statements
- id: check-merge-conflict

- repo: 'https://github.com/PyCQA/flake8'
rev: 7.1.1
hooks:
- id: flake8

- repo: 'https://github.com/psf/black'
rev: 24.10.0
hooks:
- id: black

- repo: https://github.com/pycqa/isort
rev: 5.13.2
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.8.3
hooks:
- id: isort
# Run the linter.
- id: ruff
args: [ --fix ]
# Run the formatter.
- id: ruff-format
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
- FIX: Fix the computation of parametric spectral indices [#193](https://github.com/sertit/eoreader/issues/193)
- OPTIM: Cache the access to any archived file list, as this operation is expensive when done with large archives stored on the cloud (and thus better done only once).
- CI: Remove useless verbosity in CI
- INTERNAL: Switch from `setup.py` to `pyproject.toml` [#109](https://github.com/sertit/eoreader/issues/109)
- INTERNAL: Use `ruff` instead of `black` + `flake8` + `isort`
- DOC: Update `conf.py` (remove useless hunks and set Sphinx 7 as base)
- DOC: Added the [PAZ product guide](https://earth.esa.int/eogateway/documents/20142/37627/PAZ-Image-Products-Guide.pdf) to the PAZ Product documentation instead of the TerraSAR-X one - by @guillemc23
- DEPS: Pin `sertit>=1.44.1`
Expand Down
10 changes: 5 additions & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@
master_doc = "index"

# General information about the project.
project = eoreader.__title__
copyright = eoreader.__copyright__[10:]
author = eoreader.__author__
project = "eoreader"
copyright = "Copyright 2024, SERTIT-ICube - France, https://sertit.unistra.fr/"
author = "ICube-SERTIT"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down Expand Up @@ -147,11 +147,11 @@
# further. For a list of options available for each theme, see the
# documentation.
html_theme_options = {
"repository_url": eoreader.__url__,
"repository_url": "https://eoreader.readthedocs.io",
"use_repository_button": True,
"use_issues_button": True,
"use_edit_page_button": False,
"repository_branch": "master",
"repository_branch": "main",
"path_to_docs": "docs",
"use_download_button": False,
}
Expand Down
10 changes: 2 additions & 8 deletions eoreader/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"""
**EOReader** library
"""

# flake8: noqa
from functools import wraps
from typing import Callable
Expand Down Expand Up @@ -44,14 +45,7 @@ def wrapper(*args, **kwargs):
)
from functools import cache


from .__meta__ import (
__author__,
__author_email__,
__copyright__,
__description__,
__documentation__,
__license__,
__title__,
__url__,
__version__,
)
13 changes: 1 addition & 12 deletions eoreader/__meta__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2024, SERTIT-ICube - France, https://sertit.unistra.fr/
# This file is part of eoreader project
# https://github.com/sertit/eoreader
Expand All @@ -17,15 +16,5 @@
"""
**EOReader** library
"""

__version__ = "0.21.7"
__title__ = "eoreader"
__description__ = (
"Remote-sensing opensource python library reading optical and SAR constellations, "
"loading and stacking bands, clouds, DEM and spectral indices in a sensor-agnostic way."
)
__author__ = "ICube-SERTIT"
__author_email__ = "dev-sertit@unistra.fr"
__url__ = "https://github.com/sertit/eoreader"
__license__ = "Apache 2.0"
__copyright__ = "Copyright 2024, SERTIT-ICube - France, https://sertit.unistra.fr/"
__documentation__ = "https://eoreader.readthedocs.io"
105 changes: 105 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
[build-system]
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"

[tool.setuptools.packages.find]
include = ["eoreader*"]
namespaces = false

[project]
name = "eoreader"
authors = [
{name = "ICube-SERTIT", email = "dev-sertit@unistra.fr"},
]
description = "Remote-sensing opensource python library reading optical and SAR constellations, loading and stacking bands, clouds, DEM and spectral indices in a sensor-agnostic way."
readme = "README.md"
requires-python = ">=3.9"
license = {text = "Apache 2.0"}
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Natural Language :: English",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Operating System :: OS Independent",
"Topic :: Scientific/Engineering :: GIS",
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = [
"lxml",
"h5netcdf",
"scipy",
"rasterio>=1.3.10", # numpy >= 2
"xarray>=2024.06.0", # numpy >= 2
"rioxarray>=0.10.0",
"odc-geo>=0.4.6",
"geopandas>=0.14.4",
"sertit[full]>=1.44.1",
"spyndex>=0.3.0",
"pyresample",
"zarr",
"rtree",
"cloudpathlib[s3]>=0.12.1",
"validators",
"methodtools",
"dicttoxml",
]

[project.optional-dependencies]
"stac" = [
"pystac[validation]",
"stac-asset",
"planetary_computer",
]
[tool.setuptools.package-data]
eoreader.data = ["*.xml"]

dynamic = ["version"]

[tool.setuptools.dynamic]
version = {attr = "eoreader.__version__"}

[project.urls]
Bug_Tracker = "https://github.com/sertit/eoreader/issues"
Documentation = "https://eoreader.readthedocs.io/en/latest/"
Source_Code = "https://github.com/sertit/eoreader"

[tool.ruff.lint]
select = [
# pycodestyle
"E",
# Pyflakes
"F",
# pyupgrade
"UP",
# flake8-bugbear
"B",
# flake8-simplify
"SIM",
# isort
"I",
]
ignore = ["E501"]

[tool.ruff.lint.pyupgrade]
# Preserve types, even if a file imports `from __future__ import annotations`.
keep-runtime-typing = true

# Pytest options
[tool.pytest.ini_options]
log_cli = true
log_cli_format = "%(name)s: %(asctime)s - [%(levelname)s] - %(message)s"
log_cli_date_format = "%Y-%m-%d %H:%M:%S"
log_cli_level = "INFO"

[tool.coverage.run]
omit = ["*/__init__.py"]


[tool.typos]
files.extend-exclude = ["*.ipynb", "*.html", ".git/*"]
default.extend-ignore-re = ["_.*_", "\"\\w*\"", "PN", ", fo", "FRE", "THR", "T60HTE", "_BA"]
5 changes: 0 additions & 5 deletions pytest.ini

This file was deleted.

14 changes: 0 additions & 14 deletions setup.cfg

This file was deleted.

76 changes: 0 additions & 76 deletions setup.py

This file was deleted.

Loading

0 comments on commit bf9b8f1

Please sign in to comment.