Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pyproject migration #110

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# compatibility black and flake8
[flake8]
max-line-length = 88
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

max-line-length = 200 si tu peux 😇 88 c'est trop peu j'aime pas

Copy link
Author

@bastiencyr bastiencyr Mar 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

En réalité ça ne change rien, la limite de 88 est la limite par défaut dans black qui n'a pas été changé dans eoreader. On respecte donc deja 88 comme longueur maximale avec Black, c'est pour ça que les tests de pré commits sont passés sans erreur.

extend-ignore = E203, E501
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ __pycache__/
cov.xml
*.lock
.run
venv

# Discard CI/OUTPUTS
CI/OUTPUT/*
Expand Down
30 changes: 18 additions & 12 deletions CI/SCRIPTS/test_stac_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,15 @@ def _test_core(

def test_s2_l1c_e84():
"""Function testing the support of Sentinel-2 L1C constellation processed by E84 and linked via a STAC URL"""
with tempenv.TemporaryEnvironment(
{
"AWS_SECRET_ACCESS_KEY": os.getenv("AWS_S3_AWS_SECRET_ACCESS_KEY"),
"AWS_ACCESS_KEY_ID": os.getenv("AWS_S3_AWS_ACCESS_KEY_ID"),
}
), s3.temp_s3(endpoint="s3.us-west-2.amazonaws.com", requester_pays=True):
with (
tempenv.TemporaryEnvironment(
{
"AWS_SECRET_ACCESS_KEY": os.getenv("AWS_S3_AWS_SECRET_ACCESS_KEY"),
"AWS_ACCESS_KEY_ID": os.getenv("AWS_S3_AWS_ACCESS_KEY_ID"),
}
),
s3.temp_s3(endpoint="s3.us-west-2.amazonaws.com", requester_pays=True),
):
_test_core(
"https://earth-search.aws.element84.com/v1/collections/sentinel-2-l1c/items/S2B_29SLD_20231121_0_L1C",
Constellation.S2,
Expand All @@ -73,12 +76,15 @@ def test_s2_l2a_e84():

def test_l9_e84():
"""Function testing the support of Landsat-9 constellation processed by E84 and linked via a STAC URL"""
with tempenv.TemporaryEnvironment(
{
"AWS_SECRET_ACCESS_KEY": os.getenv("AWS_S3_AWS_SECRET_ACCESS_KEY"),
"AWS_ACCESS_KEY_ID": os.getenv("AWS_S3_AWS_ACCESS_KEY_ID"),
}
), s3.temp_s3(endpoint="s3.us-west-2.amazonaws.com", requester_pays=True):
with (
tempenv.TemporaryEnvironment(
{
"AWS_SECRET_ACCESS_KEY": os.getenv("AWS_S3_AWS_SECRET_ACCESS_KEY"),
"AWS_ACCESS_KEY_ID": os.getenv("AWS_S3_AWS_ACCESS_KEY_ID"),
}
),
s3.temp_s3(endpoint="s3.us-west-2.amazonaws.com", requester_pays=True),
):
_test_core(
"https://earth-search.aws.element84.com/v1/collections/landsat-c2-l2/items/LC09_L2SP_095022_20231119_02_T2",
Constellation.L9,
Expand Down
30 changes: 18 additions & 12 deletions CI/SCRIPTS_WEEKLY/test_stac_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,15 @@ def _test_core(

def test_s2_l1c_e84():
"""Function testing the support of Sentinel-2 L1C constellation processed by E84 and linked via a STAC URL"""
with tempenv.TemporaryEnvironment(
{
"AWS_SECRET_ACCESS_KEY": os.getenv("AWS_S3_AWS_SECRET_ACCESS_KEY"),
"AWS_ACCESS_KEY_ID": os.getenv("AWS_S3_AWS_ACCESS_KEY_ID"),
}
), s3.temp_s3(endpoint="s3.us-west-2.amazonaws.com", requester_pays=True):
with (
tempenv.TemporaryEnvironment(
{
"AWS_SECRET_ACCESS_KEY": os.getenv("AWS_S3_AWS_SECRET_ACCESS_KEY"),
"AWS_ACCESS_KEY_ID": os.getenv("AWS_S3_AWS_ACCESS_KEY_ID"),
}
),
s3.temp_s3(endpoint="s3.us-west-2.amazonaws.com", requester_pays=True),
):
_test_core(
"https://earth-search.aws.element84.com/v1/collections/sentinel-2-l1c/items/S2B_29SLD_20231121_0_L1C",
Constellation.S2,
Expand All @@ -91,12 +94,15 @@ def test_s2_l2a_e84():

def test_l9_e84():
"""Function testing the support of Landsat-9 constellation processed by E84 and linked via a STAC URL"""
with tempenv.TemporaryEnvironment(
{
"AWS_SECRET_ACCESS_KEY": os.getenv("AWS_S3_AWS_SECRET_ACCESS_KEY"),
"AWS_ACCESS_KEY_ID": os.getenv("AWS_S3_AWS_ACCESS_KEY_ID"),
}
), s3.temp_s3(endpoint="s3.us-west-2.amazonaws.com", requester_pays=True):
with (
tempenv.TemporaryEnvironment(
{
"AWS_SECRET_ACCESS_KEY": os.getenv("AWS_S3_AWS_SECRET_ACCESS_KEY"),
"AWS_ACCESS_KEY_ID": os.getenv("AWS_S3_AWS_ACCESS_KEY_ID"),
}
),
s3.temp_s3(endpoint="s3.us-west-2.amazonaws.com", requester_pays=True),
):
_test_core(
"https://earth-search.aws.element84.com/v1/collections/landsat-c2-l2/items/LC09_L2SP_095022_20231119_02_T2",
Constellation.L9,
Expand Down
52 changes: 13 additions & 39 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import eoreader

import tomllib

eoreader_metadata = {}
with open("../pyproject.toml", "rb") as f:
eoreader_metadata = tomllib.load(f)
# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
needs_sphinx = "4"
needs_sphinx = "7"

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
Expand Down Expand Up @@ -100,16 +104,16 @@
master_doc = "index"

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

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = eoreader.__version__
version = eoreader_metadata["project"]["version"]
# The full version, including alpha/beta/rc tags.
release = version

Expand Down Expand Up @@ -147,7 +151,7 @@
# further. For a list of options available for each theme, see the
# documentation.
html_theme_options = {
"repository_url": eoreader.__url__,
"repository_url": eoreader_metadata["project"]["urls"]["Source_Code"],
"use_repository_button": True,
"use_issues_button": True,
"use_edit_page_button": False,
Expand Down Expand Up @@ -179,36 +183,6 @@
# Output file base name for HTML help builder.
htmlhelp_basename = "eoreaderdoc"

# -- Options for LaTeX output ---------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(
master_doc,
"eoreader.tex",
"EOReader Documentation",
"ICube-SERTIT",
"manual",
)
]

# -- Options for manual page output ---------------------------------------

# One entry per manual page. List of tuples
Expand All @@ -234,8 +208,8 @@

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
"https://docs.python.org/3/": None,
"https://docs.python-requests.org/en/master/": None,
"python": ("https://docs.python.org/3/", None),
"python-request": ("https://docs.python-requests.org/en/master/", None),
}

add_function_parentheses = False
Expand Down
13 changes: 0 additions & 13 deletions eoreader/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,3 @@ def wrapper(*args, **kwargs):
return func(*args, **kwargs)

return wrapper


from .__meta__ import (
__author__,
__author_email__,
__copyright__,
__description__,
__documentation__,
__license__,
__title__,
__url__,
__version__,
)
62 changes: 29 additions & 33 deletions eoreader/products/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
# flake8: noqa
__all__ = ["Product", "SensorType", "OrbitDirection"]

from .product import Product, SensorType, OrbitDirection
from .product import OrbitDirection, Product, SensorType

__all__ += [
"CustomProduct",
"CustomFields",
]
from .custom_product import CustomProduct, CustomFields
from .custom_product import CustomFields, CustomProduct

# STAC products
__all__ += [
Expand All @@ -39,7 +39,7 @@
"OpticalProduct",
"CleanMethod",
]
from .optical.optical_product import OpticalProduct, CleanMethod
from .optical.optical_product import CleanMethod, OpticalProduct

# VHR
__all__ += [
Expand All @@ -64,24 +64,24 @@
"Gs2ProductType",
"Gs2BandCombination",
]
from .optical.vhr_product import VhrProduct
from .optical.dimap_v1_product import DimapV1Product
from .optical.dimap_v2_product import (
DimapV2BandCombination,
DimapV2Product,
DimapV2ProductType,
)
from .optical.pld_product import PldProduct
from .optical.spot67_product import Spot67Product
from .optical.gs2_product import Gs2BandCombination, Gs2Product, Gs2ProductType
from .optical.maxar_product import (
MaxarBandId,
MaxarProduct,
MaxarProductType,
MaxarSatId,
MaxarBandId,
)
from .optical.vis1_product import Vis1Product, Vis1ProductType, Vis1BandCombination
from .optical.sv1_product import Sv1Product, Sv1ProductType, Sv1BandCombination
from .optical.gs2_product import Gs2Product, Gs2ProductType, Gs2BandCombination
from .optical.pld_product import PldProduct
from .optical.spot67_product import Spot67Product
from .optical.sv1_product import Sv1BandCombination, Sv1Product, Sv1ProductType
from .optical.vhr_product import VhrProduct
from .optical.vis1_product import Vis1BandCombination, Vis1Product, Vis1ProductType

# SPOT4/5
__all__ += [
Expand All @@ -91,10 +91,10 @@
"Spot45Product",
]
from .optical.spot45_product import (
Spot45ProductType,
Spot4BandCombination,
Spot5BandCombination,
Spot45Product,
Spot45ProductType,
)

# Planet
Expand All @@ -110,23 +110,23 @@
"PlaProductType",
"PlaInstrument",
]
from .optical.pla_product import PlaProduct, PlaProductType, PlaInstrument
from .optical.pla_product import PlaInstrument, PlaProduct, PlaProductType

# SkySat
__all__ += [
"SkyProductType",
"SkyProduct",
"SkyInstrument",
]
from .optical.sky_product import SkyProductType, SkyProduct, SkyInstrument
from .optical.sky_product import SkyInstrument, SkyProduct, SkyProductType

# RapidEye
__all__ += [
"ReProductType",
"ReProduct",
"ReInstrument",
]
from .optical.re_product import ReProductType, ReProduct
from .optical.re_product import ReProduct, ReProductType

# Landsat
__all__ += [
Expand All @@ -136,10 +136,10 @@
"LandsatInstrument",
]
from .optical.landsat_product import (
LandsatProduct,
LandsatProductType,
LandsatCollection,
LandsatInstrument,
LandsatProduct,
LandsatProductType,
)

# Sentinel
Expand All @@ -163,24 +163,24 @@
"SlstrView",
"SlstrStripe",
]
from .optical.s2_e84_product import S2E84Product, S2E84StacProduct
from .optical.s2_mpc_product import S2MpcStacProduct
from .optical.s2_product import (
S2Product,
S2ProductType,
S2GmlMasks,
S2Jp2Masks,
S2Product,
S2ProductType,
S2StacProduct,
)
from .optical.s2_e84_product import S2E84Product, S2E84StacProduct
from .optical.s2_mpc_product import S2MpcStacProduct
from .optical.s2_theia_product import S2TheiaProduct
from .optical.s3_product import S3Product, S3ProductType, S3DataType, S3Instrument
from .optical.s3_olci_product import S3OlciProduct
from .optical.s3_product import S3DataType, S3Instrument, S3Product, S3ProductType
from .optical.s3_slstr_product import (
S3SlstrProduct,
SlstrRadAdjustTuple,
SlstrRadAdjust,
SlstrView,
SlstrRadAdjustTuple,
SlstrStripe,
SlstrView,
)

# -- SAR --
Expand Down Expand Up @@ -221,31 +221,27 @@
"CapellaProductType",
"CapellaSensorMode" "",
]
from .sar.sar_product import SarProduct, SarProductType, SnapDems
from .sar.capella_product import CapellaProduct, CapellaProductType, CapellaSensorMode
from .sar.cosmo_product import CosmoProduct, CosmoProductType
from .sar.csg_product import CsgProduct, CsgSensorMode
from .sar.csk_product import CskProduct, CskSensorMode
from .sar.iceye_product import IceyeProduct, IceyeProductType, IceyeSensorMode
from .sar.rcm_product import RcmProduct, RcmProductType, RcmSensorMode
from .sar.rs2_product import Rs2Product, Rs2ProductType, Rs2SensorMode
from .sar.s1_product import S1Product, S1SensorMode, S1ProductType
from .sar.s1_product import S1Product, S1ProductType, S1SensorMode
from .sar.s1_rtc_asf_product import S1RtcAsfProduct, S1RtcProductType
from .sar.s1_rtc_mpc_product import S1RtcMpcStacProduct
from .sar.saocom_product import (
SaocomPolarization,
SaocomProduct,
SaocomProductType,
SaocomPolarization,
SaocomSensorMode,
)
from .sar.sar_product import SarProduct, SarProductType, SnapDems
from .sar.tsx_product import (
TsxProduct,
TsxPolarization,
TsxSatId,
TsxProduct,
TsxProductType,
TsxSatId,
TsxSensorMode,
)
from .sar.capella_product import (
CapellaProduct,
CapellaProductType,
CapellaSensorMode,
)
Loading