Skip to content

Commit

Permalink
Switch to modern way of Python packaging
Browse files Browse the repository at this point in the history
Fix #27.
  • Loading branch information
Roman Inflianskas committed Jan 26, 2023
1 parent 1472def commit 9391206
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 121 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v2
Expand All @@ -27,8 +27,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements.dev.txt
pip install -e .[dev]
- id: validate-style
run: make validate-style
Expand Down
21 changes: 0 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
short_ver = 0.0.1
long_ver = $(shell git describe --long 2>/dev/null || echo $(short_ver)-0-unknown-g`git describe --always`)

all:

PYTHON ?= python3
Expand All @@ -12,24 +9,6 @@ clean:
$(RM) -r *.egg-info/ build/ dist/ rpm/
$(RM) ../rpm_s3_mirror_* test-*.xml

rpm:
git archive --output=rpm_s3_mirror-rpm-src.tar --prefix=rpm_s3_mirror/ HEAD
rpmbuild -bb rpm_s3_mirror.spec \
--define '_topdir $(PWD)/rpm' \
--define '_sourcedir $(CURDIR)' \
--define 'major_version $(short_ver)' \
--define 'minor_version $(subst -,.,$(subst $(short_ver)-,,$(long_ver)))'
$(RM) rpm_s3_mirror-rpm-src.tar

build-dep-fed:
sudo dnf -y install --best --allowerasing \
python3-black \
python3-defusedxml \
python3-requests \
python3-dateutil \
python3-botocore \
python3-lxml

test: copyright lint unittest

reformat:
Expand Down
55 changes: 55 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,58 @@
[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
name = "rpm_s3_mirror"
authors = [
{ name="Aiven", email="[email protected]" },
]
description = "Tool for syncing RPM repositories with S3"
readme = "README.md"
requires-python = ">=3.7"
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: Apache Software License",
"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",
"Natural Language :: English",
]
license = { text = "Apache License 2.0" }
dynamic = ["version"]
dependencies = [
"defusedxml>=0.7.1,<1",
"requests>=2.27.1,<3",
"python-dateutil>=2.8.1,<3",
"botocore>=1.23.50,<2",
"lxml>=4.6.5,<5",
]

[project.optional-dependencies]
dev = [
"black>=22.8.0,<23",
"click>=8.0.1,<9",
]

[project.urls]
"Homepage" = "https://github.com/aiven/rpm-s3-mirror"
"Bug Tracker" = "https://github.com/aiven/rpm-s3-mirror/issues"

[project.scripts]
rpm_s3_mirror = "rpm_s3_mirror.__main__:main"

[tool.hatch.version]
source = "vcs"

[tool.hatch.build.hooks.vcs]
version-file = "rpm_s3_mirror/version.py"


# NOTE: you have to use single-quoted strings in TOML for regular expressions.
# It's the equivalent of r-strings in Python. Multiline strings are treated as
# verbose regular expressions by Black. Use [ ] to denote a significant space
Expand Down
4 changes: 0 additions & 4 deletions requirements.dev.txt

This file was deleted.

5 changes: 0 additions & 5 deletions requirements.txt

This file was deleted.

39 changes: 6 additions & 33 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,9 @@
# Copyright (c) 2020 Aiven, Helsinki, Finland. https://aiven.io/

from setuptools import setup
import version
# a setup.py shim which is required for an editable install
# see pyproject.toml for build configuration
# https://peps.python.org/pep-0518
import setuptools

version = version.get_project_version("rpm_s3_mirror/version.py")

setup(
name="rpm_s3_mirror",
packages=["rpm_s3_mirror"],
version=version,
description="Tool for syncing RPM repositories with S3",
license="Apache 2.0",
author="Aiven",
author_email="[email protected]",
url="https://github.com/aiven/rpm-s3-mirror",
install_requires=[
"defusedxml",
"requests",
"python-dateutil",
"botocore",
"lxml",
],
entry_points={
"console_scripts": [
"rpm_s3_mirror = rpm_s3_mirror.__main__:main",
],
},
classifiers=[
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"Intended Audience :: System Administrators",
"Programming Language :: Python :: 3.7",
"Natural Language :: English",
],
)
if __name__ == "__main__":
setuptools.setup()
55 changes: 0 additions & 55 deletions version.py

This file was deleted.

0 comments on commit 9391206

Please sign in to comment.