From 7947e7b2209ae9dc83389077605337edbb8df7e0 Mon Sep 17 00:00:00 2001 From: CORIAT BASTIEN Date: Wed, 13 Mar 2024 17:34:29 +0100 Subject: [PATCH] Migrate from setup.py to pyproject.toml and update sphinx version --- .flake8 | 4 +++ .gitignore | 1 + docs/conf.py | 52 +++++++++------------------------- eoreader/__init__.py | 13 --------- pyproject.toml | 17 ++++++++++- requirements-doc.txt | 2 +- setup.cfg | 14 --------- setup.py | 67 -------------------------------------------- 8 files changed, 35 insertions(+), 135 deletions(-) create mode 100644 .flake8 delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.flake8 b/.flake8 new file mode 100644 index 00000000..adcccf9c --- /dev/null +++ b/.flake8 @@ -0,0 +1,4 @@ +# compatibility black and flake8 +[flake8] +max-line-length = 88 +extend-ignore = E203, E501 diff --git a/.gitignore b/.gitignore index dc311b5b..1a681a08 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ __pycache__/ cov.xml *.lock .run +venv # Discard CI/OUTPUTS CI/OUTPUT/* diff --git a/docs/conf.py b/docs/conf.py index 32a7009c..796ee70f 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -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 @@ -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 @@ -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, @@ -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 @@ -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 diff --git a/eoreader/__init__.py b/eoreader/__init__.py index 483c2c16..848bc04a 100644 --- a/eoreader/__init__.py +++ b/eoreader/__init__.py @@ -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__, -) diff --git a/pyproject.toml b/pyproject.toml index 8d2069cf..0a4f8ede 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,8 +2,13 @@ requires = ["setuptools", "setuptools-scm"] build-backend = "setuptools.build_meta" +[tool.setuptools.packages.find] +include = ["eoreader*"] +namespaces = false + [project] name = "eoreader" +version = "0.20.4" authors = [ {name = "ICube-SERTIT", email = "dev-sertit@unistra.fr"}, ] @@ -33,7 +38,7 @@ dependencies = [ "xarray>=0.18.0", "rioxarray>=0.10.0", "geopandas>=0.11.0", - "sertit[full]>=1.27.0", + "sertit[full]>=1.30.0", "spyndex>=0.3.0", "pyresample", "zarr", @@ -42,3 +47,13 @@ dependencies = [ "methodtools", "dicttoxml", ] + +[project.urls] +Bug_Tracker = "https://github.com/sertit/eoreader/issues" +Documentation = "https://eoreader.readthedocs.io" +Source_Code = "https://github.com/sertit/eoreader" + +# compatibility black and isort +[tool.isort] +profile = "black" +known_first_party = ["CI", "eoreader"] diff --git a/requirements-doc.txt b/requirements-doc.txt index 9dd82a2c..22dce09b 100644 --- a/requirements-doc.txt +++ b/requirements-doc.txt @@ -1,7 +1,7 @@ -r requirements.txt # Doc -sphinx<6.0.0 # workaround +sphinx ipython # workaround sphinx-book-theme sphinx-copybutton diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 3d958c37..00000000 --- a/setup.cfg +++ /dev/null @@ -1,14 +0,0 @@ -[flake8] -ignore = W605, W503, F405, E501, F403 -max-line-length = 200 - -[isort] -multi_line_output = 3 -include_trailing_comma = True -force_grid_wrap = 0 -use_parentheses = True -line_length = 88 -ensure_newline_before_comments = True -known_first_party = eoreader, CI -profile = black -skip_glob = */eoreader/products/__init__.py diff --git a/setup.py b/setup.py deleted file mode 100644 index 9c5529ae..00000000 --- a/setup.py +++ /dev/null @@ -1,67 +0,0 @@ -import os - -import setuptools - -from eoreader.__meta__ import ( - __author__, - __author_email__, - __description__, - __documentation__, - __title__, - __url__, - __version__, -) - -BASEDIR = os.path.dirname(os.path.abspath(os.path.realpath(__file__))) -with open(os.path.join(BASEDIR, "README.md"), "r", encoding="utf8") as f: - readme = f.read() - -setuptools.setup( - name=__title__, - version=__version__, - author=__author__, - author_email=__author_email__, - description=__description__, - long_description=readme, - long_description_content_type="text/markdown", - packages=setuptools.find_packages(), - install_requires=[ - "lxml", - "h5netcdf", - "scipy", - "rasterio>=1.3.0", - "xarray>=0.18.0", - "rioxarray>=0.10.0", - "geopandas>=0.11.0", - "sertit[full]>=1.30.0", - "spyndex>=0.3.0", - "pyresample", - "zarr", - "rtree", - "validators", - "methodtools", - "dicttoxml", - ], - 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", - ], - package_data={"": ["LICENSE", "NOTICE"], "eoreader.data": ["*.xml"]}, - include_package_data=True, - python_requires=">=3.9", - project_urls={ - "Bug Tracker": f"{__url__}/issues/", - "Documentation": __documentation__, - "Source Code": __url__, - }, -)