Skip to content

Commit 1fdd533

Browse files
committed
modernize with pyproject, use scm for version
replace use of python 3.7 with more recent versions
1 parent 921a2ba commit 1fdd533

11 files changed

+95
-99
lines changed

.github/workflows/autopublish-testpypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Set up Python
1717
uses: actions/setup-python@v3
1818
with:
19-
python-version: 3.7
19+
python-version: 3.12
2020

2121
- name: Pip cache
2222
uses: actions/cache@v2

.github/workflows/publish-pypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Set up Python
1515
uses: actions/setup-python@v3
1616
with:
17-
python-version: 3.7
17+
python-version: 3.12
1818

1919
- name: Pip cache
2020
uses: actions/cache@v2

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
workflow_dispatch:
55
inputs:
66
prerelease:
7-
description: 'Is this a pre-release?'
7+
description: 'Is this a pre-release?'
88
required: true
99
type: boolean
1010

@@ -17,7 +17,7 @@ jobs:
1717
- uses: actions/checkout@v3
1818
- uses: actions/setup-python@v3
1919
with:
20-
python-version: "3.10"
20+
python-version: "3.12"
2121

2222
- name: Create GitHub Release
2323
uses: actions/create-release@v1

.github/workflows/test.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Set up Python
1313
uses: actions/setup-python@v4
1414
with:
15-
python-version: 3.8
15+
python-version: 3.12
1616
- name: Pip cache
1717
uses: actions/cache@v2
1818
with:
@@ -26,15 +26,15 @@ jobs:
2626
nox -s lint
2727
2828
analyze:
29-
name: Analyze Typing
29+
name: Analyze Typing
3030
runs-on: ubuntu-latest
3131
steps:
3232
- name: Checkout code
3333
uses: actions/checkout@v3
3434
- name: Set up Python
3535
uses: actions/setup-python@v4
3636
with:
37-
python-version: 3.8
37+
python-version: 3.12
3838
- name: Pip cache
3939
uses: actions/cache@v2
4040
with:
@@ -53,7 +53,7 @@ jobs:
5353

5454
strategy:
5555
matrix:
56-
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
56+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
5757

5858
steps:
5959
- name: Checkout code
@@ -84,7 +84,7 @@ jobs:
8484
- name: Set up Python
8585
uses: actions/setup-python@v4
8686
with:
87-
python-version: 3.8
87+
python-version: 3.12
8888
- name: Pip cache
8989
uses: actions/cache@v2
9090
with:
@@ -106,7 +106,7 @@ jobs:
106106
- name: Set up Python
107107
uses: actions/setup-python@v4
108108
with:
109-
python-version: 3.8
109+
python-version: 3.12
110110
- name: Pip cache
111111
uses: actions/cache@v2
112112
with:
@@ -118,5 +118,3 @@ jobs:
118118
run: |
119119
pip install --upgrade nox
120120
nox -s docs
121-
122-

CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,24 +174,24 @@ run the tests on a certain file, use:
174174
By default, Nox runs tests on all supported Python versions along with other
175175
CI checks. However, Nox can run a test on a single Python version.
176176

177-
To run tests on python 3.7:
177+
To run tests on python 3.13:
178178

179179
```console
180-
$ nox -s test-3.7
180+
$ nox -s test-3.13
181181
```
182182

183183
Configuration can be passed onto pytest through Nox.
184184

185185
To only run tests in a specific file:
186186

187187
```console
188-
$ nox -s test3.7 -- tests/unit/test_http.py
188+
$ nox -s test3.13 -- tests/unit/test_http.py
189189
```
190190

191191
Or to only run tests filtered by keyword:
192192

193193
```console
194-
$ nox -s test3.7 -- -k test__Limiter
194+
$ nox -s test3.13 -- -k test__Limiter
195195
```
196196

197197
## Code coverage

docs/get-started/quick-start-guide.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ Take the following steps to install the SDK and connect with the Planet Server.
1111

1212
[TOC]
1313

14-
## Step 1: Install Python 3.7+ and a virtual environment
14+
## Step 1: Install Python 3.8+ and a virtual environment
1515

16-
This is a Python package, so you’ll need to install Python (version 3.7 or greater), and set up and install a virtual environment.
16+
This is a Python package, so you’ll need to install Python (version 3.8 or greater), and set up and install a virtual environment.
1717

1818
Yes. Even if you’re not writing code—and only using the "no code" CLI part of the Planet SDK for Python—you’re using Python to communicate with the Planet Labs PBC servers. If you need help with Python install and setting up a virtual environment, read [Virtual Environments and the Planet SDK for Python](venv-tutorial.md).
1919

noxfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def coverage(session):
3737
session.run('coverage', 'report')
3838

3939

40-
@nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"])
40+
@nox.session(python=["3.9", "3.10", "3.11", "3.12", "3.13"])
4141
def test(session):
4242
session.run('python', '-m', 'ensurepip', '--upgrade')
4343
session.install('-U', 'setuptools')

planet/__version__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
__version__ = '2.11.0'
1+
from importlib.metadata import version
2+
3+
__version__ = version("planet")

pyproject.toml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
[build-system]
2+
requires = ["setuptools>=64", "setuptools_scm>=8"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "planet"
7+
authors = [ {name = "Planet", email = "python-sdk-contributors@planet.com"} ]
8+
description = "Planet SDK for Python"
9+
dependencies = [
10+
"click>=8.0",
11+
"geojson",
12+
"httpx>=0.23.0",
13+
"jsonschema",
14+
"pyjwt>=2.1",
15+
"tqdm>=4.56",
16+
"typing-extensions",
17+
]
18+
readme = "README.md"
19+
requires-python = ">=3.9"
20+
keywords = ["planet", "api", "sdk", "client"]
21+
classifiers = [
22+
"Development Status :: 5 - Production/Stable",
23+
"Environment :: Console",
24+
"Intended Audience :: Developers",
25+
"License :: OSI Approved :: Apache Software License",
26+
"Operating System :: OS Independent",
27+
"Programming Language :: Python :: 3",
28+
"Topic :: Scientific/Engineering",
29+
"Topic :: Software Development",
30+
"Topic :: Utilities",
31+
]
32+
license = {file = "LICENSE"}
33+
dynamic = ["version"]
34+
35+
[project.optional-dependencies]
36+
test = [
37+
"pytest",
38+
"anyio",
39+
"pytest-cov",
40+
"respx>=0.20",
41+
]
42+
lint = [
43+
"flake8",
44+
"mypy",
45+
"yapf",
46+
]
47+
docs = [
48+
"mkdocs==1.3",
49+
"mkdocs-click==0.7.0",
50+
"mkdocs-material==8.2.11",
51+
"mkdocstrings==0.18.1",
52+
"mkdocs_autorefs==1.0.1",
53+
]
54+
dev = [
55+
"planet[test, docs, lint]",
56+
]
57+
58+
[project.scripts]
59+
planet = "planet.cli.cli:main"
60+
61+
[project.urls]
62+
Repository = "https://github.com/planetlabs/planet-client-python"
63+
64+
[tool.setuptools_scm]

setup.cfg

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1-
[metadata]
2-
license_file: LICENSE
1+
[options]
2+
packages = planet, planet.cli, planet.clients, planet.data
3+
4+
[options.packages.find]
5+
exclude = examples, tests
6+
7+
; [options.package_data]
8+
; planet = data/*
39

410
[tool:pytest]
511
addopts =
612
-rxXs
713

814
[coverage:run]
9-
source = planet,tests
15+
source = planet, tests
1016
branch = True
1117

1218
[coverage:report]

setup.py

Lines changed: 2 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -12,80 +12,6 @@
1212
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
15-
from pathlib import Path
16-
from setuptools import setup, find_packages
15+
from setuptools import setup
1716

18-
with open('planet/__version__.py') as f:
19-
for line in f:
20-
if line.find("__version__") >= 0:
21-
version = line.split("=")[1].strip()
22-
version = version.strip('"')
23-
version = version.strip("'")
24-
continue
25-
26-
install_requires = [
27-
'click>=8.0',
28-
'geojson',
29-
'httpx>=0.23.0',
30-
'jsonschema',
31-
'pyjwt>=2.1',
32-
'tqdm>=4.56',
33-
'typing-extensions',
34-
]
35-
36-
test_requires = ['pytest', 'anyio', 'pytest-cov', 'respx>=0.20']
37-
38-
lint_requires = ['flake8', 'mypy', 'yapf']
39-
40-
doc_requires = [
41-
'mkdocs==1.3',
42-
'mkdocs-click==0.7.0',
43-
'mkdocs-material==8.2.11',
44-
'mkdocstrings==0.18.1',
45-
'mkdocs_autorefs==1.0.1',
46-
]
47-
48-
setup(
49-
name='planet',
50-
version=version,
51-
description=u"Planet SDK for Python",
52-
long_description=Path("README.md").read_text("utf-8"),
53-
long_description_content_type="text/markdown",
54-
classifiers=[
55-
'Development Status :: 5 - Production/Stable',
56-
'Environment :: Console',
57-
'Intended Audience :: Developers',
58-
'License :: OSI Approved :: Apache Software License',
59-
'Operating System :: OS Independent',
60-
'Programming Language :: Python :: 3',
61-
'Topic :: Scientific/Engineering',
62-
'Topic :: Software Development',
63-
'Topic :: Utilities'
64-
],
65-
keywords='planet api sdk client',
66-
author='Planet',
67-
maintainer='Planet',
68-
maintainer_email='python-sdk-contributors@planet.com',
69-
url='https://github.com/planetlabs/planet-client-python',
70-
license='Apache 2.0',
71-
packages=find_packages(exclude=['examples', 'tests']),
72-
package_data={
73-
"": ["LICENSE", "CONTRIBUTING.md"],
74-
"planet": ["data/*"],
75-
},
76-
include_package_data=True,
77-
zip_safe=False,
78-
python_requires='>=3.7',
79-
install_requires=install_requires,
80-
extras_require={
81-
'test': test_requires,
82-
'lint': lint_requires,
83-
'docs': doc_requires,
84-
'dev': test_requires + lint_requires + doc_requires
85-
},
86-
entry_points={
87-
'console_scripts': [
88-
'planet=planet.cli.cli:main',
89-
],
90-
},
91-
)
17+
setup()

0 commit comments

Comments
 (0)