Skip to content

Commit

Permalink
chore: Modernize Packaging (#12)
Browse files Browse the repository at this point in the history
* refactor(packaging): Use setup.cfg

* fix: linter

* chore: Drop Python 3.7 support

* chore: leftovers

* chore: Bump min cryptography package

* chore: refactoring

* chore: refactor, bump versions
  • Loading branch information
Laerte authored Jul 26, 2023
1 parent b63d9d2 commit 6ac8f2c
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 71 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ jobs:
fail-fast: false
matrix:
include:
- python-version: 3.7
env:
TOXENV: py
- python-version: 3.8
env:
TOXENV: py
Expand All @@ -25,10 +22,10 @@ jobs:
TOXENV: py

# PyPy
- python-version: pypy3.7
- python-version: pypy3.8
env:
TOXENV: pypy3
- python-version: pypy3.9
- python-version: pypy3.10
env:
TOXENV: pypy3

Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
repos:
- repo: git@github.com:PyCQA/isort.git
rev: 5.10.1
rev: 5.12.0
hooks:
- id: isort
- repo: git@github.com:psf/black.git
rev: 22.3.0
rev: 23.7.0
hooks:
- id: black
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Python implementation of AES with CBC/ECB mode and padding scheme PKCS5.
============
Requirements
============
* Python 3.7+
* Python 3.8+

Install
=======
Expand Down
1 change: 0 additions & 1 deletion aes_pkcs5/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
__version__ = "1.0.1"
12 changes: 4 additions & 8 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
# import sys
# sys.path.insert(0, os.path.abspath('.'))
from datetime import datetime
from importlib.metadata import metadata

# -- Project information -----------------------------------------------------

project = "AESPKCS5"
copyright = f"{datetime.utcnow():%Y}, Laerte Pereira"
author = "Laerte Pereira"
author = metadata("aes_pkcs5")["Author"]
copyright = f"{datetime.utcnow():%Y}, {author}"

# The full version, including alpha/beta/rc tags
release = "2022"
Expand Down Expand Up @@ -53,9 +54,4 @@
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]

try:
from importlib.metadata import version
except ModuleNotFoundError: # Python < 3.8
from importlib_metadata import version

version = version("aes_pkcs5")
version = metadata("aes_pkcs5")["Version"]
2 changes: 1 addition & 1 deletion docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Installation guide
Supported Python versions
=========================

AESPKCS5 requires Python 3.7+ and depends only of ``cryptography`` package.
AESPKCS5 requires Python 3.8+ and depends only of ``cryptography`` package.

Installing AESPKCS5
====================
Expand Down
6 changes: 3 additions & 3 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
black>=22.3.0
isort>=5.10.1
pre-commit>=2.19.0
black>=23.7.0
isort>=5.12.0
pre-commit>=3.3.3
38 changes: 38 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[metadata]
name = aes_pkcs5
version = 1.0.2
description = Implementation of AES with CBC/ECB mode and padding scheme PKCS5
long_description = file: README.rst
long_description_content_type = text/x-rst
author = Laerte Pereira
author_email = hi@laerte.dev
license = BSD License
url = https://github.com/Laerte/aes_pkcs5
project_urls =
Documentation = https://aes-pkcs5.readthedocs.io
Source = https://github.com/Laerte/aes_pkcs5
Tracker = https://github.com/Laerte/aes_pkcs5/issues
classifiers =
Intended Audience :: Developers
Development Status :: 5 - Production/Stable
Operating System :: OS Independent
License :: OSI Approved :: BSD License
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: Implementation :: CPython
Programming Language :: Python :: Implementation :: PyPy
Topic :: Software Development :: Libraries :: Python Modules

[options]
packages = find:
python_requires = >=3.8
install_requires =
cryptography >= 41.0.2

[options.packages.find]
include = aes_pkcs5*
exclude = tests.*
50 changes: 2 additions & 48 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
from os import system

from setuptools import find_packages, setup
from setuptools import setup
from setuptools.command.develop import develop

from aes_pkcs5 import __version__


class CustomDevelopCommand(develop):
"""Instal development dependencies"""
Expand All @@ -14,48 +12,4 @@ def install_for_development(self):
system("pre-commit install")


requires = ["cryptography >= 38.0.1"]

extras = {}

with open("README.rst") as f:
long_description = f.read()

setup(
name="aes_pkcs5",
version=__version__,
description="Implementation of AES with CBC/ECB mode and padding scheme PKCS5",
long_description=long_description,
long_description_content_type="text/x-rst",
author="Laerte Pereira",
author_email="hi@laerte.dev",
license="BSD",
url="https://github.com/Laerte/aes_pkcs5",
project_urls={
"Documentation": "https://aes-pkcs5.readthedocs.io",
"Source": "https://github.com/Laerte/aes_pkcs5",
"Tracker": "https://github.com/Laerte/aes_pkcs5/issues",
},
packages=find_packages(include=["aes_pkcs5*"], exclude=["tests.*"]),
classifiers=[
"Intended Audience :: Developers",
"Development Status :: 5 - Production/Stable",
"Operating System :: OS Independent",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"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",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Libraries :: Python Modules",
],
python_requires=">=3.7",
include_package_data=True,
install_requires=requires,
extras_require=extras,
cmdclass={"develop": CustomDevelopCommand},
)
setup(cmdclass={"develop": CustomDevelopCommand})
2 changes: 0 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ commands =
[docs]
changedir = docs
deps =
# importlib doesn't exist on python 3.7 so we need backport
importlib_metadata==4.11.4; python_version < '3.8'
-rdocs/requirements.txt

[testenv:docs]
Expand Down

0 comments on commit 6ac8f2c

Please sign in to comment.