-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
256 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,3 +102,5 @@ venv.bak/ | |
|
||
# mypy | ||
.mypy_cache/ | ||
|
||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
language: python | ||
sudo: false | ||
python: | ||
- '2.7' | ||
- '3.4' | ||
- '3.5' | ||
- '3.6' | ||
install: | ||
- pip install python-coveralls tox tox-travis | ||
script: tox --recreate | ||
after_success: | ||
- pip install -r requirements.txt -e . | ||
- py.test --cov=ddd_api_gateway --cov-report=term-missing tests | ||
- coveralls | ||
deploy: | ||
provider: pypi | ||
user: sunzhongmou | ||
password: | ||
secure: pai3O4/T/nDleRjtR6RxJP0IrxMaCALjHirm1PairjYYS03/HE0o1W39mYv+HMdK7Dy6YUpetUukxQ3TncNR77RvE32dloZSu7ivqSdHZc7/KvKV3u2prOSSsdARSuZem5/wf5FSx4pVr1Vn6VzRfTX0MwiRSz5CkgukCxgjYzt56iqMC11tlztkZ/5vyea0YHSjss6PCk63OzYreWYaY5t4CUocdhYJXflJRAB/jXLpXik0KZIyvlW75hDaSRwUBdSfkPLcKJD04ScsSaVnuHSrrJzM2mAB6oF9l8AxDVTDnwb6yQbO2g8s3vlSNIMdYUlUu81togDUBzADZ1kc0Ic4g7fAL1M0AUY1P8gTunwlITOCZD2QRmgC5NsvSuB1O2Kuuj3hN5ani6dwfZXnV6kzxwEIlNK7QqUHla7VwRslPgtMGHbJNcZCWmldlMnwGSixg9MTVy98xCWgK2WAq0eSa1si7mO8VCrULj5R/re6GmwrO7hPlPeB9qSVALLvc2Ox8QSzSvl/gaoDlWGLlah6vOd2JyPlonglpL6IeNDFb/IUUCpG/Vd3fYgYMTnJScQvyY8iU84ZCM/XS73KFJwfOEl4vzHfM3orQJT6hqchZanAsf1kH02Ar5XyWqBJtdpZNgvAw4onGDFzvoYX0nfz1SsstKwJEthxIojiiOo= | ||
on: | ||
python: 2.7 | ||
skip_existing: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Changelog | ||
========= | ||
|
||
0.0.1 | ||
----- | ||
|
||
- Initial public release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include *.rst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
venv: | ||
virtualenv -p `which python3` venv && \ | ||
source venv/bin/activate | ||
|
||
activate: | ||
source venv/bin/activate | ||
|
||
develop: venv | ||
venv/bin/pip install -e . -r requirements/test.txt | ||
|
||
clean: | ||
-rm -rf venv | ||
|
||
test: | ||
tox | ||
|
||
require: | ||
pip freeze > requirements.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
DDD Base Framework | ||
================== | ||
|
||
|Build Status| |Pypi Status| |Coveralls Status| | ||
|
||
Installation | ||
------------ | ||
|
||
From source code: | ||
|
||
:: | ||
|
||
python setup.py install | ||
|
||
From pypi: | ||
|
||
:: | ||
|
||
pip install ddd-base | ||
|
||
Usage | ||
----- | ||
|
||
:: | ||
|
||
from ddd_base.value_object import ValueObject | ||
|
||
|
||
class TheValueObject(ValueObject): | ||
|
||
def __init__(self, name): | ||
super(TheValueObject, self).__init__() | ||
self.name = name | ||
|
||
def __eq__(self, other): | ||
if not isinstance(other, ValueObject): | ||
return NotImplemented | ||
|
||
return self.name == other.name | ||
|
||
|
||
def test_value_object_compare(): | ||
a_value_object = TheValueObject("name") | ||
b_value_object = TheValueObject("name") | ||
|
||
assert a_value_object.same_as(b_value_object) | ||
|
||
|
||
|
||
License | ||
------- | ||
|
||
This software is licensed under the `MIT license <http://en.wikipedia.org/wiki/MIT_License>`_ | ||
|
||
See `License file <https://github.com/sunwei/ddd-base/blob/master/LICENSE>`_ | ||
|
||
.. |Build Status| image:: https://travis-ci.com/sunwei/ddd-base.svg?branch=master | ||
:target: https://travis-ci.com/sunwei/ddd-base | ||
.. |Pypi Status| image:: https://badge.fury.io/py/ddd-base.svg | ||
:target: https://badge.fury.io/py/ddd-base | ||
.. |Coveralls Status| image:: https://coveralls.io/repos/github/sunwei/ddd-base/badge.svg?branch=master | ||
:target: https://coveralls.io/github/sunwei/ddd-base?branch=master | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from .aggregate import Aggregate | ||
from .entity import Entity | ||
from .value_object import ValueObject |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__version__ = '0.0.1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# -*- coding: utf-8 -*- | ||
"""Domain Driven Design framework - Aggregate Root.""" | ||
|
||
|
||
class Aggregate(object): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# -*- coding: utf-8 -*- | ||
"""Domain Driven Design base framework - Entity.""" | ||
|
||
import uuid | ||
|
||
|
||
class Entity(object): | ||
|
||
def __init__(self, id_=uuid.uuid1()): | ||
super(Entity, self).__init__() | ||
self.id = id_ | ||
|
||
def __eq__(self, other): | ||
if not isinstance(other, Entity): | ||
return NotImplemented | ||
|
||
return self.id == other.id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- coding: utf-8 -*- | ||
"""Domain Driven Design base framework - Value Object.""" | ||
|
||
|
||
class ValueObject(object): | ||
def same_as(self, other): | ||
return self == other |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# requirements for the CI test runner | ||
tox-travis>=0.10 | ||
codecov>=2.0.9 | ||
|
||
-r tox.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# requirements for running the tests via pytest | ||
pytest==4.5.0 | ||
pytest-cov==2.7.1 | ||
pytest-pep8==1.0.6 | ||
|
||
-r tox.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# requirements for building and running tox | ||
tox==3.9.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[bdist_wheel] | ||
universal = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
"""Setuptools entry point.""" | ||
import codecs | ||
import os | ||
from setuptools import find_packages | ||
|
||
try: | ||
from setuptools import setup | ||
except ImportError: | ||
from distutils.core import setup | ||
|
||
|
||
HERE = os.path.abspath(os.path.dirname(__file__)) | ||
ABOUT = {} | ||
with open(os.path.join(HERE, 'ddd_nginx', '__version__.py')) as f: | ||
exec(f.read(), ABOUT) | ||
|
||
CLASSIFIERS = [ | ||
'Development Status :: 4 - Beta', | ||
'Intended Audience :: Developers', | ||
'License :: OSI Approved :: MIT License', | ||
'Natural Language :: English', | ||
'Operating System :: OS Independent', | ||
'Programming Language :: Python', | ||
'Programming Language :: Python :: 2.7', | ||
'Programming Language :: Python :: 3.4', | ||
'Programming Language :: Python :: 3.5', | ||
'Programming Language :: Python :: 3.6', | ||
'Topic :: Software Development :: Libraries :: Python Modules' | ||
] | ||
|
||
dirname = os.path.dirname(__file__) | ||
|
||
long_description = ( | ||
codecs.open(os.path.join(dirname, 'README.rst'), encoding='utf-8').read() + '\n' + | ||
codecs.open(os.path.join(dirname, 'CHANGES.rst'), encoding='utf-8').read() | ||
) | ||
|
||
setup( | ||
name='ddd-nginx', | ||
version=ABOUT['__version__'], | ||
description='DDD base framework for python', | ||
long_description=long_description, | ||
author='Sun Wei', | ||
author_email='wayde.sun@gmail.com', | ||
url='https://github.com/sunwei/ddd-nginx', | ||
packages=find_packages(exclude=['tests*']), | ||
install_requires=[], | ||
classifiers=CLASSIFIERS) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from ddd_nginx.entity import Entity | ||
|
||
|
||
def test_entity_sets_ids(): | ||
an_entity = Entity() | ||
|
||
assert an_entity.id is not None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from ddd_nginx.value_object import ValueObject | ||
|
||
|
||
class TheValueObject(ValueObject): | ||
|
||
def __init__(self, name): | ||
super(TheValueObject, self).__init__() | ||
self.name = name | ||
|
||
def __eq__(self, other): | ||
if not isinstance(other, ValueObject): | ||
return NotImplemented | ||
|
||
return self.name == other.name | ||
|
||
|
||
def test_value_object_compare(): | ||
a_value_object = TheValueObject("name") | ||
b_value_object = TheValueObject("name") | ||
|
||
assert a_value_object.same_as(b_value_object) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[tox] | ||
distshare={homedir}/.tox/distshare | ||
envlist=py{27,34,35,36} | ||
skip_missing_interpreters=true | ||
indexserver= | ||
pypi = https://pypi.python.org/simple | ||
|
||
[testenv] | ||
commands= | ||
py.test ddd_nginx tests --pep8 | ||
deps = | ||
py32: pytest<3.0 | ||
py{27,34,35,36}: pytest>=3.0 | ||
pytest-pep8==1.0.6 | ||
|
||
[pytest] | ||
addopts = -vvl | ||
pep8maxlinelength=120 |