From 1d4fe928197b50f644614aa9c55a2931e84dede4 Mon Sep 17 00:00:00 2001 From: grouazel Date: Wed, 13 Nov 2024 10:31:52 +0100 Subject: [PATCH 01/17] first version of pyproject.toml --- pyproject.toml | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..7fb80c8 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,89 @@ +[project] +name = "xsar" +requires-python = ">= 3.10" +license = {text = "MIT"} +description = "Python xarray library to use Level-1 GRD Synthetic Aperture Radar products" +readme = "README.md" +dependencies = [ + 'GDAL', + 'dask[array]', + 'distributed', + "xarray>=2024.10.0", + 'affine', + 'rasterio', + 'cartopy', + 'fiona', + 'pyproj', + 'numpy', + 'scipy', + 'shapely', + 'geopandas', + 'fsspec', + 'aiohttp', + 'pytz', + 'psutil', + 'jinja2', + 'rioxarray', + 'lxml' +] +keywords = [ + "xarray", + "earth-observation", + "remote-sensing", + "satellite-imagery", + "Sentinel-1", + "RCM", + "RadarSat2", + "sar", + "synthetic-aperture-radar", + ] +classifiers = [ + "Development Status :: 4 - Beta", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Intended Audience :: Science/Research", + "Topic :: Scientific/Engineering", +] +dynamic = ["version"] + +[project.urls] +homepage = "https://github.com/umr-lops/xsar.readthedocs.io" +documentation = "https://xsar.readthedocs.io" +repository = "https://github.com/umr-lops/xsar" +changelog = "https://xsar.readthedocs.io/en/latest/changelog.html" + +[project.scripts] +ceos-alos2-create-cache = "ceos_alos2.sar_image.cli:main" +xarray.backends = "xsar.xarray_backends:XsarXarrayBackend" + +[build-system] +requires = ["setuptools>=64.0", "setuptools-scm"] +build-backend = "setuptools.build_meta" + +[tool.setuptools] +packages = ["xsar"] + +[tool.setuptools_scm] +fallback_version = "999" + +[tool.isort] +profile = "black" +skip_gitignore = true +float_to_top = true +default_section = "THIRDPARTY" +known_first_party = "xsar" + +[tool.black] +line-length = 100 + +[tool.coverage.run] +source = ["xsar"] +branch = true + +[tool.coverage.report] +show_missing = true +exclude_lines = ["pragma: no cover", "if TYPE_CHECKING"] From 2bb8abdeb8088587bacafeb02b676d87d0efb8aa Mon Sep 17 00:00:00 2001 From: grouazel Date: Wed, 13 Nov 2024 10:32:11 +0100 Subject: [PATCH 02/17] add a workflow for Continuous integration --- .github/workflows/ci.yaml | 84 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..c0e69ee --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,84 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + detect-skip-ci-trigger: + name: "Detect CI Trigger: [skip-ci]" + if: | + github.repository == 'umr-lops/xsar' + && github.event_name == 'push' + || github.event_name == 'pull_request' + runs-on: ubuntu-latest + outputs: + triggered: ${{ steps.detect-trigger.outputs.trigger-found }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 2 + - uses: xarray-contrib/ci-trigger@v1 + id: detect-trigger + with: + keyword: "[skip-ci]" + + ci: + name: ${{ matrix.os }} py${{ matrix.python-version }} + runs-on: ${{ matrix.os }} + needs: detect-skip-ci-trigger + + if: needs.detect-skip-ci-trigger.outputs.triggered == 'false' + + defaults: + run: + shell: bash -l {0} + + strategy: + fail-fast: false + matrix: + python-version: ["3.10", "3.11"] + os: ["ubuntu-latest", "macos-latest", "windows-latest"] + + steps: + - name: Checkout the repository + uses: actions/checkout@v4 + with: + # need to fetch all tags to get a correct version + fetch-depth: 0 # fetch all branches and tags + + - name: Setup environment variables + run: | + echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV + + echo "CONDA_ENV_FILE=ci/requirements/environment.yaml" >> $GITHUB_ENV + + - name: Setup micromamba + uses: mamba-org/setup-micromamba@v1 + with: + environment-file: ${{ env.CONDA_ENV_FILE }} + environment-name: xsar-tests + cache-environment: true + cache-environment-key: "${{runner.os}}-${{runner.arch}}-py${{matrix.python-version}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}" + create-args: >- + python=${{matrix.python-version}} + conda + + - name: Install xsar + run: | + python -m pip install --no-deps -e . + + - name: Import xsar + run: | + python -c "import xsar" + + - name: Run tests + run: | + python -m pytest --cov=xsar From 3fedbc1d537ebd1e3c14a1e80ae3f9355e23950c Mon Sep 17 00:00:00 2001 From: grouazel Date: Wed, 13 Nov 2024 10:32:27 +0100 Subject: [PATCH 03/17] add a workflow for upstream developments --- .github/workflows/upstream-dev.yaml | 99 +++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 .github/workflows/upstream-dev.yaml diff --git a/.github/workflows/upstream-dev.yaml b/.github/workflows/upstream-dev.yaml new file mode 100644 index 0000000..82378a2 --- /dev/null +++ b/.github/workflows/upstream-dev.yaml @@ -0,0 +1,99 @@ +name: upstream-dev CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + schedule: + - cron: "0 18 * * 0" # Weekly "On Sundays at 18:00" UTC + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + detect-test-upstream-trigger: + name: "Detect CI Trigger: [test-upstream]" + if: github.event_name == 'push' || github.event_name == 'pull_request' + runs-on: ubuntu-latest + outputs: + triggered: ${{ steps.detect-trigger.outputs.trigger-found }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 2 + - uses: xarray-contrib/ci-trigger@v1.2 + id: detect-trigger + with: + keyword: "[test-upstream]" + + upstream-dev: + name: upstream-dev + runs-on: ubuntu-latest + needs: detect-test-upstream-trigger + + if: | + always() + && github.repository == 'umr-lops/xsar' + && ( + github.event_name == 'schedule' + || github.event_name == 'workflow_dispatch' + || needs.detect-test-upstream-trigger.outputs.triggered == 'true' + || contains(github.event.pull_request.labels.*.name, 'run-upstream') + ) + + defaults: + run: + shell: bash -l {0} + + strategy: + fail-fast: false + matrix: + python-version: ["3.11"] + + steps: + - name: checkout the repository + uses: actions/checkout@v4 + with: + # need to fetch all tags to get a correct version + fetch-depth: 0 # fetch all branches and tags + + - name: set up conda environment + uses: mamba-org/setup-micromamba@v1 + with: + environment-file: ci/requirements/environment.yaml + environment-name: tests + create-args: >- + python=${{ matrix.python-version }} + pytest-reportlog + conda + + - name: install upstream-dev dependencies + run: bash ci/install-upstream-dev.sh + + - name: install the package + run: python -m pip install --no-deps -e . + + - name: show versions + run: python -m pip list + + - name: import + run: | + python -c 'import xsar' + + - name: run tests + if: success() + id: status + run: | + python -m pytest -rf --report-log=pytest-log.jsonl + + - name: report failures + if: | + failure() + && steps.tests.outcome == 'failure' + && github.event_name == 'schedule' + uses: xarray-contrib/issue-from-pytest-log@v1 + with: + log-path: pytest-log.jsonl From 6b06777c30b64e14b81319f09cc71ef47417ab06 Mon Sep 17 00:00:00 2001 From: grouazel Date: Wed, 13 Nov 2024 10:36:44 +0100 Subject: [PATCH 04/17] add CI files --- .github/release.yml | 5 +++++ ci/install-upstream-dev.sh | 17 +++++++++++++++++ ci/requirements/docs.yaml | 8 ++++++++ ci/requirements/environment.yaml | 20 ++++++++++++++++++++ 4 files changed, 50 insertions(+) create mode 100644 .github/release.yml create mode 100644 ci/install-upstream-dev.sh create mode 100644 ci/requirements/docs.yaml create mode 100644 ci/requirements/environment.yaml diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 0000000..9d1e098 --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,5 @@ +changelog: + exclude: + authors: + - dependabot + - pre-commit-ci diff --git a/ci/install-upstream-dev.sh b/ci/install-upstream-dev.sh new file mode 100644 index 0000000..13fa881 --- /dev/null +++ b/ci/install-upstream-dev.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +conda remove -y --force cytoolz numpy xarray construct toolz fsspec python-dateutil pandas +python -m pip install \ + -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple \ + --no-deps \ + --pre \ + --upgrade \ + numpy \ + pandas \ + xarray +python -m pip install --upgrade \ + git+https://github.com/construct/construct \ + git+https://github.com/pytoolz/toolz \ + git+https://github.com/xarray-contrib/datatree \ + git+https://github.com/fsspec/filesystem_spec \ + git+https://github.com/dateutil/dateutil diff --git a/ci/requirements/docs.yaml b/ci/requirements/docs.yaml new file mode 100644 index 0000000..4ca8ee3 --- /dev/null +++ b/ci/requirements/docs.yaml @@ -0,0 +1,8 @@ +name: xsar-docs +channels: + - conda-forge +dependencies: + - python=3.11 + - sphinx>=4 + - sphinx_book_theme + - ipython diff --git a/ci/requirements/environment.yaml b/ci/requirements/environment.yaml new file mode 100644 index 0000000..98587c1 --- /dev/null +++ b/ci/requirements/environment.yaml @@ -0,0 +1,20 @@ +name: xsar-tests +channels: + - conda-forge +dependencies: + - ipython + - pre-commit + - pytest + - pytest-reportlog + - pytest-cov + - numpy + - toolz + - cytoolz + - python-dateutil + - construct + - fsspec + - xarray + - dask + - distributed + - aiohttp + - requests From 12fea8aec97c82051fd9fd43095e0104249d9246 Mon Sep 17 00:00:00 2001 From: grouazel Date: Wed, 13 Nov 2024 10:37:14 +0100 Subject: [PATCH 05/17] remove setup.py --- setup.py | 50 -------------------------------------------------- 1 file changed, 50 deletions(-) delete mode 100644 setup.py diff --git a/setup.py b/setup.py deleted file mode 100644 index 7b5bc0f..0000000 --- a/setup.py +++ /dev/null @@ -1,50 +0,0 @@ -from setuptools import setup, find_packages -import glob - -setup( - name='xsar', - package_dir={'': 'src'}, - packages=find_packages('src'), - scripts=glob.glob('src/scripts/*.py'), - url='https://github.com/umr-lops/xsar', - use_scm_version=True, - setup_requires=['setuptools_scm'], - include_package_data=True, - install_requires=[ - 'GDAL', - 'dask[array]', - 'distributed', - "xarray>=2024.10.0", - 'affine', - 'rasterio', - 'cartopy', - 'fiona', - 'pyproj', - 'numpy', - 'scipy', - 'shapely', - 'geopandas', - 'fsspec', - 'aiohttp', - 'pytz', - 'psutil', - 'jinja2', - 'rioxarray', - 'lxml' - ], - extras_require={ - "RS2": ["xradarsat2"], - "RCM": ["xarray-safe-rcm"], - "S1": ["xarray-safe-s1"] - }, - entry_points={ - "xarray.backends": ["xsar=xsar.xarray_backends:XsarXarrayBackend"] - }, - license='MIT', - author='Olivier Archer, Alexandre Levieux, Antoine Grouazel', - author_email='Olivier.Archer@ifremer.fr, Alexandre.Levieux@gmail.com, Antoine.Grouazel@ifremer.fr', - description='xarray L1 SAR mapper', - summary='Python xarray library to use Level-1 GRD SAR products', - long_description_content_type='text/x-rst', - long_description = 'Python xarray library to use Level-1 GRD Synthetic Aperture Radar products' -) From 126da94f781b1a29fae4d776a9f6896d116be640 Mon Sep 17 00:00:00 2001 From: grouazel Date: Wed, 13 Nov 2024 10:55:34 +0100 Subject: [PATCH 06/17] linter --- pyproject.toml | 62 +++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 7fb80c8..46e80e5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,42 +1,42 @@ [project] name = "xsar" requires-python = ">= 3.10" -license = {text = "MIT"} +license = { text = "MIT" } description = "Python xarray library to use Level-1 GRD Synthetic Aperture Radar products" readme = "README.md" dependencies = [ - 'GDAL', - 'dask[array]', - 'distributed', - "xarray>=2024.10.0", - 'affine', - 'rasterio', - 'cartopy', - 'fiona', - 'pyproj', - 'numpy', - 'scipy', - 'shapely', - 'geopandas', - 'fsspec', - 'aiohttp', - 'pytz', - 'psutil', - 'jinja2', - 'rioxarray', - 'lxml' + 'GDAL', + 'dask[array]', + 'distributed', + "xarray>=2024.10.0", + 'affine', + 'rasterio', + 'cartopy', + 'fiona', + 'pyproj', + 'numpy', + 'scipy', + 'shapely', + 'geopandas', + 'fsspec', + 'aiohttp', + 'pytz', + 'psutil', + 'jinja2', + 'rioxarray', + 'lxml', ] keywords = [ - "xarray", - "earth-observation", - "remote-sensing", - "satellite-imagery", - "Sentinel-1", - "RCM", - "RadarSat2", - "sar", - "synthetic-aperture-radar", - ] + "xarray", + "earth-observation", + "remote-sensing", + "satellite-imagery", + "Sentinel-1", + "RCM", + "RadarSat2", + "sar", + "synthetic-aperture-radar", +] classifiers = [ "Development Status :: 4 - Beta", "License :: OSI Approved :: MIT License", From d7fa644be1445c487c287ccf2aa1bffa9734e5ce Mon Sep 17 00:00:00 2001 From: Antoine Grouazel Date: Wed, 13 Nov 2024 12:10:10 +0100 Subject: [PATCH 07/17] Update .github/workflows/ci.yaml Co-authored-by: Justus Magin --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c0e69ee..6db24ec 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -44,7 +44,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.10", "3.11"] + python-version: ["3.10", "3.11", "3.12"] os: ["ubuntu-latest", "macos-latest", "windows-latest"] steps: From f02e8c1a5507d392f1d5451fecf94471ed6e1f20 Mon Sep 17 00:00:00 2001 From: Antoine Grouazel Date: Wed, 13 Nov 2024 12:10:24 +0100 Subject: [PATCH 08/17] Update .github/workflows/ci.yaml Co-authored-by: Justus Magin --- .github/workflows/ci.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6db24ec..a546d4a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -69,7 +69,6 @@ jobs: cache-environment-key: "${{runner.os}}-${{runner.arch}}-py${{matrix.python-version}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}" create-args: >- python=${{matrix.python-version}} - conda - name: Install xsar run: | From d26ea1e8447bfffc21e109e08ac9cce22f654a06 Mon Sep 17 00:00:00 2001 From: Antoine Grouazel Date: Wed, 13 Nov 2024 12:10:41 +0100 Subject: [PATCH 09/17] Update .github/workflows/ci.yaml Co-authored-by: Justus Magin --- .github/workflows/ci.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a546d4a..c168fd2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -16,8 +16,9 @@ jobs: name: "Detect CI Trigger: [skip-ci]" if: | github.repository == 'umr-lops/xsar' - && github.event_name == 'push' - || github.event_name == 'pull_request' + && ( + github.event_name == 'push' || github.event_name == 'pull_request' + ) runs-on: ubuntu-latest outputs: triggered: ${{ steps.detect-trigger.outputs.trigger-found }} From 9ff54916f5cb88c4c29f24d76997eb4c1342779c Mon Sep 17 00:00:00 2001 From: Antoine Grouazel Date: Wed, 13 Nov 2024 12:10:54 +0100 Subject: [PATCH 10/17] Update .github/workflows/upstream-dev.yaml Co-authored-by: Justus Magin --- .github/workflows/upstream-dev.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/upstream-dev.yaml b/.github/workflows/upstream-dev.yaml index 82378a2..1662542 100644 --- a/.github/workflows/upstream-dev.yaml +++ b/.github/workflows/upstream-dev.yaml @@ -51,7 +51,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.11"] + python-version: ["3.12"] steps: - name: checkout the repository From c08994d29464e7a5643177f50f0dec51ba63b00b Mon Sep 17 00:00:00 2001 From: Antoine Grouazel Date: Wed, 13 Nov 2024 12:11:04 +0100 Subject: [PATCH 11/17] Update .github/workflows/upstream-dev.yaml Co-authored-by: Justus Magin --- .github/workflows/upstream-dev.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/upstream-dev.yaml b/.github/workflows/upstream-dev.yaml index 1662542..68ba1ad 100644 --- a/.github/workflows/upstream-dev.yaml +++ b/.github/workflows/upstream-dev.yaml @@ -68,7 +68,6 @@ jobs: create-args: >- python=${{ matrix.python-version }} pytest-reportlog - conda - name: install upstream-dev dependencies run: bash ci/install-upstream-dev.sh From 59bb12b7291f8d9eb34a0df7068d3ecd533452cb Mon Sep 17 00:00:00 2001 From: grouazel Date: Wed, 13 Nov 2024 12:16:25 +0100 Subject: [PATCH 12/17] remove requests --- ci/requirements/environment.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/ci/requirements/environment.yaml b/ci/requirements/environment.yaml index 98587c1..ec381cd 100644 --- a/ci/requirements/environment.yaml +++ b/ci/requirements/environment.yaml @@ -17,4 +17,3 @@ dependencies: - dask - distributed - aiohttp - - requests From 6f834fbc87fef7747e5b778f6251f4ec1e55ab6d Mon Sep 17 00:00:00 2001 From: grouazel Date: Wed, 13 Nov 2024 12:19:03 +0100 Subject: [PATCH 13/17] fix dependencies and entrypoint in pyproject.toml --- pyproject.toml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 46e80e5..4669da7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,6 +26,11 @@ dependencies = [ 'rioxarray', 'lxml', ] +[project.optional-dependencies] +RS2 = ["xradarsat2"] +RCM = ["xarray-safe-rcm"] +S1 = ["xarray-safe-s1"] + keywords = [ "xarray", "earth-observation", @@ -41,10 +46,8 @@ classifiers = [ "Development Status :: 4 - Beta", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", - "Programming Language :: Python", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Intended Audience :: Science/Research", "Topic :: Scientific/Engineering", ] @@ -57,7 +60,6 @@ repository = "https://github.com/umr-lops/xsar" changelog = "https://xsar.readthedocs.io/en/latest/changelog.html" [project.scripts] -ceos-alos2-create-cache = "ceos_alos2.sar_image.cli:main" xarray.backends = "xsar.xarray_backends:XsarXarrayBackend" [build-system] From 9bd478820b7ded3be443b0a43d5a4f4f0663fd72 Mon Sep 17 00:00:00 2001 From: grouazel Date: Wed, 13 Nov 2024 12:21:48 +0100 Subject: [PATCH 14/17] adapt install-upstream-dev.sh --- ci/install-upstream-dev.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ci/install-upstream-dev.sh b/ci/install-upstream-dev.sh index 13fa881..c56948c 100644 --- a/ci/install-upstream-dev.sh +++ b/ci/install-upstream-dev.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -conda remove -y --force cytoolz numpy xarray construct toolz fsspec python-dateutil pandas +conda remove -y --force cytoolz numpy xarray toolz python-dateutil pandas python -m pip install \ -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple \ --no-deps \ @@ -10,8 +10,5 @@ python -m pip install \ pandas \ xarray python -m pip install --upgrade \ - git+https://github.com/construct/construct \ git+https://github.com/pytoolz/toolz \ - git+https://github.com/xarray-contrib/datatree \ - git+https://github.com/fsspec/filesystem_spec \ git+https://github.com/dateutil/dateutil From 0631a57b578e0b1d6d0b602ebf50be6862e1a169 Mon Sep 17 00:00:00 2001 From: grouazel Date: Wed, 13 Nov 2024 12:33:14 +0100 Subject: [PATCH 15/17] linter and comment the XsarXarrayBackend --- pyproject.toml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 4669da7..272e168 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,6 +2,13 @@ name = "xsar" requires-python = ">= 3.10" license = { text = "MIT" } +authors = [ + { name = "Olivier Archer", email = "olivier.archer@ifremer.fr" }, + { name = "Antoine Grouazel", email = "antoine.grouazel@ifremer.fr" }, + { name = "Alexandre Levieux", email = "alexandre.levieux@gmail.com" }, + { name = "Yann Reynaud", email = "yann.reynaud@ifremer.fr" }, + { name = 'Vincent Lheureux', email = "vinc.lheureux@gmail.com" }, +] description = "Python xarray library to use Level-1 GRD Synthetic Aperture Radar products" readme = "README.md" dependencies = [ @@ -60,7 +67,7 @@ repository = "https://github.com/umr-lops/xsar" changelog = "https://xsar.readthedocs.io/en/latest/changelog.html" [project.scripts] -xarray.backends = "xsar.xarray_backends:XsarXarrayBackend" +#xsar = "xsar.xarray_backends:XsarXarrayBackend" [build-system] requires = ["setuptools>=64.0", "setuptools-scm"] From 48c1861181542df74f1197bc166011d877e03af8 Mon Sep 17 00:00:00 2001 From: grouazel Date: Wed, 13 Nov 2024 12:44:46 +0100 Subject: [PATCH 16/17] fix version and pyproject sections order --- pyproject.toml | 46 ++++++++++++++++++++++++-------------------- src/xsar/__init__.py | 11 +++++++++++ 2 files changed, 36 insertions(+), 21 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 272e168..c599c79 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,6 +11,29 @@ authors = [ ] description = "Python xarray library to use Level-1 GRD Synthetic Aperture Radar products" readme = "README.md" +keywords = [ + "xarray", + "earth-observation", + "remote-sensing", + "satellite-imagery", + "Sentinel-1", + "RCM", + "RadarSat2", + "sar", + "synthetic-aperture-radar", +] +classifiers = [ + "Development Status :: 4 - Beta", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Intended Audience :: Science/Research", + "Topic :: Scientific/Engineering", +] +dynamic = ["version"] dependencies = [ 'GDAL', 'dask[array]', @@ -38,27 +61,7 @@ RS2 = ["xradarsat2"] RCM = ["xarray-safe-rcm"] S1 = ["xarray-safe-s1"] -keywords = [ - "xarray", - "earth-observation", - "remote-sensing", - "satellite-imagery", - "Sentinel-1", - "RCM", - "RadarSat2", - "sar", - "synthetic-aperture-radar", -] -classifiers = [ - "Development Status :: 4 - Beta", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Intended Audience :: Science/Research", - "Topic :: Scientific/Engineering", -] -dynamic = ["version"] + [project.urls] homepage = "https://github.com/umr-lops/xsar.readthedocs.io" @@ -75,6 +78,7 @@ build-backend = "setuptools.build_meta" [tool.setuptools] packages = ["xsar"] +package-dir = {"" = "src"} [tool.setuptools_scm] fallback_version = "999" diff --git a/src/xsar/__init__.py b/src/xsar/__init__.py index 5e72da5..c5071db 100644 --- a/src/xsar/__init__.py +++ b/src/xsar/__init__.py @@ -21,3 +21,14 @@ from xsar.base_dataset import BaseDataset from xsar.base_meta import BaseMeta from xsar.xsar import open_dataset,open_datatree,product_info + + +import xsar +try: + from importlib import metadata +except ImportError: # for Python<3.8 + import importlib_metadata as metadata +try: + __version__ = metadata.version("xsar") +except Exception: + __version__ = "999" From a0b88a0b7bebb07d2e5596131ba47a13355d482b Mon Sep 17 00:00:00 2001 From: grouazel Date: Wed, 13 Nov 2024 13:43:55 +0100 Subject: [PATCH 17/17] keep only Olivier as the creator/auhor of xsar, other contributors are visible in github --- pyproject.toml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c599c79..02110c2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,10 +4,6 @@ requires-python = ">= 3.10" license = { text = "MIT" } authors = [ { name = "Olivier Archer", email = "olivier.archer@ifremer.fr" }, - { name = "Antoine Grouazel", email = "antoine.grouazel@ifremer.fr" }, - { name = "Alexandre Levieux", email = "alexandre.levieux@gmail.com" }, - { name = "Yann Reynaud", email = "yann.reynaud@ifremer.fr" }, - { name = 'Vincent Lheureux', email = "vinc.lheureux@gmail.com" }, ] description = "Python xarray library to use Level-1 GRD Synthetic Aperture Radar products" readme = "README.md"