Skip to content

Commit

Permalink
Move project metadata to pyproject.toml; add build-backend
Browse files Browse the repository at this point in the history
  • Loading branch information
mwtoews committed Nov 24, 2022
1 parent b0f10b9 commit 3b23383
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 102 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ jobs:
continue-on-error: ${{ matrix.allow_failure == 'true' }}
run: |
if [ "$GDALVERSION" = "master" ]; then echo "Using gdal master"; elif [ $($GDALINST/gdal-$GDALVERSION/bin/gdal-config --version) == $(sed 's/[a-zA-Z].*//g' <<< $GDALVERSION) ]; then echo "Using gdal $GDALVERSION"; else echo "NOT using gdal $GDALVERSION as expected; aborting"; exit 1; fi
GDAL_CONFIG=$GDALINST/gdal-$GDALVERSION/bin/gdal-config python -m pip install --no-deps --force-reinstall --no-use-pep517 -e .
GDAL_CONFIG=$GDALINST/gdal-$GDALVERSION/bin/gdal-config python -m pip install --no-deps -v -e .
- name: Print Environment
continue-on-error: ${{ matrix.allow_failure == 'true' }}
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ recursive-include tests *.py
recursive-include tests/data *
recursive-include fiona *.pyx *.pxd *.pxi
recursive-exclude fiona *.c *.cpp
include CHANGES.txt CITATION.txt CREDITS.txt LICENSE.txt VERSION.txt README.rst
include CHANGES.txt CITATION.txt CREDITS.txt LICENSE.txt README.rst
include benchmark.py pyproject.toml setup.py requirements.txt
83 changes: 80 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,84 @@
[build-system]
requires = [
"cython>=0.29.29",
"Cython~=0.29",
"oldest-supported-numpy",
"setuptools",
"wheel",
"setuptools>=61",
]
build-backend = "setuptools.build_meta"

[project]
name = "Fiona"
dynamic = ["readme", "version"]
authors = [
{name = "Sean Gillies"},
]
maintainers = [
{name = "Fiona contributors"},
]
description = "Fiona reads and writes spatial data files"
keywords = ["gis", "vector", "feature", "data"]
license = {text = "BSD 3-Clause"}
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Scientific/Engineering :: GIS",
]

requires-python = ">=3.7"
dependencies = [
"attrs>=19.2.0",
"certifi",
"click~=8.0",
"click-plugins>=1.0",
"cligj>=0.5",
"munch>=2.3.2",
]

[project.optional-dependencies]
all = ["Fiona[calc,s3,test]"]
calc = ["shapely"]
s3 = ["boto3>=1.3.1"]
test = [
"Cython~=0.29",
"Fiona[s3]",
"pytest>=7",
"pytest-cov",
"pytz",
]

[project.scripts]
fio = "fiona.fio.main:main_group"

[project.entry-points."fiona.fio_commands"]
bounds = "fiona.fio.bounds:bounds"
calc = "fiona.fio.calc:calc"
cat = "fiona.fio.cat:cat"
collect = "fiona.fio.collect:collect"
distrib = "fiona.fio.distrib:distrib"
dump = "fiona.fio.dump:dump"
env = "fiona.fio.env:env"
filter = "fiona.fio.filter:filter"
info = "fiona.fio.info:info"
insp = "fiona.fio.insp:insp"
load = "fiona.fio.load:load"
ls = "fiona.fio.ls:ls"
rm = "fiona.fio.rm:rm"

[project.urls]
Documentation = "https://fiona.readthedocs.io/"
Repository = "https://github.com/Toblerity/Fiona"

[tool.setuptools.packages.find]
include = ["fiona", "fiona.*"]

[tool.setuptools.dynamic]
version = {attr = "fiona.__version__"}
readme = {file = ["README.rst", "CHANGES.txt", "CREDITS.txt"]}
1 change: 1 addition & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ markers =
network: marks tests that require a network connection
wheel: marks test that only works when installed from wheel

addopts = --import-mode=importlib
testpaths = tests
8 changes: 4 additions & 4 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
-r requirements.txt
boto3>=1.3.1
coverage==5.2.1
coverage~=6.5
cython~=0.29
pytest==6.2.5
pytest-cov==2.12.1
pytz==2020.1
pytest~=7.2
pytest-cov~=4.0
pytz==2022.6
wheel
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ click~=8.0
click-plugins
cligj>=0.5.0
munch>=2.3.2
setuptools>=49.0
setuptools>=61.0
certifi
94 changes: 2 additions & 92 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from distutils.command.sdist import sdist
from distutils import log
import itertools as it
import os
import shutil
import subprocess
Expand All @@ -27,28 +25,6 @@ def copy_data_tree(datadir, destdir):
shutil.copytree(datadir, destdir)


# Parse the version from the fiona module.
with open('fiona/__init__.py', 'r') as f:
for line in f:
if line.find("__version__") >= 0:
version = line.split("=")[1].strip().strip('"').strip("'")
break

# Fiona's auxiliary files are UTF-8 encoded
open_kwds = {'encoding': 'utf-8'}

with open('VERSION.txt', 'w', **open_kwds) as f:
f.write(version)

with open('README.rst', **open_kwds) as f:
readme = f.read()

with open('CREDITS.txt', **open_kwds) as f:
credits = f.read()

with open('CHANGES.txt', **open_kwds) as f:
changes = f.read()

# Building Fiona requires options that can be obtained from GDAL's gdal-config
# program or can be specified using setup arguments. The latter override the
# former.
Expand Down Expand Up @@ -216,74 +192,8 @@ def copy_data_tree(datadir, destdir):
compile_time_env=compile_time_env,
)

requirements = [
'attrs>=17',
'certifi',
'click>=4.0',
'cligj>=0.5',
'click-plugins>=1.0',
'munch',
]

extras_require = {
'calc': ['shapely'],
's3': ['boto3>=1.2.4'],
'test': ['pytest>=3', 'pytest-cov', 'boto3>=1.2.4']
}

extras_require['all'] = list(set(it.chain(*extras_require.values())))


setup_args = dict(
metadata_version='1.2',
name='Fiona',
version=version,
python_requires='>=3.7',
requires_external='GDAL (>=3.1)',
description="Fiona reads and writes spatial data files",
license='BSD',
keywords='gis vector feature data',
author='Sean Gillies',
author_email='sean.gillies@gmail.com',
maintainer='Sean Gillies',
maintainer_email='sean.gillies@gmail.com',
url='https://github.com/Toblerity/Fiona',
long_description=readme + "\n" + changes + "\n" + credits,
package_dir={'': '.'},
packages=['fiona', 'fiona.fio'],
entry_points='''
[console_scripts]
fio=fiona.fio.main:main_group
[fiona.fio_commands]
bounds=fiona.fio.bounds:bounds
calc=fiona.fio.calc:calc
cat=fiona.fio.cat:cat
collect=fiona.fio.collect:collect
distrib=fiona.fio.distrib:distrib
dump=fiona.fio.dump:dump
env=fiona.fio.env:env
filter=fiona.fio.filter:filter
info=fiona.fio.info:info
insp=fiona.fio.insp:insp
load=fiona.fio.load:load
ls=fiona.fio.ls:ls
rm=fiona.fio.rm:rm
''',
install_requires=requirements,
extras_require=extras_require,
ext_modules=ext_modules,
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Topic :: Scientific/Engineering :: GIS'])
# See pyproject.toml for project metadata
setup_args = dict(ext_modules=ext_modules)

if os.environ.get('PACKAGE_DATA'):
setup_args['package_data'] = {'fiona': ['gdal_data/*', 'proj_data/*', '.libs/*', '.libs/licenses/*']}
Expand Down

0 comments on commit 3b23383

Please sign in to comment.