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

Move project metadata to pyproject.toml; add build-backend #1165

Merged
merged 4 commits into from
Dec 8, 2022
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
2 changes: 1 addition & 1 deletion .github/workflows/ci_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,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
84 changes: 81 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,85 @@
[build-system]
requires = [
"cython>=0.29.29",
"Cython~=0.29.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.29",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason that test needs cython?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is a leftover from old versions, I think.

Copy link
Member

@sgillies sgillies Dec 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed it in 10ce6b7.

"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]
include-package-data = false
packages = ["fiona", "fiona.fio"]

[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 @@ -11,4 +11,5 @@ markers =
wheel: marks tests that only works when installed from wheel
gdal: marks tests that are only dependent on GDAL functionality (e.g. for drvsupport)

addopts = --import-mode=importlib
testpaths = tests
10 changes: 5 additions & 5 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
cython~=0.29
pytest==7.1.2
pytest-cov==3.0.0
pytz==2020.1
coverage~=6.5
cython~=0.29.29
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
111 changes: 16 additions & 95 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,76 +192,21 @@ 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'])
# Include these files for binary wheels
fiona_package_data = ['gdal.pxi', '*.pxd']

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

setup(**setup_args)
fiona_package_data.extend([
'gdal_data/*',
'proj_data/*',
'.libs/*',
'.libs/licenses/*',
])


# See pyproject.toml for project metadata
setup(
name="Fiona", # need by GitHub dependency graph
package_data={"fiona": fiona_package_data},
ext_modules=ext_modules,
)