Skip to content

Commit

Permalink
Remote setup.py and add pyproject.toml (#317)
Browse files Browse the repository at this point in the history
  • Loading branch information
giswqs authored Sep 21, 2024
1 parent 9ba3443 commit 9ab4ed2
Show file tree
Hide file tree
Showing 11 changed files with 119 additions and 109 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
57 changes: 40 additions & 17 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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')"
3 changes: 2 additions & 1 deletion .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/*
1 change: 1 addition & 0 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 5 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions pyproject-codespell.precommit-toml

This file was deleted.

67 changes: 67 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
20 changes: 0 additions & 20 deletions setup.cfg

This file was deleted.

62 changes: 0 additions & 62 deletions setup.py

This file was deleted.

0 comments on commit 9ab4ed2

Please sign in to comment.