%global _empty_manifest_terminate_build 0 Name: python-spine-aws-common Version: 0.2.12 Release: 1 Summary: NHS Digital Spine Core common AWS code License: MIT License URL: https://github.com/NHSDigital/spine-core-aws-common Source0: https://mirrors.nju.edu.cn/pypi/web/packages/0b/d7/cdbcd22ebb0934919428d4e1bd7519aa79c3ac78c6906fc39643bf2ba564/spine_aws_common-0.2.12.tar.gz BuildArch: noarch Requires: python3-six Requires: python3-aws-lambda-powertools %description # spine-core-aws-common Common code used across Spine projects in AWS ## Installation Simply add the pre-built package to your python environment. The latest version can be obtained with the following curl command if your system has it present: ``` package_version=$(curl -SL https://github.com/NHSDigital/spine-core-aws-common/releases/latest | grep -Po 'Release v\K(\d+.\d+.\d+)' | head -n1) ``` Or you can set a specific version: ``` package_version="0.2.3" ``` Alternatively the main page of this repo will display the latest version i.e. 0.2.3, and previous versions can be searched, which you can substitute in place of `${package_version}` in the below commands. ### PIP ``` pip install https://github.com/NHSDigital/spine-core-aws-common/releases/download/v${package_version}/spine_aws_common-${package_version}-py3-none-any.whl ``` ### requirements.txt ``` https://github.com/NHSDigital/spine-core-aws-common/releases/download/v${package_version}/spine_aws_common-${package_version}-py3-none-any.whl ``` ### Poetry ``` poetry add https://github.com/NHSDigital/spine-core-aws-common/releases/download/v${package_version}/spine_aws_common-${package_version}-py3-none-any.whl ``` ## Usage TBC Quick example ```python from spine_aws_common import LambdaApplication class MyApp(LambdaApplication): def initialise(self): # initialise return def start(self): # do actual work # to set response for the lambda self.response = '{"my new response":true}' return # create instance of class in global space # this ensures initial setup of logging/config is only done on cold start app = MyApp(additional_log_config='/path/to/mylogconfig.cfg') def lambda_handler(event, context): return app.main(event, context) ``` API Gateway example ```python from spine_aws_common import APIGatewayApplication from aws_lambda_powertools.event_handler.api_gateway import Response class MyApp(APIGatewayApplication): def get_hello(self): return Response( status_code=200, content_type="application/json", body='{"hello":"world"}' ) def get_id(self, _id): response_dict = {"id": _id} return Response( status_code=200, content_type="application/json", body=json.dumps(response_dict), ) def configure_routes(self): self._add_route(self.get_hello, "/hello") self._add_route(self.get_id, "/id/<_id>") # create instance of class in global space # this ensures initial setup of logging/config is only done on cold start app = MyApp(additional_log_config='/path/to/mylogconfig.cfg') def lambda_handler(event, context): return app.main(event, context) ``` %package -n python3-spine-aws-common Summary: NHS Digital Spine Core common AWS code Provides: python-spine-aws-common BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-spine-aws-common # spine-core-aws-common Common code used across Spine projects in AWS ## Installation Simply add the pre-built package to your python environment. The latest version can be obtained with the following curl command if your system has it present: ``` package_version=$(curl -SL https://github.com/NHSDigital/spine-core-aws-common/releases/latest | grep -Po 'Release v\K(\d+.\d+.\d+)' | head -n1) ``` Or you can set a specific version: ``` package_version="0.2.3" ``` Alternatively the main page of this repo will display the latest version i.e. 0.2.3, and previous versions can be searched, which you can substitute in place of `${package_version}` in the below commands. ### PIP ``` pip install https://github.com/NHSDigital/spine-core-aws-common/releases/download/v${package_version}/spine_aws_common-${package_version}-py3-none-any.whl ``` ### requirements.txt ``` https://github.com/NHSDigital/spine-core-aws-common/releases/download/v${package_version}/spine_aws_common-${package_version}-py3-none-any.whl ``` ### Poetry ``` poetry add https://github.com/NHSDigital/spine-core-aws-common/releases/download/v${package_version}/spine_aws_common-${package_version}-py3-none-any.whl ``` ## Usage TBC Quick example ```python from spine_aws_common import LambdaApplication class MyApp(LambdaApplication): def initialise(self): # initialise return def start(self): # do actual work # to set response for the lambda self.response = '{"my new response":true}' return # create instance of class in global space # this ensures initial setup of logging/config is only done on cold start app = MyApp(additional_log_config='/path/to/mylogconfig.cfg') def lambda_handler(event, context): return app.main(event, context) ``` API Gateway example ```python from spine_aws_common import APIGatewayApplication from aws_lambda_powertools.event_handler.api_gateway import Response class MyApp(APIGatewayApplication): def get_hello(self): return Response( status_code=200, content_type="application/json", body='{"hello":"world"}' ) def get_id(self, _id): response_dict = {"id": _id} return Response( status_code=200, content_type="application/json", body=json.dumps(response_dict), ) def configure_routes(self): self._add_route(self.get_hello, "/hello") self._add_route(self.get_id, "/id/<_id>") # create instance of class in global space # this ensures initial setup of logging/config is only done on cold start app = MyApp(additional_log_config='/path/to/mylogconfig.cfg') def lambda_handler(event, context): return app.main(event, context) ``` %package help Summary: Development documents and examples for spine-aws-common Provides: python3-spine-aws-common-doc %description help # spine-core-aws-common Common code used across Spine projects in AWS ## Installation Simply add the pre-built package to your python environment. The latest version can be obtained with the following curl command if your system has it present: ``` package_version=$(curl -SL https://github.com/NHSDigital/spine-core-aws-common/releases/latest | grep -Po 'Release v\K(\d+.\d+.\d+)' | head -n1) ``` Or you can set a specific version: ``` package_version="0.2.3" ``` Alternatively the main page of this repo will display the latest version i.e. 0.2.3, and previous versions can be searched, which you can substitute in place of `${package_version}` in the below commands. ### PIP ``` pip install https://github.com/NHSDigital/spine-core-aws-common/releases/download/v${package_version}/spine_aws_common-${package_version}-py3-none-any.whl ``` ### requirements.txt ``` https://github.com/NHSDigital/spine-core-aws-common/releases/download/v${package_version}/spine_aws_common-${package_version}-py3-none-any.whl ``` ### Poetry ``` poetry add https://github.com/NHSDigital/spine-core-aws-common/releases/download/v${package_version}/spine_aws_common-${package_version}-py3-none-any.whl ``` ## Usage TBC Quick example ```python from spine_aws_common import LambdaApplication class MyApp(LambdaApplication): def initialise(self): # initialise return def start(self): # do actual work # to set response for the lambda self.response = '{"my new response":true}' return # create instance of class in global space # this ensures initial setup of logging/config is only done on cold start app = MyApp(additional_log_config='/path/to/mylogconfig.cfg') def lambda_handler(event, context): return app.main(event, context) ``` API Gateway example ```python from spine_aws_common import APIGatewayApplication from aws_lambda_powertools.event_handler.api_gateway import Response class MyApp(APIGatewayApplication): def get_hello(self): return Response( status_code=200, content_type="application/json", body='{"hello":"world"}' ) def get_id(self, _id): response_dict = {"id": _id} return Response( status_code=200, content_type="application/json", body=json.dumps(response_dict), ) def configure_routes(self): self._add_route(self.get_hello, "/hello") self._add_route(self.get_id, "/id/<_id>") # create instance of class in global space # this ensures initial setup of logging/config is only done on cold start app = MyApp(additional_log_config='/path/to/mylogconfig.cfg') def lambda_handler(event, context): return app.main(event, context) ``` %prep %autosetup -n spine-aws-common-0.2.12 %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-spine-aws-common -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Fri May 05 2023 Python_Bot - 0.2.12-1 - Package Spec generated