diff --git a/.github/workflows/docs-build.yml b/.github/workflows/docs-build.yml index 536f32d4..359a6f37 100644 --- a/.github/workflows/docs-build.yml +++ b/.github/workflows/docs-build.yml @@ -12,7 +12,7 @@ jobs: fetch-depth: 0 - uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: "3.12" - name: Install GDAL run: | python -m pip install --upgrade pip diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 0750f827..2a65d790 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -10,7 +10,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: "3.12" - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index ca67f825..b625ee38 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -15,28 +15,51 @@ jobs: fail-fast: false matrix: config: - - { os: macOS-latest, py: "3.11" } + - { os: macOS-latest, py: "3.12" } + defaults: + run: + shell: bash -el {0} env: SDKROOT: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk steps: - - name: CHECKOUT CODE - uses: actions/checkout@v4 - - name: SETUP PYTHON - uses: actions/setup-python@v5 + - uses: actions/checkout@v4 + + - name: Setup Python + uses: conda-incubator/setup-miniconda@v3 with: + auto-activate-base: true python-version: ${{ matrix.config.py }} - # - name: Install GDAL - # run: | - # python -m pip install --upgrade pip - # pip install --no-cache-dir Cython - # pip install --find-links=https://girder.github.io/large_image_wheels --no-cache GDAL - # - name: Test GDAL installation - # run: | - # python -c "from osgeo import gdal" - # gdalinfo --version + channels: conda-forge,defaults + channel-priority: true + miniconda-version: latest + + - name: Cache dependencies + uses: actions/cache@v4 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + + - name: Testing conda + run: | + conda info + conda list + + - name: Install GDAL + run: | + conda install -c conda-forge mamba --yes + mamba install -c conda-forge gdal pyproj --yes + + - name: Test GDAL installation + run: | + python -c "from osgeo import gdal" + gdalinfo --version + - name: Install dependencies run: | - python -m pip install --upgrade pip - pip install --no-cache-dir Cython - pip install codespell -r requirements.txt + pip install -r requirements.txt pip install . + + - name: Test import + run: python -c "import samgeo; print('samgeo import successful')" diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index ae450659..2f43305a 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -26,5 +26,6 @@ jobs: TWINE_USERNAME: ${{ secrets.PYPI_USERS }} TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | - python setup.py sdist bdist_wheel + pip install build + python -m build twine upload dist/* diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index c584e1f9..d65af156 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -17,6 +17,7 @@ jobs: config: - { os: ubuntu-latest, py: "3.10" } - { os: ubuntu-latest, py: "3.11" } + - { os: ubuntu-latest, py: "3.12" } env: SDKROOT: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index dc67168a..1dcd6f7e 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -16,9 +16,9 @@ jobs: uses: conda-incubator/setup-miniconda@v3 with: auto-activate-base: true - python-version: "3.10" + python-version: "3.12" - name: Install GDAL - run: conda install -c conda-forge gdal=3.4.0 --yes + run: conda install -c conda-forge gdal --yes - name: Test GDAL installation run: | python -c "from osgeo import gdal" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fb38c940..597253c4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,13 +15,16 @@ repos: rev: 24.8.0 hooks: - id: black-jupyter - language_version: python3.11 - repo: https://github.com/codespell-project/codespell rev: v2.3.0 hooks: - id: codespell - args: [--toml, pyproject-codespell.precommit-toml] + args: + [ + "--ignore-words-list=aci,acount,acounts,fallow,ges,hart,hist,nd,ned,ois,wqs,watermask,tre,pres", + "--skip=*.csv,*.geojson,*.json,*.yml*.js,*.html,*cff,*.pdf", + ] - repo: https://github.com/kynan/nbstripout rev: 0.7.1 diff --git a/pyproject-codespell.precommit-toml b/pyproject-codespell.precommit-toml deleted file mode 100644 index 8aa8fdfc..00000000 --- a/pyproject-codespell.precommit-toml +++ /dev/null @@ -1,3 +0,0 @@ -[tool.codespell] -ignore-words-list = "aci,acount,acounts,fallow,ges,hart,hist,nd,ned,ois,wqs,watermask,tre,pres" -skip="*.csv,*.geojson,*.json,*.yml*.js,*.html,*cff,*.pdf" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..1a5b96b1 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,67 @@ +[build-system] +requires = ["setuptools>=64", "setuptools_scm>=8"] +build-backend = "setuptools.build_meta" + +[project] +name = "segment-geospatial" +version = "0.11.0" +dynamic = [ + "dependencies", +] +description = "Meta AI' Segment Anything Model (SAM) for Geospatial Data." +readme = "README.md" +requires-python = ">=3.10" +license = {text = "MIT license"} +keywords = ["samgeo"] +classifiers = [ + "Development Status :: 2 - Pre-Alpha", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Natural Language :: English", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", +] +authors = [{name = "Qiusheng Wu", email = "giswqs@gmail.com"}] + +[project.optional-dependencies] +all = ["groundingdino-py"] + +[tool] +[tool.setuptools.packages.find] +include = ["samgeo*"] +exclude = ["docs*"] + + +[tool.setuptools.dynamic] +dependencies = {file = ["requirements.txt"]} + +[tool.distutils.bdist_wheel] +universal = true + +[tool.bumpversion] +current_version = "0.11.0" +commit = true +tag = true + +[[tool.bumpversion.files]] +filename = "pyproject.toml" +search = 'version = "{current_version}"' +replace = 'version = "{new_version}"' + +[[tool.bumpversion.files]] +filename = "leafmap/__init__.py" +search = '__version__ = "{current_version}"' +replace = '__version__ = "{new_version}"' + +[tool.flake8] +exclude = [ + "docs", +] +max-line-length = 88 + +[tool.setuptools_scm] + +[project.urls] +Homepage = "https://github.com/opengeos/segment-geospatial" \ No newline at end of file diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 16bf241c..00000000 --- a/setup.cfg +++ /dev/null @@ -1,20 +0,0 @@ -[bumpversion] -current_version = 0.11.0 -commit = True -tag = True - -[bumpversion:file:setup.py] -search = version="{current_version}" -replace = version="{new_version}" - -[bumpversion:file:samgeo/__init__.py] -search = __version__ = "{current_version}" -replace = __version__ = "{new_version}" - -[bdist_wheel] -universal = 1 - -[flake8] -exclude = docs - -[aliases] diff --git a/setup.py b/setup.py deleted file mode 100644 index 06f2d7c4..00000000 --- a/setup.py +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env python - -"""The setup script.""" - -import io -from os import path as op -from setuptools import setup, find_packages - -with open("README.md") as readme_file: - readme = readme_file.read() - -here = op.abspath(op.dirname(__file__)) - -# get the dependencies and installs -with io.open(op.join(here, "requirements.txt"), encoding="utf-8") as f: - all_reqs = f.read().split("\n") - -install_requires = [x.strip() for x in all_reqs if "git+" not in x] -dependency_links = [x.strip().replace("git+", "") for x in all_reqs if "git+" not in x] - -extras_requires = { - "all": ["groundingdino-py"], -} - -requirements = [] - -setup_requirements = [] - -test_requirements = [] - -setup( - author="Qiusheng Wu", - author_email="giswqs@gmail.com", - python_requires=">=3.8", - classifiers=[ - "Intended Audience :: Developers", - "License :: OSI Approved :: MIT License", - "Natural Language :: English", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - ], - description="Meta AI' Segment Anything Model (SAM) for Geospatial Data", - install_requires=install_requires, - extras_require=extras_requires, - dependency_links=dependency_links, - license="MIT license", - long_description=readme, - long_description_content_type="text/markdown", - include_package_data=True, - keywords="samgeo", - name="segment-geospatial", - packages=find_packages(include=["samgeo", "samgeo.*"]), - setup_requires=setup_requirements, - test_suite="tests", - tests_require=test_requirements, - url="https://github.com/opengeos/segment-geospatial", - version="0.11.0", - zip_safe=False, -)