pyproject-transition #922

Merged
witten merged 7 commits from kaliko/borgmatic:pyproject-transition into main 2024-10-26 23:38:35 +00:00
3 changed files with 45 additions and 68 deletions
Showing only changes of commit 4658c5d1cb - Show all commits

View File

@ -1,3 +1,48 @@
[project]
name = "borgmatic"
version = "1.9.0.dev0"
authors = [
{ name="Dan Helfman", email="witten@torsion.org" },
]
description = "Simple, configuration-driven backup software for servers and workstations"
readme = "README.md"
requires-python = ">=3.8"
classifiers=[
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Programming Language :: Python",
"Topic :: Security :: Cryptography",
"Topic :: System :: Archiving :: Backup",
]
dependencies = [
"colorama>=0.4.1,<0.5",
"jsonschema",
"packaging",
"requests",
"ruamel.yaml>0.15.0",
]
[project.scripts]
borgmatic = "borgmatic.commands.borgmatic:main"
generate-borgmatic-config = "borgmatic.commands.generate_config:main"
validate-borgmatic-config = "borgmatic.commands.validate_config:main"
[project.optional-dependencies]
Apprise = ["apprise"]
[project.urls]
Homepage = "https://torsion.org/borgmatic"
[build-system]
requires = ["setuptools>=61.0"]
# allow looking for conf in setup.{cfg,py}
#build-backend = "setuptools.build_meta"
[tool.setuptools]
packages = ["borgmatic"]
[tool.black]
line-length = 100
skip-string-normalization = true

View File

@ -1,26 +0,0 @@
[metadata]
description_file=README.md
[tool:pytest]
testpaths = tests
addopts = --cov-report term-missing:skip-covered --cov=borgmatic --ignore=tests/end-to-end
[flake8]
max-line-length = 100
extend-ignore = E203,E501,W503
exclude = *.*/*
multiline-quotes = '''
docstring-quotes = '''
[tool:isort]
profile=black
known_first_party = borgmatic
line_length = 100
skip = .tox
[codespell]
skip = .git,.tox,build
[pycodestyle]
ignore = E203
max_line_length = 100

View File

@ -1,42 +0,0 @@
from setuptools import find_packages, setup
VERSION = '1.9.0.dev0'
setup(
name='borgmatic',
version=VERSION,
description='Simple, configuration-driven backup software for servers and workstations',
author='Dan Helfman',
author_email='witten@torsion.org',
url='https://torsion.org/borgmatic',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Programming Language :: Python',
'Topic :: Security :: Cryptography',
'Topic :: System :: Archiving :: Backup',
],
packages=find_packages(exclude=['tests*']),
witten marked this conversation as resolved Outdated

I don't know if something like this is necessary in pyproject.toml so tests don't get installed into the final package? Or is that done automatically? I didn't see tests end up in the resulting tarball, so maybe it's fine as is.

I don't know if something like this is necessary in `pyproject.toml` so tests don't get installed into the final package? Or is that done automatically? I didn't see tests end up in the resulting tarball, so maybe it's fine as is.

It's done automatically indeed.

And the resulting tar ball does not contain any test files.

But to make sure to package all modules in borgmatic package I used tool.setuptools.packages.find then I believe anything outside ./borgmatic folder in not covered anyway.

Please not that tool.setuptools.packages.find also set namespaces = false, from the doc “This will prevent any folder without an init.py file from being scanned.“ src.

It's [done automatically indeed](https://setuptools.pypa.io/en/latest/userguide/package_discovery.html#flat-layout). And the resulting tar ball does not contain any test files. But to make sure to package all modules in borgmatic package I used `tool.setuptools.packages.find` then I believe anything outside `./borgmatic` folder in not covered anyway. Please not that `tool.setuptools.packages.find` also set `namespaces = false`, from the doc “This will prevent any folder without an __init__.py file from being scanned.“ [src](https://setuptools.pypa.io/en/latest/userguide/package_discovery.html#finding-simple-packages).

That makes sense. The only thing potentially missing that I could see of being use is the sample/ directory, as I'm vaguely recalling that some Linux distribution packages of borgmatic programmatically consume those files.

That makes sense. The only thing potentially missing that I could see of being use is the `sample/` directory, as I'm vaguely recalling that some Linux distribution packages of borgmatic [programmatically consume those files](https://gitlab.archlinux.org/archlinux/packaging/packages/borgmatic/-/blob/main/PKGBUILD?ref_type=heads#L46).
Review

We discussed it already :)

These files are in the source distribution. The MANIFEST.in is declaring it and setuptools includes them by default, no need to explicitly declare

We used systemd unit file in Debian as well, but we got the source from the tagged version in github, then we get the whole source tree. I'm not familiar with PKGBUILD but I think they use the git source as well, not the pypi source distribution. Anyway thanks for shipping these, it's helpful for packaging.

We discussed it already :) [These files are in the source distribution. The MANIFEST.in is declaring it and setuptools includes them by default, no need to explicitly declare ](https://projects.torsion.org/borgmatic-collective/borgmatic/pulls/922/files#issuecomment-8753) We used systemd unit file in Debian as well, but we got the source from the tagged version in github, then we get the whole source tree. I'm not familiar with PKGBUILD but I think they use the git source as well, not the pypi source distribution. Anyway thanks for shipping these, it's helpful for packaging.
Review

Okay, just making sure since you quoted: "This will prevent any folder without an __init.py__ file from being scanned." But if the MANIFEST.in still takes care of sample/, great.

Getting the tagged version from GitHub should be fine, although note that projects.torsion.org is the canonical source for the source and GitHub is "only" a mirror.

Okay, just making sure since you quoted: "This will prevent any folder without an \_\_init.py\_\_ file from being scanned." But if the MANIFEST.in still takes care of `sample/`, great. Getting the tagged version from GitHub should be fine, although note that projects.torsion.org is the canonical source for the source and GitHub is "only" a mirror.
entry_points={
'console_scripts': [
'borgmatic = borgmatic.commands.borgmatic:main',
'generate-borgmatic-config = borgmatic.commands.generate_config:main',
'validate-borgmatic-config = borgmatic.commands.validate_config:main',
]
},
obsoletes=['atticmatic'],
witten marked this conversation as resolved Outdated

This didn't get carried forward to the pyproject.toml, but that's probably okay given how much it's ancient history.

This didn't get carried forward to the `pyproject.toml`, but that's probably okay given how much it's ancient history.

Right, it can still be ported to pyproject.toml with an extra conf :

[tool.setuptools]
obsoletes = ['atticmatic']
Right, it can still be ported to `pyproject.toml` with an extra conf : ```ini [tool.setuptools] obsoletes = ['atticmatic'] ```

I really don't feel strongly either way. Just thought I'd mention it.

I really don't feel strongly either way. Just thought I'd mention it.
install_requires=(
'colorama>=0.4.1,<0.5',
'jsonschema',
'packaging',
'requests',
'ruamel.yaml>0.15.0',
'setuptools',
),
extras_require={"Apprise": ["apprise"]},
include_package_data=True,
witten marked this conversation as resolved Outdated

Looks like the pyproject.toml equivalent of this line is missing? I think the main reason this exists is so that the configuration schema file gets installed. (It's at borgmatic/config/schema.yaml in the source.) But also the systemd and other sample files (sample/) probably get included too.

Looks like the `pyproject.toml` equivalent of this line is missing? I think the main reason this exists is so that the configuration schema file gets installed. (It's at `borgmatic/config/schema.yaml` in the source.) But also the systemd and other sample files (`sample/`) probably get included too.

These files (systemd units and schema) are declared in MANIFEST.in and by default, include-package-data is true in pyproject.toml.

I can see these files in the resulting source dist tar ball.

These files (systemd units and schema) are declared in ``MANIFEST.in`` and by default, [include-package-data is true in pyproject.toml](https://setuptools.pypa.io/en/latest/userguide/datafiles.html#configuration-options). I can see these files in the resulting source dist tar ball.

Awesome, thanks!

Awesome, thanks!
python_requires='>=3.8',
)