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

Packaging: switch to pyproject.toml #556

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"ms-python.flake8",
"ms-python.isort",
"njpwerner.autodocstring",
"redhat.vscode-yaml"
"redhat.vscode-yaml",
"tamasfe.even-better-toml"
]
}
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
],
"editor.wordWrapColumn": 88,
},
// TOML
"[toml]": {
"editor.formatOnSave": true,
},
// YAML
"[yaml]": {
"editor.autoIndent": "keep",
Expand Down
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()
Loading