Skip to content

Commit

Permalink
change(packaging): use pyproject.toml instead of setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Guts committed Sep 5, 2024
1 parent 9a8ac24 commit 5e5d264
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 112 deletions.
99 changes: 99 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
[build-system]
requires = ["setuptools >= 64"]
build-backend = "setuptools.build_meta"

[project]
name = "qgis-deployment-toolbelt"
description = """QGIS deployment toolbelt is a CLI (Command Line Interface)
to perform redundant operations after a QGIS deployment,
managing QGIS profiles, plugins, environment variables,
start menu / desktop shortcuts and many things to rationalize
your QGIS installations."""
dynamic = ["version"]
readme = "README.md"
license = { text = "Apache-2.0" }
requires-python = ">=3.10,<4"
authors = [
{ name = "Julien Moura (Oslandia)", email = "qgis+qdt@oslandia.com" },
{ name = "Jean-Marie Kerloch (Oslandia)", email = "qgis+qdt@oslandia.com" },
{ name = "Vincent Bré (Oslandia)", email = "qgis+qdt@oslandia.com" },
]
maintainers = [
{ name = "Julien Moura (Oslandia)", email = "qgis+qdt@oslandia.com" },
]
keywords = ["GIS", "QGIS", "cli", "deployment", "profiles", "qdt"]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Information Technology",
"License :: OSI Approved :: Apache Software License",
"Operating System :: Microsoft :: Windows :: Windows 10",
"Operating System :: Microsoft :: Windows :: Windows 11",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering :: GIS",
"Topic :: System :: Installation/Setup",
]
dependencies = [
"distro==1.9.* ; sys_platform == 'linux'",
"dulwich>=0.22,<0.22.2",
"giturlparse>=0.12,<0.13",
"imagesize>=1.4,<1.5",
"packaging>=22,<25",
"python-rule-engine>=0.5,<0.6",
"python-win-ad>=0.6.2,<1 ; sys_platform == 'win32'",
"pywin32==306 ; sys_platform == 'win32'",
"pyyaml>=5.4,<7",
"requests>=2.31,<3",
"truststore>=0.8,<1",
]

[project.optional-dependencies]
dev = [
"black",
"flake8-bugbear>=23.1,<24.9",
"flake8-builtins>=2.1,<3",
"flake8-eradicate>=1.0,<2",
"flake8-isort>=5,<6.2",
"flake8>=7.1",
"pre-commit>=3.5,<3.9",
]
doc = [
"furo==2024.*",
"matplotlib>=3.8.2,<4",
"myst-parser[linkify]>=2",
"sphinx-argparse-cli>=1,<2",
"sphinx-autobuild==2024.*",
"sphinx-copybutton<1",
"sphinx-design>=0.5,<1",
"sphinx-sitemap>=2.4,<3",
"sphinxcontrib-mermaid>=0.9,<1",
"sphinxext-opengraph>=0.4,<1",
]
test = [
"GitPython>=3.1,<3.2",
"Pillow>=10.4.0,<10.5",
"pytest-cov>=4,<5.1",
"validators>=0.29.0,<0.34",
]

[project.scripts]
qdt = "qgis_deployment_toolbelt.cli:main"

[project.entry-points]

[project.urls]
Homepage = "https://guts.github.io/qgis-deployment-cli/"
Documentation = "https://guts.github.io/qgis-deployment-cli/"
Repository = "https://github.com/Guts/qgis-deployment-cli.git"
Issues = "https://github.com/Guts/qgis-deployment-cli/issues"
Changelog = "https://github.com/Guts/qgis-deployment-cli/blob/main/CHANGELOG.md"

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

[tool.setuptools.packages.find]
where = ["qgis_deployment_toolbelt"]
namespaces = false
8 changes: 5 additions & 3 deletions qgis_deployment_toolbelt/__about__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
__keywords__ = ["cli", "deployment", "profiles", "qdt", "QGIS"]
__license__ = "Apache-2.0"
__summary__ = (
"QGIS deployment toolbelt is a CLI (Command Line Interface) to perform "
"redundant operations after a QGIS deployment."
"QGIS deployment toolbelt is a CLI (Command Line Interface) "
"to perform redundant operations after a QGIS deployment, "
"managing QGIS profiles, plugins, environment variables, "
"start menu / desktop shortcuts and many things to rationalize your QGIS installations."
)
__title__ = "QGIS Deployment Toolbelt"
__title_clean__ = "".join(e for e in __title__ if e.isalnum())
Expand All @@ -36,7 +38,7 @@
__uri_tracker__ = f"{__uri_repository__}issues/"
__uri__ = __uri_repository__

__version__ = "0.35.2"
__version__ = "0.36.0"
__version_info__ = tuple(
[
int(num) if num.isdigit() else num
Expand Down
111 changes: 2 additions & 109 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,110 +1,3 @@
#! python3 # noqa: E265
from setuptools import setup

"""Setup script to package into a Python module."""

# ############################################################################
# ########## Libraries #############
# ##################################

# standard library
from pathlib import Path

# 3rd party
from setuptools import find_packages, setup

# package (to get version)
from qgis_deployment_toolbelt import __about__

# ############################################################################
# ########### Globals ##############
# ##################################

# The directory containing this file
HERE = Path(__file__).parent

# The text of the README file
README = (HERE / "README.md").read_text()

# ############################################################################
# ########### Functions ############
# ##################################


def load_requirements(requirements_files: Path | list[Path]) -> list:
"""Helper to load requirements list from a path or a list of paths.
Args:
requirements_files (Path | list[Path]): path or list to paths of requirements
file(s)
Returns:
list: list of requirements loaded from file(s)
"""
out_requirements = []

if isinstance(requirements_files, Path):
requirements_files = [
requirements_files,
]

for requirements_file in requirements_files:
with requirements_file.open(encoding="UTF-8") as f:
out_requirements += [
line
for line in f.read().splitlines()
if not line.startswith(("#", "-")) and len(line)
]

return out_requirements


# ############################################################################
# ########### Main #################
# ##################################

setup(
name=__about__.__package_name__,
author=__about__.__author__,
author_email=__about__.__email__,
description=__about__.__summary__,
long_description=README,
long_description_content_type="text/markdown",
keywords=__about__.__keywords__,
url=__about__.__uri__,
version=__about__.__version__,
classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Information Technology",
"License :: OSI Approved :: Apache Software License",
"Operating System :: Microsoft :: Windows :: Windows 10",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Operating System :: OS Independent",
"Topic :: Scientific/Engineering :: GIS",
"Topic :: System :: Installation/Setup",
],
# packaging
python_requires=">=3.10,<4",
py_modules=["qgis_deployment_toolbelt"],
packages=find_packages(
exclude=["contrib", "docs", "*.tests", "*.tests.*", "tests.*", "tests", ".venv"]
),
include_package_data=True,
install_requires=load_requirements(HERE / "requirements/base.txt"),
extras_require={
# tooling
"dev": load_requirements(HERE / "requirements/development.txt"),
"doc": load_requirements(HERE / "requirements/documentation.txt"),
"test": load_requirements(HERE / "requirements/testing.txt"),
},
entry_points={
"console_scripts": [
f"{__about__.__executable_name__}=qgis_deployment_toolbelt.cli:main",
"qdeploy-toolbelt=qgis_deployment_toolbelt.cli:main",
"qdt=qgis_deployment_toolbelt.cli:main",
]
},
)
setup()

0 comments on commit 5e5d264

Please sign in to comment.