Skip to content

Commit 9ab4ed2

Browse files
authored
Remote setup.py and add pyproject.toml (#317)
1 parent 9ba3443 commit 9ab4ed2

11 files changed

+119
-109
lines changed

.github/workflows/docs-build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
fetch-depth: 0
1313
- uses: actions/setup-python@v5
1414
with:
15-
python-version: "3.11"
15+
python-version: "3.12"
1616
- name: Install GDAL
1717
run: |
1818
python -m pip install --upgrade pip

.github/workflows/docs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
- uses: actions/checkout@v4
1111
- uses: actions/setup-python@v5
1212
with:
13-
python-version: "3.11"
13+
python-version: "3.12"
1414
- name: Install dependencies
1515
run: |
1616
python -m pip install --upgrade pip

.github/workflows/macos.yml

+40-17
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,51 @@ jobs:
1515
fail-fast: false
1616
matrix:
1717
config:
18-
- { os: macOS-latest, py: "3.11" }
18+
- { os: macOS-latest, py: "3.12" }
19+
defaults:
20+
run:
21+
shell: bash -el {0}
1922
env:
2023
SDKROOT: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
2124
steps:
22-
- name: CHECKOUT CODE
23-
uses: actions/checkout@v4
24-
- name: SETUP PYTHON
25-
uses: actions/setup-python@v5
25+
- uses: actions/checkout@v4
26+
27+
- name: Setup Python
28+
uses: conda-incubator/setup-miniconda@v3
2629
with:
30+
auto-activate-base: true
2731
python-version: ${{ matrix.config.py }}
28-
# - name: Install GDAL
29-
# run: |
30-
# python -m pip install --upgrade pip
31-
# pip install --no-cache-dir Cython
32-
# pip install --find-links=https://girder.github.io/large_image_wheels --no-cache GDAL
33-
# - name: Test GDAL installation
34-
# run: |
35-
# python -c "from osgeo import gdal"
36-
# gdalinfo --version
32+
channels: conda-forge,defaults
33+
channel-priority: true
34+
miniconda-version: latest
35+
36+
- name: Cache dependencies
37+
uses: actions/cache@v4
38+
with:
39+
path: ~/.cache/pip
40+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
41+
restore-keys: |
42+
${{ runner.os }}-pip-
43+
44+
- name: Testing conda
45+
run: |
46+
conda info
47+
conda list
48+
49+
- name: Install GDAL
50+
run: |
51+
conda install -c conda-forge mamba --yes
52+
mamba install -c conda-forge gdal pyproj --yes
53+
54+
- name: Test GDAL installation
55+
run: |
56+
python -c "from osgeo import gdal"
57+
gdalinfo --version
58+
3759
- name: Install dependencies
3860
run: |
39-
python -m pip install --upgrade pip
40-
pip install --no-cache-dir Cython
41-
pip install codespell -r requirements.txt
61+
pip install -r requirements.txt
4262
pip install .
63+
64+
- name: Test import
65+
run: python -c "import samgeo; print('samgeo import successful')"

.github/workflows/pypi.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@ jobs:
2626
TWINE_USERNAME: ${{ secrets.PYPI_USERS }}
2727
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
2828
run: |
29-
python setup.py sdist bdist_wheel
29+
pip install build
30+
python -m build
3031
twine upload dist/*

.github/workflows/ubuntu.yml

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
config:
1818
- { os: ubuntu-latest, py: "3.10" }
1919
- { os: ubuntu-latest, py: "3.11" }
20+
- { os: ubuntu-latest, py: "3.12" }
2021

2122
env:
2223
SDKROOT: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk

.github/workflows/windows.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ jobs:
1616
uses: conda-incubator/setup-miniconda@v3
1717
with:
1818
auto-activate-base: true
19-
python-version: "3.10"
19+
python-version: "3.12"
2020
- name: Install GDAL
21-
run: conda install -c conda-forge gdal=3.4.0 --yes
21+
run: conda install -c conda-forge gdal --yes
2222
- name: Test GDAL installation
2323
run: |
2424
python -c "from osgeo import gdal"

.pre-commit-config.yaml

+5-2
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,16 @@ repos:
1515
rev: 24.8.0
1616
hooks:
1717
- id: black-jupyter
18-
language_version: python3.11
1918

2019
- repo: https://github.com/codespell-project/codespell
2120
rev: v2.3.0
2221
hooks:
2322
- id: codespell
24-
args: [--toml, pyproject-codespell.precommit-toml]
23+
args:
24+
[
25+
"--ignore-words-list=aci,acount,acounts,fallow,ges,hart,hist,nd,ned,ois,wqs,watermask,tre,pres",
26+
"--skip=*.csv,*.geojson,*.json,*.yml*.js,*.html,*cff,*.pdf",
27+
]
2528

2629
- repo: https://github.com/kynan/nbstripout
2730
rev: 0.7.1

pyproject-codespell.precommit-toml

-3
This file was deleted.

pyproject.toml

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
[build-system]
2+
requires = ["setuptools>=64", "setuptools_scm>=8"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "segment-geospatial"
7+
version = "0.11.0"
8+
dynamic = [
9+
"dependencies",
10+
]
11+
description = "Meta AI' Segment Anything Model (SAM) for Geospatial Data."
12+
readme = "README.md"
13+
requires-python = ">=3.10"
14+
license = {text = "MIT license"}
15+
keywords = ["samgeo"]
16+
classifiers = [
17+
"Development Status :: 2 - Pre-Alpha",
18+
"Intended Audience :: Developers",
19+
"License :: OSI Approved :: MIT License",
20+
"Natural Language :: English",
21+
"Programming Language :: Python :: 3",
22+
"Programming Language :: Python :: 3.10",
23+
"Programming Language :: Python :: 3.11",
24+
"Programming Language :: Python :: 3.12",
25+
]
26+
authors = [{name = "Qiusheng Wu", email = "[email protected]"}]
27+
28+
[project.optional-dependencies]
29+
all = ["groundingdino-py"]
30+
31+
[tool]
32+
[tool.setuptools.packages.find]
33+
include = ["samgeo*"]
34+
exclude = ["docs*"]
35+
36+
37+
[tool.setuptools.dynamic]
38+
dependencies = {file = ["requirements.txt"]}
39+
40+
[tool.distutils.bdist_wheel]
41+
universal = true
42+
43+
[tool.bumpversion]
44+
current_version = "0.11.0"
45+
commit = true
46+
tag = true
47+
48+
[[tool.bumpversion.files]]
49+
filename = "pyproject.toml"
50+
search = 'version = "{current_version}"'
51+
replace = 'version = "{new_version}"'
52+
53+
[[tool.bumpversion.files]]
54+
filename = "leafmap/__init__.py"
55+
search = '__version__ = "{current_version}"'
56+
replace = '__version__ = "{new_version}"'
57+
58+
[tool.flake8]
59+
exclude = [
60+
"docs",
61+
]
62+
max-line-length = 88
63+
64+
[tool.setuptools_scm]
65+
66+
[project.urls]
67+
Homepage = "https://github.com/opengeos/segment-geospatial"

setup.cfg

-20
This file was deleted.

setup.py

-62
This file was deleted.

0 commit comments

Comments
 (0)