Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pyproject.toml instead of setup.py #1100

Merged
merged 1 commit into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 14 additions & 29 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,9 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: requirements-test.txt

- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r requirements-test.txt
pip install -e ".[validation]"
run: pip install .[validation,test]

- name: Execute test suite
run: ./scripts/test
Expand All @@ -68,13 +64,9 @@ jobs:
with:
python-version: "3.8"
cache: "pip"
cache-dependency-path: requirements-test.txt

- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r requirements-test.txt
pip install -e ".[validation]"
- name: Install with dependencies
run: pip install .[validation,test]

- name: Run coverage with orjson
run: pytest tests --cov
Expand Down Expand Up @@ -123,17 +115,14 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: requirements-test.txt

- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r requirements-test.txt
- name: Install with test dependencies
run: pip install .[test]

- name: Execute linters & type checkers
run: pre-commit run --all-files

vanilla:
without-orjson:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -142,16 +131,16 @@ jobs:
with:
python-version: "3.8"

- name: Install without orjson
run: pip install '.[validation]'
- name: Install
run: pip install .[validation,test]

- name: Install test requirements
run: pip install pytest pytest-mock html5lib jinja2
- name: Uninstall orjson
run: pip uninstall -y orjson

- name: Run tests
run: pytest tests

check-dev-dependencies:
check-all-dependencies:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -160,10 +149,9 @@ jobs:
with:
python-version: "3.8"
cache: "pip"
cache-dependency-path: requirements-dev.txt

- name: Install dev dependencies
run: pip install -r requirements-dev.txt
- name: Install all dependencies
run: pip install .[bench,docs,orjson,test,urllib3,validation]

check-benchmarks:
# This checks to make sure any API changes haven't broken any of the
Expand All @@ -176,11 +164,8 @@ jobs:
with:
python-version: "3.8"
cache: "pip"
cache-dependency-path: requirements-bench.txt
- name: Install pystac
run: pip install .
- name: Install benchmark dependencies
run: pip install -r requirements-bench.txt
run: pip install .[bench]
- name: Set asv machine
run: asv machine --yes
- name: Check benchmarks
Expand Down
3 changes: 2 additions & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ formats:

python:
install:
- requirements: requirements-docs.txt
- method: pip
path: .
extra_requirements:
- docs

sphinx:
fail_on_warning: false
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- Make Catalog, Collection `.get_assets()` return a deepcopy ([#1087](https://github.com/stac-utils/pystac/pull/1087))
- Removed documentation references to `to_dict` methods returning JSON ([#1074](https://github.com/stac-utils/pystac/pull/1074))
- Expand support for previous extension schema URIs ([#1091](https://github.com/stac-utils/pystac/pull/1091))
- Use `pyproject.toml` instead of `setup.py` ([#1100](https://github.com/stac-utils/pystac/pull/1100))

### Deprecated

Expand Down
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include pystac/py.typed pystac/html/*.jinja2
exclude tests/*
gadomski marked this conversation as resolved.
Show resolved Hide resolved
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[![Gitter](https://badges.gitter.im/SpatioTemporal-Asset-Catalog/python.svg)](https://gitter.im/SpatioTemporal-Asset-Catalog/python?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

PySTAC is a library for working with [SpatioTemporal Asset Catalog](https://stacspec.org) in Python 3.
PySTAC is a library for working with the [SpatioTemporal Asset Catalog](https://stacspec.org) specification in Python 3.

## Installation

Expand All @@ -23,23 +23,23 @@ If you would like to enable the validation feature utilizing the
`validation` requirements:

```shell
pip install pystac[validation]
pip install 'pystac[validation]'
```

If you would like to use the [`orjson`](https://pypi.org/project/orjson/) instead of the
standard `json` library for JSON serialization/deserialization, install with the
optional `orjson` requirements:

```shell
pip install pystac[orjson]
pip install 'pystac[orjson]'
```

If you would like to use a custom `RetryStacIO` class for automatically retrying
network requests when reading with PySTAC, you'll need
[`urllib3`](https://urllib3.readthedocs.io/en/stable/):

```shell
pip install pystac[urllib3]
pip install 'pystac[urllib3]'
```

### Install from source
Expand Down
12 changes: 7 additions & 5 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ pip as follows:

.. code-block:: bash
$ git clone [email protected]:your_user_name/pystac.git
$ cd pystac
$ pip install -e .
git clone [email protected]:your_user_name/pystac.git
cd pystac
pip install -e '.[dev]'
Testing
^^^^^^^
Expand Down Expand Up @@ -90,11 +90,13 @@ PySTAC uses `asv <https://asv.readthedocs.io>`_ for benchmarking. Benchmarks are
defined in the ``./benchmarks`` directory. Due to the inherent uncertainty in
the environment of Github workflow runners, benchmarks are not executed in CI.
If your changes may affect performance, use the provided script to run the
benchmark suite locally. This script will compare your current ``HEAD`` with
the **main** branch and report any improvements or regressions.
benchmark suite locally. You'll need to install the benchmark dependencies
first. This script will compare your current ``HEAD`` with the **main** branch
and report any improvements or regressions.

.. code-block:: bash
pip install -e '.[bench]'
scripts/bench
The benchmark suite takes a while to run, and will report any significant
Expand Down
92 changes: 92 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
[project]
name = "pystac"
description = "Python library for working with the SpatioTemporal Asset Catalog (STAC) specification"
readme = "README.md"
authors = [
{ name = "Rob Emanuele", email = "[email protected]" },
{ name = "Jon Duckworth", email = "[email protected]" }
]
maintainers = [
{ name = "Pete Gadomski", email = "[email protected]" }
]
keywords = ["pystac", "imagery", "raster", "catalog", "STAC"]
license = { text = "Apache-2.0" }
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software 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",
]
requires-python = ">=3.8"
dependencies = [
"importlib-resources>=5.12.0; python_version<'3.9'",
"python-dateutil>=2.7.0",
]
dynamic = ["version"]

[project.optional-dependencies]
bench = [
"asv~=0.5",
"virtualenv~=20.22",
]
docs = [
"Sphinx~=5.1",
"ipython~=8.12",
"jinja2<4.0",
"jupyter~=1.0",
"nbsphinx~=0.9",
"pydata-sphinx-theme~=0.13",
"sphinx-autobuild==2021.3.14",
"sphinx-design~=0.4",
"sphinxcontrib-fulltoc~=1.2",
]
orjson = ["orjson>=3.5"]
test = [
"black~=23.3",
"codespell~=2.2",
"coverage~=7.2",
"doc8~=1.1",
"html5lib~=1.1",
"jinja2<4.0",
"jsonschema~=4.17",
"mypy~=1.2",
"orjson~=3.8",
"pre-commit~=3.2",
"pytest-cov~=4.0",
"pytest-mock~=3.10",
"pytest-vcr~=1.0",
"pytest~=7.3",
"ruff==0.0.262",
"types-html5lib~=1.1",
"types-orjson~=3.6",
"types-python-dateutil~=2.8",
"types-urllib3~=1.26",
]
urllib3 = ["urllib3>=1.26"]
validation = ["jsonschema>=4.0.1"]

[project.urls]
homepage = "https://github.com/stac-utils/pystac"
documentation = "https://pystac.readthedocs.io"
repository = "https://github.com/stac-utils/pystac.git"
changelog = "https://github.com/stac-utils/pystac/blob/main/CHANGELOG.md"
discussions = "https://github.com/radiantearth/stac-spec/discussions/categories/stac-software"

[tool.setuptools.packages.find]
include = ["pystac*"]
exclude = ["tests*", "benchmarks*"]

[tool.setuptools.dynamic]
version = { attr = "pystac.version.__version__" }

[tool.pytest]
filterwarnings = "error:::pystac[.*]"

[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
2 changes: 0 additions & 2 deletions requirements-bench.txt

This file was deleted.

5 changes: 0 additions & 5 deletions requirements-dev.txt

This file was deleted.

8 changes: 0 additions & 8 deletions requirements-docs.txt

This file was deleted.

19 changes: 0 additions & 19 deletions requirements-test.txt

This file was deleted.

6 changes: 0 additions & 6 deletions setup.cfg

This file was deleted.

58 changes: 0 additions & 58 deletions setup.py

This file was deleted.

2 changes: 1 addition & 1 deletion tests/utils/stac_io_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def write_text(
dest: Union[str, "os.PathLike[AnyStr]"],
txt: str,
*args: Any,
**kwargs: Any
**kwargs: Any,
) -> None:
self.mock.write_text(dest, txt)
self.wrapped_stac_io.write_text(dest, txt)
Expand Down