semvec/pypi-packages huggingface dataset:
Django-ddd 0.1.11
An app for a cleaner Django
License: MIT License
Requires Python: >=3.11

![Django CI](https://github.com/jdiazromeral/django-ddd/workflows/Django%20CI/badge.svg)

# Django the Domain Driven Design way 
This is a proof of concept to model django apps on a domain driven design way.
The idea is to move Django app related stuff under infrastructure folder, 
so ideally an app folder structure would be:

    app_folder/
        application/
        domain/
        infrastructure/
            migrations/
            admin.py
            models.py
            __init__.py
        __init__.py
         
## Installation
To install from source, download the source code, then run this:

```bash
python setup.py install
```

Or install with pip

```bash
pip install django-ddd
```

## Configuration
Select your desired app folder structure and add these settings to your project.

##### `CUSTOM_MODELS_MODULE`
Where Django should look for your app models.

>Default: `models`
>
>Example: `infrastructure.models`

##### `CUSTOM_MIGRATIONS_MODULE`
Where Django should look for your app migrations.

>Default `migrations`
>
>Example: `infrastructure.migrations`

##### `CUSTOM_ADMIN_MODULE`
Where Django should look for your app admin configuration.

> Default `admin`
>
> Example: `infrastructure.admin`

## Usage

### To use custom locations
Install django-ddd to your project requirements and add settings so Django 
can find your apps modules as seen on configuration.
You don't need to add django-ddd to `INSTALLED_APPS`

Then, on your package `apps.py` import django-ddd custom app config:

    from django_ddd.apps_config import CleanAppConfig

    class AppNameConfig(CleanAppConfig):
        name = "app_name" # package folder name

Add your new application to `INSTALLED_APPS`

```python
INSTALLED_APPS = [
    # ...
    "app_name.infrastructure.apps.AppNameConfig",
    # ...
]
```
This should be done explicitly [after this ticket](https://code.djangoproject.com/ticket/31180).

### To use start_clean_app
This command creates a new Django app with a Domain Driven Design structure. 

To use it, you need to add django-ddd to your `INSTALLED_APPS`:
```python
INSTALLED_APPS = [
    # ...
    "django_ddd",
    # ...
]
```
Then, just call:
```bash
python manage.py start_clean_app app_name
```
This will create a new context with previously seen structure:

    app_name/
        application/
        domain/
        infrastructure/
            migrations/
            admin.py
            models.py
            __init__.py
        __init__.py

Here all Django details are under `infrastructure` folder. Package level `__init__.py` 
has route to app config: 
```python
default_app_config = "app_name.infrastructure.apps.AppNaemAppConfig"
```

You can move this folder to your sources 
and add it to `INSTALLED_APPS` so Django can recognize it.

## Contributing / Running project locally
Build the docker image:
```bash
docker build . -t django-ddd-dev
```

Run tests:
```bash
 docker run -v $(pwd)/.:/usr/src/app django-ddd-dev bash -c "pipenv run python manage.py test"
```
mandrake 0.0.2
All Magic Methods Implement. You can easyly to implement all magic methods or part of them
License: MIT License
Requires Python: >=2.0
Keywords: magic methods class

# Description

> Version: 0.0.1
> python 2.x,3.x

All Magic Methods Implement.

You can easyly to implement all magic methods or part of them

## Donate

**PIX**: +55 31 99101-8619

## Contact

**URL**: [http://estaleiroweb.com.br](http://estaleiroweb.com.br)

**GIT**: [https://github.com/estaleiroweb/mandrake](https://github.com/HelbertFernandes/mandrake)

# Instalation

> pip install mandrake

# Upgrade

> pip install mandrake -upgrade

# Use

```python
from mandrake import AllMethods

class MyClass(AllMethods): ...
```

```python
from mandrake import AttributeMethods

class MyClass(AttributeMethods):
   def __init__(self):
      super().__init__()
      self._start_init()
      self.attr1 = 1
      self._end_init()

   def _set_value(self,val):
      self.__dict__['value']=val * 2

   def _set_attr2(self,val):
      self.__dict__['attr2']=val * 3

c = MyClass()
c.value = 2
c.attr1 = 2
c.attr2 = 2
c.attr3 = 2
print({'value': {'check': hasattr(c, 'value'), 'val': c.value}})
print({'attr1': {'check': hasattr(c, 'attr1'), 'val': c.attr1}})
print({'attr2': {'check': hasattr(c, 'attr2'), 'val': c.attr2}})
print({'attr3': {'check': hasattr(c, 'attr3')}})

'''Response: 
{'value': {'check': True, 'val': 4}}
{'attr1': {'check': True, 'val': 2}}
{'attr2': {'check': True, 'val': 6}}
{'attr3': {'check': False}}
'''
```

## MainMethods

Any classes bellow will inherit this class.

It implement then `__init__` method this `value` attribute.

The children classes must be the methods `_start_init()` and `_end_init()` to define attributes of class or if wish, you can not use `_end_init()` permiting add any attribute to this object

## MathMethods

Implement all Math magic methods

## FunctionMethods

Implement all Function magic methods

## LogicMethods

Implement all Logic magic methods

## BinaryMethods

Implement all Binary magic methods

## StringMethods

Implement all String magic methods

## CastMethods

Implement all Cast magic methods

## AttributeMethods

You can creating `_set_<attr>` methods to assure the correct value

## AllMethods

The same all classes above