%global _empty_manifest_terminate_build 0 Name: python-pypendency Version: 0.3.0 Release: 1 Summary: A dependency injection tool for python License: MIT License URL: https://github.com/Feverup/pypendency Source0: https://mirrors.nju.edu.cn/pypi/web/packages/97/54/c1cc32083e86b5b8ac3384dd8277bf5c8ab7509078e8914664845a39d265/pypendency-0.3.0.tar.gz BuildArch: noarch Requires: python3-pyyaml %description # Pypendency Pypendency is a dependency injection library for python >=3.7. ## Installation ```bash pip install pypendency ``` ## Usage Pypendency supports: * Declaration of explicit dependencies for each registered service. * Lazy evaluation (dependencies are not evaluated and instantiated until they are required) * Loading dependencies from different sources, such as python file, yaml file or directories. Also, it can be done programmatically. #### Examples ```python # application_bootstrap.py from pypendency.builder import container_builder from pypendency.definition import Definition from pypendency.loaders.yaml_loader import YamlLoader from pypendency.loaders.py_loader import PyLoader # Manually container_builder.set('random_object', object()) container_builder.set_definition( Definition('another_random_object', 'builtins.object') ) # File by file YamlLoader(container_builder).load('/absolute/path/to/yaml/example.yaml') PyLoader(container_builder).load('/absolute/path/to/python_file/example.py') PyLoader(container_builder).load_by_module_name('python_file.example') # Specifying a directory YamlLoader(container_builder).load_dir('/absolute/path/to/yaml/') PyLoader(container_builder).load_dir('/absolute/path/to/python_file/') ``` ```yaml # path_to_yaml/example_di.yaml example_class_identifier: fqn: example.class.namespace.ClassName args: - '@another_example_class_identifier' kwargs: example_kwarg: '@random_object' ``` ```python # python/file/namespace/example_di.py from pypendency.argument import Argument from pypendency.builder import ContainerBuilder from pypendency.definition import Definition def load(container_builder: ContainerBuilder): container_builder.set("literal_string", "example_literal_string") container_builder.set_definition( Definition( "another_example_class_identifier", "another.example.class.namespace.AnotherClassName", [ Argument.no_kw_argument("@literal_string"), Argument("kw_arg_example", "@literal_string"), ] ) ) ``` ## Running tests Build the docker image: ```bash docker build . -t pypendency-dev ``` Run tests: ```bash docker run -v $(pwd)/.:/usr/src/app pypendency-dev bash -c "pipenv run make run-tests" ``` %package -n python3-pypendency Summary: A dependency injection tool for python Provides: python-pypendency BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-pypendency # Pypendency Pypendency is a dependency injection library for python >=3.7. ## Installation ```bash pip install pypendency ``` ## Usage Pypendency supports: * Declaration of explicit dependencies for each registered service. * Lazy evaluation (dependencies are not evaluated and instantiated until they are required) * Loading dependencies from different sources, such as python file, yaml file or directories. Also, it can be done programmatically. #### Examples ```python # application_bootstrap.py from pypendency.builder import container_builder from pypendency.definition import Definition from pypendency.loaders.yaml_loader import YamlLoader from pypendency.loaders.py_loader import PyLoader # Manually container_builder.set('random_object', object()) container_builder.set_definition( Definition('another_random_object', 'builtins.object') ) # File by file YamlLoader(container_builder).load('/absolute/path/to/yaml/example.yaml') PyLoader(container_builder).load('/absolute/path/to/python_file/example.py') PyLoader(container_builder).load_by_module_name('python_file.example') # Specifying a directory YamlLoader(container_builder).load_dir('/absolute/path/to/yaml/') PyLoader(container_builder).load_dir('/absolute/path/to/python_file/') ``` ```yaml # path_to_yaml/example_di.yaml example_class_identifier: fqn: example.class.namespace.ClassName args: - '@another_example_class_identifier' kwargs: example_kwarg: '@random_object' ``` ```python # python/file/namespace/example_di.py from pypendency.argument import Argument from pypendency.builder import ContainerBuilder from pypendency.definition import Definition def load(container_builder: ContainerBuilder): container_builder.set("literal_string", "example_literal_string") container_builder.set_definition( Definition( "another_example_class_identifier", "another.example.class.namespace.AnotherClassName", [ Argument.no_kw_argument("@literal_string"), Argument("kw_arg_example", "@literal_string"), ] ) ) ``` ## Running tests Build the docker image: ```bash docker build . -t pypendency-dev ``` Run tests: ```bash docker run -v $(pwd)/.:/usr/src/app pypendency-dev bash -c "pipenv run make run-tests" ``` %package help Summary: Development documents and examples for pypendency Provides: python3-pypendency-doc %description help # Pypendency Pypendency is a dependency injection library for python >=3.7. ## Installation ```bash pip install pypendency ``` ## Usage Pypendency supports: * Declaration of explicit dependencies for each registered service. * Lazy evaluation (dependencies are not evaluated and instantiated until they are required) * Loading dependencies from different sources, such as python file, yaml file or directories. Also, it can be done programmatically. #### Examples ```python # application_bootstrap.py from pypendency.builder import container_builder from pypendency.definition import Definition from pypendency.loaders.yaml_loader import YamlLoader from pypendency.loaders.py_loader import PyLoader # Manually container_builder.set('random_object', object()) container_builder.set_definition( Definition('another_random_object', 'builtins.object') ) # File by file YamlLoader(container_builder).load('/absolute/path/to/yaml/example.yaml') PyLoader(container_builder).load('/absolute/path/to/python_file/example.py') PyLoader(container_builder).load_by_module_name('python_file.example') # Specifying a directory YamlLoader(container_builder).load_dir('/absolute/path/to/yaml/') PyLoader(container_builder).load_dir('/absolute/path/to/python_file/') ``` ```yaml # path_to_yaml/example_di.yaml example_class_identifier: fqn: example.class.namespace.ClassName args: - '@another_example_class_identifier' kwargs: example_kwarg: '@random_object' ``` ```python # python/file/namespace/example_di.py from pypendency.argument import Argument from pypendency.builder import ContainerBuilder from pypendency.definition import Definition def load(container_builder: ContainerBuilder): container_builder.set("literal_string", "example_literal_string") container_builder.set_definition( Definition( "another_example_class_identifier", "another.example.class.namespace.AnotherClassName", [ Argument.no_kw_argument("@literal_string"), Argument("kw_arg_example", "@literal_string"), ] ) ) ``` ## Running tests Build the docker image: ```bash docker build . -t pypendency-dev ``` Run tests: ```bash docker run -v $(pwd)/.:/usr/src/app pypendency-dev bash -c "pipenv run make run-tests" ``` %prep %autosetup -n pypendency-0.3.0 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-pypendency -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Fri May 05 2023 Python_Bot - 0.3.0-1 - Package Spec generated