Skip to content

Commit

Permalink
Merge pull request #31 from maykinmedia/pyproject
Browse files Browse the repository at this point in the history
Switch to `pyproject.toml`
  • Loading branch information
sergei-maertens authored Mar 4, 2024
2 parents 7daef08 + 6149c28 commit 1104df7
Show file tree
Hide file tree
Showing 15 changed files with 179 additions and 179 deletions.
10 changes: 0 additions & 10 deletions .bumpversion.cfg

This file was deleted.

4 changes: 4 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[flake8]
max-line-length=88
exclude=env,.tox,doc
ignore=E203,W503
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ jobs:
with:
python-version: '3.10'

- name: Build sdist and wheel
- name: Build wheel
run: |
pip install pip setuptools wheel --upgrade
python setup.py sdist bdist_wheel
pip install build --upgrade
python -m build
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
4 changes: 1 addition & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ django-simple-certmanager
:Version: 1.4.1
:Source: https://github.com/maykinmedia/django-simple-certmanager
:Keywords: certificates
:PythonVersion: 3.9

|build-status| |code-quality| |black| |coverage| |docs|

Expand All @@ -31,8 +30,7 @@ Installation
Requirements
------------

* Python 3.7 or above
* setuptools 30.3.0 or above
* Python 3.10 or above
* Django 3.2 or newer


Expand Down
20 changes: 2 additions & 18 deletions docs/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
=========
Changelog
=========
.. _changelog:

1.0.0 (2022-08-29)
==================

Initial version of django-simple-certmanager.

This library allows you to manage TLS certificates (and keys) through the Django admin,
in a secure way. Your own code can then include references to the
``simple_certmanager.Certificate`` model.

.. note:: This library is extracted out of the `zgw-consumers`_ library.

Credits to Silvia Amabilino for the initial work and Ewen Le Guilly for splitting it into a
separate package.

.. _zgw-consumers: https://pypi.org/project/zgw-consumers/
.. include:: ../CHANGELOG.rst
1 change: 0 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,3 @@ Indices and tables

.. |pypi-version| image:: https://img.shields.io/pypi/v/django-simple-certmanager.svg
:target: https://pypi.org/project/django-simple-certmanager/

2 changes: 1 addition & 1 deletion docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Quickstart
Requirements
------------

* Python 3.7 or newer
* Python 3.10 or newer
* Django 3.2 or newer

Installation
Expand Down
130 changes: 130 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
[build-system]
requires = ["setuptools>=61.0.0"]
build-backend = "setuptools.build_meta"

[project]
name = "django-simple-certmanager"
version = "1.4.1"
description = "Manage TLS certificates and keys in the Django admin"
authors = [
{name = "Maykin Media", email = "[email protected]"}
]
readme = "README.rst"
license = {file = "LICENSE"}
keywords = ["django", "certificate", "security"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Framework :: Django",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4.2",
"Intended Audience :: Developers",
"Operating System :: Unix",
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Software Development :: Libraries :: Python Modules",
]
requires-python = ">=3.10"
dependencies = [
"django>=3.2",
"django-privates>=1.5",
"cryptography>=35.0.0",
]

[project.urls]
Homepage = "https://github.com/maykinmedia/django-simple-certmanager"
Documentation = "http://django-simple-certmanager.readthedocs.io/en/latest/"
"Bug Tracker" = "https://github.com/maykinmedia/django-simple-certmanager/issues"
"Source Code" = "https://github.com/maykinmedia/django-simple-certmanager"
Changelog = "https://github.com/maykinmedia/django-simple-certmanager/blob/main/CHANGELOG.rst"

[project.optional-dependencies]
# These are not the test requirements! They are extras to be installed when making use of `simple_certmanager.test`
testutils = [
"factory-boy",
]
tests = [
"pytest",
"pytest-django",
"pyquery",
"tox",
"isort",
"black",
"flake8",
"freezegun",
"django-stubs[compatible-mypy]",
]
coverage = [
"pytest-cov",
]
docs = [
"sphinx",
"sphinx-rtd-theme",
]
release = [
"bump-my-version",
]

[tool.setuptools.packages.find]
include = ["simple_certmanager*"]
namespaces = false

[tool.isort]
profile = "black"
combine_as_imports = true
known_django = "django"
known_first_party="simple_certmanager"
sections=["FUTURE", "STDLIB", "DJANGO", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
skip = ["env", ".tox", ".history"]

[tool.pytest.ini_options]
testpaths = ["tests"]
DJANGO_SETTINGS_MODULE = "testapp.settings"

[tool.bumpversion]
current_version = "1.4.1"
files = [
{filename = "pyproject.toml"},
{filename = "README.rst"},
{filename = "simple_certmanager/locale/nl/LC_MESSAGES/django.po"},
{filename = "docs/conf.py"},
]

[tool.coverage.run]
branch = true
source = [
"simple_certmanager"
]
omit = [
"simple_certmanager/migrations/*",
]

[tool.coverage.report]
exclude_also = [
"if (typing\\.)?TYPE_CHECKING:",
"@(typing\\.)?overload",
"class .*\\(.*Protocol.*\\):",
"@(abc\\.)?abstractmethod",
"raise NotImplementedError",
"\\.\\.\\.",
"pass",
]
omit = [
"simple_certmanager/migrations/*",
]

[tool.coverage.html]
directory = "cover"

[tool.mypy]
plugins = ["mypy_django_plugin.main"]

[[tool.mypy.overrides]]
module = "factory"
# typing support for factory-boy *is* coming
ignore_missing_imports = true

[tool.django-stubs]
django_settings_module = "testapp.settings"
111 changes: 0 additions & 111 deletions setup.cfg

This file was deleted.

3 changes: 0 additions & 3 deletions setup.py

This file was deleted.

2 changes: 1 addition & 1 deletion simple_certmanager/locale/nl/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Project-Id-Version: 1.4.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-08-29 08:08-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
Expand Down
21 changes: 12 additions & 9 deletions tests/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ def test_detail_view(temp_private_root, admin_client):
The functionality for the private key is implemented and tested in django-
privates, but we need to make sure that `private_media_no_download_fields` has
actually been set in this library."""
with open(TEST_FILES / "test.certificate", "r") as client_certificate_f, open(
TEST_FILES / "test.key", "r"
) as key_f:
with (
open(TEST_FILES / "test.certificate", "r") as client_certificate_f,
open(TEST_FILES / "test.key", "r") as key_f,
):
certificate = Certificate.objects.create(
label="Test certificate",
type=CertificateTypes.key_pair,
Expand Down Expand Up @@ -101,9 +102,10 @@ def test_list_view_invalid_public_cert(temp_private_root, admin_client, caplog):
def test_list_view_invalid_private_key(temp_private_root, admin_client, caplog):
"""Assert that `changelist_view` works if DB contains a corrupted private key"""
url = reverse("admin:simple_certmanager_certificate_changelist")
with open(TEST_FILES / "test.certificate", "r") as client_certificate_f, open(
TEST_FILES / "invalid.certificate", "r"
) as key_f:
with (
open(TEST_FILES / "test.certificate", "r") as client_certificate_f,
open(TEST_FILES / "invalid.certificate", "r") as key_f,
):
Certificate.objects.create(
label="Test certificate",
type=CertificateTypes.key_pair,
Expand Down Expand Up @@ -152,9 +154,10 @@ def test_detail_view_invalid_public_cert(temp_private_root, admin_client, caplog
def test_detail_view_invalid_private_key(temp_private_root, admin_client, caplog):
"""Assert that `change_view` works if DB contains a corrupted private key"""

with open(TEST_FILES / "test.certificate", "r") as client_certificate_f, open(
TEST_FILES / "invalid.certificate", "r"
) as key_f:
with (
open(TEST_FILES / "test.certificate", "r") as client_certificate_f,
open(TEST_FILES / "invalid.certificate", "r") as key_f,
):
certificate = Certificate.objects.create(
label="Test certificate",
type=CertificateTypes.key_pair,
Expand Down
Loading

0 comments on commit 1104df7

Please sign in to comment.