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

Add pyproject.toml file #420

Merged
merged 13 commits into from
Sep 19, 2022
8 changes: 4 additions & 4 deletions .github/workflows/release_to_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:
with:
python-version: "3.x"

- name: Build a binary wheel and a source tarball
- name: Build source and wheel distributions
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
python setup.py sdist bdist_wheel
python -m pip install --upgrade build twine
python -m build
twine check --strict dist/*

- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down
79 changes: 79 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
[build-system]
requires = [
"setuptools>=61.0.0",
"versioneer[toml]==0.26",
"isort",
"black"
]
build-backend = "setuptools.build_meta"

[project]
name = "momepy"
dynamic = ["version"]
authors = [
{name = "Martin Fleischmann", email = "martin@martinfleischmann.net"},
]
maintainers = [
{name = "momepy contributors"},
]
license = {text = "BSD 3-Clause"}
description = "Urban Morphology Measuring Toolkit"
keywords = ["urban morphology", "urban morphometrics", "tessellation"]
readme = {text = """\
Momepy (*Mo*rphological *Me*asuring in *Py*thon) is a library for
quantitative analysis of urban form - urban morphometrics. It is
part of `PySAL`_ (Python Spatial Analysis Library) and is built on top
of `GeoPandas`_, other PySAL modules, and
`networkX`_.

.. _PySAL: http://pysal.org
.. _GeoPandas: http://geopandas.org
.. _networkX : http://networkx.github.io
""", content-type = "text/x-rst"}
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering :: GIS",
]
requires-python = ">=3.8"
dependencies = [
"geopandas>=0.8.0",
"networkx>=2.3",
"libpysal>=4.2.0",
"tqdm>=4.27.0",
"pygeos",
"packaging",
]

[project.urls]
Home = "http://momepy.org"
Repository = "https://github.com/pysal/momepy"

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

[tool.setuptools.package-data]
momepy = [
"datasets/bubenec.gpkg",
"datasets/tests.gpkg",
]

[tool.versioneer]
VCS = "git"
style = "pep440"
versionfile_source = "momepy/_version.py"
versionfile_build = "momepy/_version.py"
tag_prefix = "v"
parentdir_prefix = "momepy-"

[tool.isort]
profile = "black"
src_paths = ["momepy", "tests", "benchmarks"]

[tool.black]
line-length = 88
10 changes: 5 additions & 5 deletions readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ sphinx:
configuration: docs/conf.py

python:
version: 3
install:
- requirements: docs/requirements.txt
- method: pip
path: .
version: 3.8
install:
- requirements: docs/requirements.txt
- method: pip
path: .
12 changes: 0 additions & 12 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
[versioneer]
VCS = git
style = pep440
versionfile_source = momepy/_version.py
versionfile_build = momepy/_version.py
tag_prefix = v
parentdir_prefix = momepy-

[isort]
profile = black
src_paths = momepy, tests, benchmarks

[flake8]
# Black enforces 88 characters line length
max_line_length = 88
Expand Down
50 changes: 7 additions & 43 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,53 +1,17 @@
#!/usr/bin/env/python
import os
import sys

import versioneer
from setuptools import setup

try:
from setuptools import setup
except ImportError:
from distutils.core import setup

# get all data dirs in the datasets module
data_files = []

for item in os.listdir("momepy/datasets"):
if not item.startswith("__"):
if os.path.isdir(os.path.join("momepy/datasets/", item)):
data_files.append(os.path.join("datasets", item, "*"))
elif item.endswith(".gpkg"):
data_files.append(os.path.join("datasets", item))

with open("README.md", "r", encoding="utf8") as fh:
long_description = fh.read()
# ensure the current directory is on sys.path so versioneer can be imported
# when pip uses PEP 517/518 build rules.
# https://github.com/python-versioneer/python-versioneer/issues/193
sys.path.append(os.path.dirname(__file__))

# see pyproject.toml for static project metadata
setup(
name="momepy",
version=versioneer.get_version(),
description="Urban Morphology Measuring Toolkit",
long_description=long_description,
long_description_content_type="text/markdown",
license="BSD",
author="Martin Fleischmann",
author_email="martin@martinfleischmann.net",
keywords=["urban morphology", "urban morphometrics", "tessellation"],
url="http://momepy.org",
packages=["momepy", "momepy.datasets"],
package_data={"momepy": data_files},
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering :: GIS",
],
install_requires=[
"geopandas>=0.8.0",
"networkx>=2.3",
"libpysal>=4.2.0",
"tqdm>=4.27.0",
"pygeos",
"packaging",
],
cmdclass=versioneer.get_cmdclass(),
)