Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
8d8a5b4
Update manifest file
rmk135 Oct 31, 2016
83684f0
Add cython to development requirements
rmk135 Oct 31, 2016
d594f80
Add build command to makefile
rmk135 Oct 31, 2016
7559959
Add injections extension
rmk135 Oct 31, 2016
b413826
Add injections extension to setup script
rmk135 Oct 31, 2016
02b993e
Add cython->c compilation command to .travis.yml
rmk135 Oct 31, 2016
e5498f2
Add creation of debug builds
rmk135 Nov 1, 2016
214a647
Add public methods for injections
rmk135 Nov 2, 2016
c78c9dd
Add pep257 exceptions for tests
rmk135 Nov 2, 2016
76d47df
Add few tests for injections
rmk135 Nov 2, 2016
c93d1fb
Set python 3.5 for coveralls job
rmk135 Nov 2, 2016
776da6d
Add todo about delegation to injections
rmk135 Nov 2, 2016
6b1ff70
Remove unnecessary injection tests
rmk135 Nov 2, 2016
d8f4494
Update travis config to create debug builds only for coverage
rmk135 Nov 2, 2016
3bd19a1
Tune building in debug mode
rmk135 Nov 2, 2016
7ae0086
Update examples for 3.0
rmk135 Nov 2, 2016
4d82935
Make tox produce verbose output
rmk135 Nov 2, 2016
fe36a12
Try basepython=python
rmk135 Nov 2, 2016
6a1e058
Move tests on all version to single job
rmk135 Nov 2, 2016
15d156c
Remove debug output from tox
rmk135 Nov 2, 2016
1a9dd6c
One more attempt...
rmk135 Nov 2, 2016
b724881
Attempt x
rmk135 Nov 2, 2016
cd1df0a
Try build vs cythonize
rmk135 Nov 2, 2016
49a2061
Try cythonize vs build
rmk135 Nov 2, 2016
0f1497b
Add debug to tox
rmk135 Nov 2, 2016
a7c0a76
Update tox ini
rmk135 Nov 2, 2016
8f39ed4
Update tox.ini
rmk135 Nov 2, 2016
cc85ae5
Test print
rmk135 Nov 2, 2016
e340807
Update repository structure
rmk135 Nov 2, 2016
abbc7e8
Update changelog
rmk135 Nov 2, 2016
0421ae2
Clean up, changelog update
rmk135 Nov 2, 2016
db3bd77
Clean up
rmk135 Nov 2, 2016
aac72ed
Clean up and final fixes
rmk135 Nov 2, 2016
4823278
Tune debug mode
rmk135 Nov 2, 2016
82bd1ae
Clean up
rmk135 Nov 2, 2016
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[run]
include = dependency_injector/*
omit = tests/*
source = src/dependency_injector
omit = tests/unit
plugins = Cython.Coverage

[html]
directory=reports/unittests/
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ venv/
.ropeproject/

# C extensions
dependency_injector/*.c
dependency_injector/*.so
dependency_injector/providers/*.c
dependency_injector/providers/*.so
src/dependency_injector/*.c
src/dependency_injector/*.so
src/dependency_injector/providers/*.c
src/dependency_injector/providers/*.so
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Add <file or directory> to the black list. It should be a base name, not a
# path. You may set this option multiple times.
ignore=utils,test
ignore=utils,tests

[MESSAGES CONTROL]

Expand Down
32 changes: 18 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
sudo: false
install:
- pip install tox
- pip install cython
- make cythonize
script:
- tox
language: python
install: pip install tox
script: tox
python:
- 3.5
- 3.5
env:
- TOXENV=coveralls
- TOXENV=pylint
- TOXENV=flake8
- TOXENV=pydocstyle
- TOXENV=py26
- TOXENV=py27
- TOXENV=py33
- TOXENV=py34
- TOXENV=py35
- TOXENV=pypy
- TOXENV=pypy3
- TOXENV=coveralls DEPENDENCY_INJECTOR_DEBUG_MODE=1
- TOXENV=pylint
- TOXENV=flake8
- TOXENV=pydocstyle
- TOXENV=py26
- TOXENV=py27
- TOXENV=py33
- TOXENV=py34
- TOXENV=py35
- TOXENV=pypy
- TOXENV=pypy3
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include dependency_injector/*
recursive-include src/dependency_injector *.py *.pyx *.pxd *.c
include README.rst
include CONTRIBUTORS.rst
include LICENSE.rst
Expand Down
51 changes: 40 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,33 +1,62 @@
VERSION:=$(shell python setup.py --version)
VERSION := $(shell python setup.py --version)

CYTHON_SRC := $(shell find src/dependency_injector -name '*.pyx')

CYTHON_DIRECTIVES =

ifdef DEPENDENCY_INJECTOR_DEBUG_MODE
CYTHON_DIRECTIVES += -Xprofile=True
CYTHON_DIRECTIVES += -Xlinetrace=True
endif


clean:
# Clean sources
find dependency_injector -name '*.py[co]' -delete
find dependency_injector -name '__pycache__' -delete
find dependency_injector -name '*.c' -delete
find dependency_injector -name '*.so' -delete
find src -name '*.py[cod]' -delete
find src -name '__pycache__' -delete
find src -name '*.c' -delete
find src -name '*.so' -delete
find src -name '*.html' -delete
# Clean tests
find tests -name '*.py[co]' -delete
find tests -name '__pycache__' -delete
# Clean examples
find examples -name '*.py[co]' -delete
find examples -name '__pycache__' -delete

tests: clean
cythonize:
# Compile Cython to C
cython -a $(CYTHON_DIRECTIVES) $(CYTHON_SRC)
# Move all Cython html reports
mkdir -p reports/cython/
find src -name '*.html' -exec mv {} reports/cython/ \;

build: clean cythonize
# Compile C extensions
python setup.py build_ext --inplace

install: uninstall clean cythonize
pip install -ve .

uninstall:
- pip uninstall -y -q dependency-injector 2> /dev/null

test: build
# Unit tests with coverage report
coverage erase
coverage run --rcfile=./.coveragerc -m unittest2 discover tests
coverage run --rcfile=./.coveragerc -m unittest2 discover tests/unit
coverage report --rcfile=./.coveragerc
coverage html --rcfile=./.coveragerc
coverage erase

check:
# Static analysis
flake8 --max-complexity=10 dependency_injector/
flake8 --max-complexity=10 src/dependency_injector/
flake8 --max-complexity=10 examples/
# Code style analysis
pydocstyle dependency_injector/
pydocstyle src/dependency_injector/
pydocstyle examples/

publish: clean
publish: cythonize
# Create and upload build
python setup.py sdist upload
# Create and upload tag
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
#
# The short X.Y version.
# Getting version:
with open('../dependency_injector/__init__.py') as init_file:
with open('../src/dependency_injector/__init__.py') as init_file:
version = re.search('VERSION = \'(.*?)\'', init_file.read()).group(1)

# The full version, including alpha/beta/rc tags.
Expand Down Expand Up @@ -281,7 +281,7 @@
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'Dependency Injector', u'Dependency Injector Documentation',
author, 'Dependency Injector', 'Python dependency injection framework',
author, 'Dependency Injector', 'Dependency injection microframework for Python',
'Miscellaneous'),
]

Expand Down
8 changes: 7 additions & 1 deletion docs/main/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@ follows `Semantic versioning`_

Development version
-------------------
- Add ``dependency_injector.injections`` module (C extension).
- Remove ``@inject`` decorator.
- Add makefile (``clean``, ``tests`` & ``publish`` commands).
- Add makefile (``clean``, ``test``, ``build``, ``install``, ``uninstall``
& ``publish`` commands).
- Update repository structure:

- Sources are moved under ``src``.
- Tests are moved under ``tests/unit``.

.. - No features.

Expand Down
33 changes: 0 additions & 33 deletions examples/advanced_usage/inject_flask.py

This file was deleted.

43 changes: 0 additions & 43 deletions examples/advanced_usage/inject_flask_class_based.py

This file was deleted.

28 changes: 0 additions & 28 deletions examples/advanced_usage/inject_simple.py

This file was deleted.

4 changes: 2 additions & 2 deletions examples/containers/declarative_provider_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ class SequencesContainer(containers.DeclarativeContainer):
class _SequenceContainer1(SequencesContainer):
object_provider = providers.Factory(object)
except errors.Error as exception:
print exception
print(exception)
# <class '__main__._SequenceContainer1'> can contain only
# <class '__main__.SequenceProvider'> instances

try:
class _SequenceContainer2(SequencesContainer):
object_provider = SequenceProvider(object)
except errors.Error as exception:
print exception
print(exception)
# <class '__main__.SequenceProvider'> can provide only
# <class '_abcoll.Sequence'> instances

Expand Down
4 changes: 2 additions & 2 deletions examples/containers/dynamic_provider_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ class SequenceProvider(providers.Factory):
try:
sequences_container.object_provider = providers.Factory(object)
except errors.Error as exception:
print exception
print(exception)
# <dependency_injector.containers.DynamicContainer object at
# 0x107820ed0> can contain only <class '__main__.SequenceProvider'>
# instances

try:
sequences_container.object_provider = SequenceProvider(object)
except errors.Error as exception:
print exception
print(exception)
# <class '__main__.SequenceProvider'> can provide only
# <class '_abcoll.Sequence'> instances

Expand Down
4 changes: 2 additions & 2 deletions examples/miniapps/api_client/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ def __init__(self, host, api_key):

def call(self, operation, data):
"""Make some network operations."""
print 'API call [{0}:{1}], method - {2}, data - {3}'.format(
self.host, self.api_key, operation, repr(data))
print('API call [{0}:{1}], method - {2}, data - {3}'.format(
self.host, self.api_key, operation, repr(data)))
40 changes: 0 additions & 40 deletions examples/misc/auth_system.py

This file was deleted.

Loading