Skip to content

Commit

Permalink
✨ [#1] small improvement of the package code and description
Browse files Browse the repository at this point in the history
  • Loading branch information
annashamray committed Feb 21, 2024
1 parent 261a73e commit 2cc9bae
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
3 changes: 0 additions & 3 deletions django_setup_configuration/configuration.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import logging
from abc import ABC, abstractmethod

from django.conf import settings

from .exceptions import PrerequisiteFailed

logger = logging.getLogger(__name__)


class BaseConfigurationStep(ABC):
verbose_name: str
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from django.conf import settings
from django.core.management import BaseCommand, CommandError
from django.db import transaction
from django.utils.module_loading import import_string

from ...configuration import BaseConfigurationStep
Expand Down Expand Up @@ -36,16 +37,23 @@ def add_arguments(self, parser):
),
)

@transaction.atomic
def handle(self, **options):
overwrite: bool = options["overwrite"]

# todo transaction atomic
errors = ErrorDict()
steps: list[BaseConfigurationStep] = [
import_string(path)() for path in settings.SETUP_CONFIGURATION_STEPS
]
enabled_steps = [step for step in steps if step.is_enabled()]

if not enabled_steps:
self.stdout.write(
"There are no enabled configuration steps. "
"Configuration can't be set up"
)
return

self.stdout.write(
f"Configuration would be set up with following steps: {enabled_steps}"
)
Expand Down
14 changes: 8 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ build-backend = "setuptools.build_meta"
[project]
name = "django_setup_configuration"
version = "0.1.0"
description = "TODO"
description = "Pluggable configuration setup used with the django management command"
authors = [
{name = "Maykin Media", email = "[email protected]"}
]
readme = "README.rst"
license = {file = "LICENSE"}
keywords = ["TODO"]
keywords = ["Django", "Configuration"]
classifiers = [
"Development Status :: 3 - Alpha",
"Framework :: Django",
Expand All @@ -31,15 +31,17 @@ dependencies = [
]

[project.urls]
Homepage = "https://github.com/maykinmedia/django_setup_configuration"
Documentation = "http://django_setup_configuration.readthedocs.io/en/latest/"
"Bug Tracker" = "https://github.com/maykinmedia/django_setup_configuration/issues"
"Source Code" = "https://github.com/maykinmedia/django_setup_configuration"
Homepage = "https://github.com/maykinmedia/django-setup-configuration"
Documentation = "http://django-setup-configuration.readthedocs.io/en/latest/"
"Bug Tracker" = "https://github.com/maykinmedia/django-setup-configuration/issues"
"Source Code" = "https://github.com/maykinmedia/django-setup-configuration"

[project.optional-dependencies]
tests = [
"pytest",
"pytest-django",
"pytest-mock",
"furl",
"tox",
"isort",
"black",
Expand Down
2 changes: 0 additions & 2 deletions tests/test_dummy.py

This file was deleted.

0 comments on commit 2cc9bae

Please sign in to comment.