leaf-server-common 0.1.18__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. leaf_server_common-0.1.18/.flake8 +6 -0
  2. leaf_server_common-0.1.18/.github/workflows/codeql.yml +98 -0
  3. leaf_server_common-0.1.18/.github/workflows/publish.yml +33 -0
  4. leaf_server_common-0.1.18/.github/workflows/tests.yml +39 -0
  5. leaf_server_common-0.1.18/.gitignore +26 -0
  6. leaf_server_common-0.1.18/.pylintrc +44 -0
  7. leaf_server_common-0.1.18/LICENSE.txt +223 -0
  8. leaf_server_common-0.1.18/NOTICE.txt +10 -0
  9. leaf_server_common-0.1.18/PKG-INFO +31 -0
  10. leaf_server_common-0.1.18/README.md +3 -0
  11. leaf_server_common-0.1.18/build_scripts/Dockerfile +77 -0
  12. leaf_server_common-0.1.18/build_scripts/codefresh.yml +230 -0
  13. leaf_server_common-0.1.18/build_scripts/copyright_config.json +6 -0
  14. leaf_server_common-0.1.18/build_scripts/run_pylint.sh +57 -0
  15. leaf_server_common-0.1.18/build_scripts/run_shellcheck.sh +23 -0
  16. leaf_server_common-0.1.18/build_scripts/source_available_copyright.txt +11 -0
  17. leaf_server_common-0.1.18/leaf_server_common/__init__.py +0 -0
  18. leaf_server_common-0.1.18/leaf_server_common/logging/README.md +3 -0
  19. leaf_server_common-0.1.18/leaf_server_common/logging/__init__.py +0 -0
  20. leaf_server_common-0.1.18/leaf_server_common/logging/__pycache__/__init__.cpython-38.pyc +0 -0
  21. leaf_server_common-0.1.18/leaf_server_common/logging/__pycache__/honeycomb_logging_handler.cpython-38.pyc +0 -0
  22. leaf_server_common-0.1.18/leaf_server_common/logging/__pycache__/message_types.cpython-38.pyc +0 -0
  23. leaf_server_common-0.1.18/leaf_server_common/logging/__pycache__/request_logger_adapter.cpython-38.pyc +0 -0
  24. leaf_server_common-0.1.18/leaf_server_common/logging/__pycache__/service_log_record.cpython-38.pyc +0 -0
  25. leaf_server_common-0.1.18/leaf_server_common/logging/__pycache__/structured_log_record.cpython-38.pyc +0 -0
  26. leaf_server_common-0.1.18/leaf_server_common/logging/logging_setup.py +102 -0
  27. leaf_server_common-0.1.18/leaf_server_common/logging/message_types.py +50 -0
  28. leaf_server_common-0.1.18/leaf_server_common/logging/open_telemetry_logging_handler.py +221 -0
  29. leaf_server_common-0.1.18/leaf_server_common/logging/request_logger_adapter.py +52 -0
  30. leaf_server_common-0.1.18/leaf_server_common/logging/service_log_record.py +143 -0
  31. leaf_server_common-0.1.18/leaf_server_common/logging/structured_log_record.py +104 -0
  32. leaf_server_common-0.1.18/leaf_server_common/server/__init__.py +0 -0
  33. leaf_server_common-0.1.18/leaf_server_common/server/atomic_counter.py +52 -0
  34. leaf_server_common-0.1.18/leaf_server_common/server/grpc_metadata_forwarder.py +58 -0
  35. leaf_server_common-0.1.18/leaf_server_common/server/probe.py +44 -0
  36. leaf_server_common-0.1.18/leaf_server_common/server/request_logger.py +53 -0
  37. leaf_server_common-0.1.18/leaf_server_common/server/server_lifetime.py +405 -0
  38. leaf_server_common-0.1.18/leaf_server_common/server/server_loop_callbacks.py +32 -0
  39. leaf_server_common-0.1.18/leaf_server_common/server/service_info.py +111 -0
  40. leaf_server_common-0.1.18/leaf_server_common.egg-info/PKG-INFO +31 -0
  41. leaf_server_common-0.1.18/leaf_server_common.egg-info/SOURCES.txt +48 -0
  42. leaf_server_common-0.1.18/leaf_server_common.egg-info/dependency_links.txt +1 -0
  43. leaf_server_common-0.1.18/leaf_server_common.egg-info/requires.txt +9 -0
  44. leaf_server_common-0.1.18/leaf_server_common.egg-info/top_level.txt +2 -0
  45. leaf_server_common-0.1.18/pyproject.toml +59 -0
  46. leaf_server_common-0.1.18/requirements-build.txt +24 -0
  47. leaf_server_common-0.1.18/requirements.txt +25 -0
  48. leaf_server_common-0.1.18/setup.cfg +4 -0
  49. leaf_server_common-0.1.18/tests/__init__.py +0 -0
  50. leaf_server_common-0.1.18/tests/test_something.py +25 -0
@@ -0,0 +1,6 @@
1
+ [flake8]
2
+ max-line-length = 120
3
+ exclude =
4
+ artifacts,
5
+ build_scripts,
6
+ deployment
@@ -0,0 +1,98 @@
1
+ # For most projects, this workflow file will not need changing; you simply need
2
+ # to commit it to your repository.
3
+ #
4
+ # You may wish to alter this file to override the set of languages analyzed,
5
+ # or to provide custom queries or build logic.
6
+ #
7
+ # ******** NOTE ********
8
+ # We have attempted to detect the languages in your repository. Please check
9
+ # the `language` matrix defined below to confirm you have the correct set of
10
+ # supported CodeQL languages.
11
+ #
12
+ name: "CodeQL Advanced"
13
+
14
+ on:
15
+ push:
16
+ branches: [ "main" ]
17
+ pull_request:
18
+ branches: [ "main" ]
19
+ schedule:
20
+ - cron: '28 22 * * 1'
21
+
22
+ jobs:
23
+ analyze:
24
+ name: Analyze (${{ matrix.language }})
25
+ # Runner size impacts CodeQL analysis time. To learn more, please see:
26
+ # - https://gh.io/recommended-hardware-resources-for-running-codeql
27
+ # - https://gh.io/supported-runners-and-hardware-resources
28
+ # - https://gh.io/using-larger-runners (GitHub.com only)
29
+ # Consider using larger runners or machines with greater resources for possible analysis time improvements.
30
+ runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
31
+ permissions:
32
+ # required for all workflows
33
+ security-events: write
34
+
35
+ # required to fetch internal or private CodeQL packs
36
+ packages: read
37
+
38
+ # only required for workflows in private repositories
39
+ actions: read
40
+ contents: read
41
+
42
+ strategy:
43
+ fail-fast: false
44
+ matrix:
45
+ include:
46
+ - language: python
47
+ build-mode: none
48
+ # CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
49
+ # Use `c-cpp` to analyze code written in C, C++ or both
50
+ # Use 'java-kotlin' to analyze code written in Java, Kotlin or both
51
+ # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
52
+ # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
53
+ # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
54
+ # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
55
+ # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
56
+ steps:
57
+ - name: Checkout repository
58
+ uses: actions/checkout@v4
59
+
60
+ # Add any setup steps before running the `github/codeql-action/init` action.
61
+ # This includes steps like installing compilers or runtimes (`actions/setup-node`
62
+ # or others). This is typically only required for manual builds.
63
+ # - name: Setup runtime (example)
64
+ # uses: actions/setup-example@v1
65
+
66
+ # Initializes the CodeQL tools for scanning.
67
+ - name: Initialize CodeQL
68
+ uses: github/codeql-action/init@v3
69
+ with:
70
+ languages: ${{ matrix.language }}
71
+ build-mode: ${{ matrix.build-mode }}
72
+ # If you wish to specify custom queries, you can do so here or in a config file.
73
+ # By default, queries listed here will override any specified in a config file.
74
+ # Prefix the list here with "+" to use these queries and those in the config file.
75
+
76
+ # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
77
+ # queries: security-extended,security-and-quality
78
+
79
+ # If the analyze step fails for one of the languages you are analyzing with
80
+ # "We were unable to automatically build your code", modify the matrix above
81
+ # to set the build mode to "manual" for that language. Then modify this step
82
+ # to build your code.
83
+ # ℹ️ Command-line programs to run using the OS shell.
84
+ # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
85
+ - if: matrix.build-mode == 'manual'
86
+ shell: bash
87
+ run: |
88
+ echo 'If you are using a "manual" build mode for one or more of the' \
89
+ 'languages you are analyzing, replace this with the commands to build' \
90
+ 'your code, for example:'
91
+ echo ' make bootstrap'
92
+ echo ' make release'
93
+ exit 1
94
+
95
+ - name: Perform CodeQL Analysis
96
+ uses: github/codeql-action/analyze@v3
97
+ with:
98
+ category: "/language:${{matrix.language}}"
@@ -0,0 +1,33 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published] # Trigger only when a GitHub Release is published.
6
+
7
+ jobs:
8
+ publish:
9
+ name: Build and Publish
10
+ runs-on: ubuntu-latest
11
+ environment: pypi # Match this to your configured GitHub Environment.
12
+
13
+ steps:
14
+ - name: Checkout code
15
+ uses: actions/checkout@v4
16
+
17
+ - name: Set up Python
18
+ uses: actions/setup-python@v5
19
+ with:
20
+ python-version: '3.10'
21
+
22
+ - name: Install build tools
23
+ run: |
24
+ pip install --upgrade pip
25
+ pip install build
26
+
27
+ - name: Build wheel and sdist
28
+ run: python -m build
29
+
30
+ - name: Publish to PyPI
31
+ uses: pypa/gh-action-pypi-publish@release/v1
32
+ with:
33
+ password: ${{ secrets.PYPI_API_TOKEN }}
@@ -0,0 +1,39 @@
1
+ name: Test
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - "**"
8
+ pull_request:
9
+
10
+ jobs:
11
+ test:
12
+ runs-on: ubuntu-latest
13
+ container:
14
+ image: python:3.12-slim
15
+
16
+ steps:
17
+ - name: Checkout
18
+ uses: actions/checkout@v4
19
+
20
+ - name: Install dependencies
21
+ run: |
22
+ apt-get update && apt-get install -y shellcheck
23
+ pip install -r requirements-build.txt
24
+ pip install -r requirements.txt
25
+
26
+ - name: Show installed packages
27
+ run: pip freeze
28
+
29
+ - name: Run pylint
30
+ run: build_scripts/run_pylint.sh
31
+
32
+ - name: Run shellcheck
33
+ run: build_scripts/run_shellcheck.sh
34
+
35
+ - name: Run flake8
36
+ run: flake8
37
+
38
+ - name: Run pytest (excluding integration tests)
39
+ run: pytest --verbose -m "not integration" --timer-top-n 10
@@ -0,0 +1,26 @@
1
+ # PyCharm project files
2
+ .idea/
3
+
4
+ # ipython notebook checkpoints
5
+ .ipynb_checkpoints/
6
+
7
+ # virtualenv folder
8
+ venv/
9
+ venv3/
10
+
11
+ # Python byte code
12
+ *.pyc
13
+
14
+ # build files
15
+ dist/
16
+ build/
17
+ *.egg-info/
18
+
19
+ # Vim editor restore files
20
+ *.swp
21
+
22
+ # Documentation created by mkdocs which may harbor security vulnerabilities
23
+ site/
24
+
25
+ # Resources used by Dockerfile
26
+ leaf-common/
@@ -0,0 +1,44 @@
1
+ # Note:
2
+ # This is a minimal subset of the options available for Pylint.
3
+ # To generate an exhaustive configuration file based on current settings and defaults, run the following command
4
+ # in the project directory:
5
+ #
6
+ # pylint --generate-rcfile > ~/.pylintrc
7
+
8
+ [MASTER]
9
+
10
+ # Add files or directories to the blacklist. They should be base names, not
11
+ # paths.
12
+ ignore=.git
13
+
14
+ # Directories from top level that should be ignored.
15
+ ignore-paths=backend/grpc/generated,serving/adapter/grpc_gen/generated
16
+
17
+ # Add files or directories matching the regex patterns to the blacklist. The
18
+ # regex matches against base names, not paths.
19
+ ignore-patterns=
20
+
21
+ # Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the
22
+ # number of processors available to use.
23
+ jobs=0
24
+
25
+ # Set reasonable line length
26
+ max-line-length=120
27
+
28
+ # When enabled, pylint would attempt to guess common misconfiguration and emit
29
+ # user-friendly hints instead of false-positive error messages.
30
+ suggestion-mode=yes
31
+
32
+ # Disable the message, report, category or checker with the given id(s). You
33
+ # can either give multiple identifiers separated by comma (,) or put this
34
+ # option multiple times (only on the command line, not in the configuration
35
+ # file where it should appear only once).You can also use "--disable=all" to
36
+ # disable everything first and then reenable specific checks. For example, if
37
+ # you want to run only the similarities checker, you can use "--disable=all
38
+ # --enable=similarities". If you want to run only the classes checker, but have
39
+ # no Warning level messages displayed, use"--disable=all --enable=classes
40
+ # --disable=W"
41
+
42
+ disable=
43
+ duplicate-code,
44
+ missing-module-docstring,
@@ -0,0 +1,223 @@
1
+ License
2
+ The following license governs the use of leaf-server-common SDK Software in academic
3
+ and educational environments. Commercial use requires a commercial license from
4
+ Cognizant Technology Solutions Corp, www.cognizant.com.
5
+
6
+ ACADEMIC PUBLIC LICENSE
7
+ Written by Andras Varga (license text is in public domain)
8
+ Adapted by Karl Mutch (license text is in public domain)
9
+
10
+ Preamble
11
+ This license contains the terms and conditions of using leaf-server-common SDK Software
12
+ in noncommercial settings: at academic institutions for teaching and research
13
+ use, and at non-profit research organizations. You will find that this license
14
+ provides noncommercial users of leaf-server-common SDK Software with rights that are
15
+ similar to the well-known GNU General Public License, yet it retains the
16
+ possibility for leaf-server-common SDK Software authors to financially support the
17
+ development by selling commercial licenses. In fact, if you intend to use
18
+ leaf-server-common SDK Software in a “for-profit” environment, where research is
19
+ conducted to develop or enhance a product, is used in a commercial service
20
+ offering, or when a commercial company uses leaf-server-common SDK Software to
21
+ participate in a research project (for example government-funded or EU-funded
22
+ research projects), then you need to obtain a commercial license for
23
+ leaf-server-common SDK Software. In that case, please contact the Author to inquire
24
+ about commercial licenses.
25
+
26
+ What are the rights given to noncommercial users? Similarly to GPL, you have the
27
+ right to use the software, to distribute copies, to receive source code, to
28
+ change the software and distribute your modifications or the modified software.
29
+ Also similarly to the GPL, if you distribute verbatim or modified copies of
30
+ this software, they must be distributed under this license.
31
+
32
+ By modeling the GPL, this license guarantees that you’re safe when using
33
+ leaf-server-common SDK Software in your work, for teaching or research. This license
34
+ guarantees that leaf-server-common SDK Software will remain available free of charge
35
+ for nonprofit use. You can modify leaf-server-common SDK Software to your purposes,
36
+ and you can also share your modifications. Even in the unlikely case of the
37
+ authors abandoning leaf-server-common SDK Software entirely, this license permits
38
+ anyone to continue developing it from the last release, and to create further
39
+ releases under this license.
40
+
41
+ We believe that the combination of noncommercial open-source and commercial
42
+ licensing will be beneficial for the whole user community, because income from
43
+ commercial licenses will enable faster development and a higher level of
44
+ software quality, while further enjoying the informal, open communication and
45
+ collaboration channels of open source development.
46
+
47
+ The precise terms and conditions for using, copying, distribution and
48
+ modification follow.
49
+
50
+ TERMS AND CONDITIONS FOR USE, COPYING, DISTRIBUTION AND MODIFICATION
51
+
52
+ Definitions
53
+ “Program” means a copy of leaf-server-common SDK Software, which is said to be
54
+ distributed under this Academic Public License.
55
+
56
+ “Work based on the Program” means either the Program or any derivative work
57
+ under copyright law: that is to say, a work containing the Program or a portion
58
+ of it, either verbatim or with modifications and/or translated into another
59
+ language. (Hereinafter, translation is included without limitation in the term
60
+ “modification”.)
61
+
62
+ “Using the Program” means any act of creating executables that contain or
63
+ directly use libraries that are part of the Program, running any of the tools
64
+ that are part of the Program, or creating works based on the Program.
65
+
66
+ Each licensee is addressed as “you”.
67
+
68
+ §1. Permission is hereby granted to use the Program free of charge for any
69
+ noncommercial purpose, including teaching and research at universities, colleges
70
+ and other educational institutions, research at non-profit research
71
+ institutions, and personal non-profit purposes. For using the Program for
72
+ commercial purposes, including but not restricted to consulting activities,
73
+ design of commercial hardware or software networking products, and a commercial
74
+ entity participating in research projects, you have to contact the Author for an
75
+ appropriate license. Permission is also granted to use the Program for a
76
+ reasonably limited period of time for the purpose of evaluating its usefulness
77
+ for a particular purpose.
78
+
79
+ §2. You may copy and distribute verbatim copies of the Program’s source code as
80
+ you receive it, in any medium, provided that you conspicuously and appropriately
81
+ publish on each copy an appropriate copyright notice and disclaimer of warranty;
82
+ keep intact all the notices that refer to this License and to the absence of any
83
+ warranty; and give any other recipients of the Program a copy of this License
84
+ along with the Program.
85
+
86
+ §3. You may modify your copy or copies of the Program or any portion of it, thus
87
+ forming a work based on the Program, and copy and distribute such modifications
88
+ or work under the terms of Section 2 above, provided that you also meet all of
89
+ these conditions:
90
+
91
+ a) You must cause the modified files to carry prominent notices stating that
92
+ you changed the files and the date of any change.
93
+
94
+ b) You must cause any work that you distribute or publish, that in whole or in
95
+ part contains or is derived from the Program or any part thereof, to be
96
+ licensed as a whole at no charge to all third parties under the terms of this
97
+ License.
98
+
99
+ These requirements apply to the modified work as a whole. If identifiable
100
+ sections of that work are not derived from the Program, and can be reasonably
101
+ considered independent and separate works in themselves, then this License, and
102
+ its terms, do not apply to those sections when you distribute them as separate
103
+ works. But when you distribute the same sections as part of a whole which is a
104
+ work based on the Program, the distribution of the whole must be on the terms of
105
+ this License, whose regulations for other licensees extend to the entire whole,
106
+ and thus to each and every part regardless of who wrote it. (If the same,
107
+ independent sections are distributed as part of a package that is otherwise
108
+ reliant on, or is based on the Program, then the distribution of the whole
109
+ package, including but not restricted to the independent section, must be on the
110
+ unmodified terms of this License, regadless of who the author of the included
111
+ sections was.)
112
+
113
+ Thus, it is not the intent of this section to claim rights or contest your
114
+ rights to work written entirely by you; rather, the intent is to exercise the
115
+ right to control the distribution of derivative or collective works based or
116
+ reliant on the Program.
117
+
118
+ In addition, mere aggregation of another work not based on the Program with the
119
+ Program (or with a work based on the Program) on a volume of storage or
120
+ distribution medium does not bring the other work under the scope of this
121
+ License.
122
+
123
+ §4. You may copy and distribute the Program (or a work based on it, under
124
+ Section 3) in object code or executable form under the terms of Sections 2 and 3
125
+ above provided that you also do one of the following:
126
+
127
+ a) Accompany it with the complete corresponding machine-readable source code,
128
+ which must be distributed under the terms of Sections 2 and 3 above on a medium
129
+ customarily used for software interchange; or,
130
+
131
+ b) Accompany it with a written offer, valid for at least three years, to give
132
+ any third party, for a charge no more than your cost of physically performing
133
+ source distribution, a complete machine-readable copy of the corresponding
134
+ source code, to be distributed under the terms of Sections 2 and 3 above on a
135
+ medium customarily used for software interchange; or,
136
+
137
+ c) Accompany it with the information you received as to the offer to distribute
138
+ corresponding source code. (This alternative is allowed only for noncommercial
139
+ distribution and only if you received the program in object code or executable
140
+ form with such an offer, in accord with Subsection b) above.)
141
+
142
+ The source code for a work means the preferred form of the work for making
143
+ modifications to it. For an executable work, complete source code means all the
144
+ source code for all modules it contains, plus any associated interface
145
+ definition files, plus the scripts used to control compilation and installation
146
+ of the executable. However, as a special exception, the source code distributed
147
+ need not include anything that is normally distributed (in either source or
148
+ binary form) with the major components (compiler, kernel, and so on) of the
149
+ operating system on which the executable runs, unless that component itself
150
+ accompanies the executable.
151
+
152
+ If distribution of executable or object code is made by offering access to copy
153
+ from a designated place, then offering equivalent access to copy the source code
154
+ from the same place counts as distribution of the source code, even though third
155
+ parties are not compelled to copy the source along with the object code.
156
+
157
+ §5. You may not copy, modify, sublicense, or distribute the Program except as
158
+ expressly provided under this License. Any attempt otherwise to copy, modify,
159
+ sublicense or distribute the Program is void, and will automatically terminate
160
+ your rights under this License. However, parties who have received copies, or
161
+ rights, from you under this License will not have their licenses terminated so
162
+ long as such parties remain in full compliance.
163
+
164
+ §6. You are not required to accept this License, since you have not signed it.
165
+ Nothing else grants you permission to modify or distribute the Program or its
166
+ derivative works; law prohibits these actions if you do not accept this License.
167
+ Therefore, by modifying or distributing the Program (or any work based on the
168
+ Program), you indicate your acceptance of this License and all its terms and
169
+ conditions for copying, distributing or modifying the Program or works based on
170
+ it, to do so.
171
+
172
+ §7. Each time you redistribute the Program (or any work based on the Program),
173
+ the recipient automatically receives a license from the original licensor to
174
+ copy, distribute or modify the Program subject to these terms and conditions.
175
+ You may not impose any further restrictions on the recipients’ exercise of the
176
+ rights granted herein. You are not responsible for enforcing compliance by third
177
+ parties to this License.
178
+
179
+ §8. If, as a consequence of a court judgment or allegation of patent
180
+ infringement or for any other reason (not limited to patent issues), conditions
181
+ are imposed on you (whether by court order, agreement or otherwise) that
182
+ contradict the conditions of this License, they do not excuse you from the
183
+ conditions of this License. If you cannot distribute so as to satisfy
184
+ simultaneously your obligations under this License and any other pertinent
185
+ obligations, then as a consequence you may not distribute the Program at all.
186
+ For example, if a patent license would not permit royalty-free redistribution of
187
+ the Program by all those who receive copies directly or indirectly through you,
188
+ then the only way you could satisfy both it and this License would be to refrain
189
+ entirely from distribution of the Program.
190
+
191
+ If any portion of this section is held invalid or unenforceable under any
192
+ particular circumstance, the balance of the section is intended to apply and the
193
+ section as a whole is intended to apply in other circumstances.
194
+
195
+ §9. If the distribution and/or use of the Program are restricted in certain
196
+ countries either by patents or by copyrighted interfaces, the original copyright
197
+ holder who places the Program under this License may add an explicit
198
+ geographical distribution limitation excluding those countries, so that
199
+ distribution is permitted only in or among countries not thus excluded. In such
200
+ case, this License incorporates the limitation as if written in the body of this
201
+ License.
202
+
203
+ NO WARRANTY
204
+
205
+ §10. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
206
+ THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
207
+ STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM
208
+ “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
209
+ BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
210
+ PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
211
+ PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
212
+ ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
213
+
214
+ §11. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED ON IN WRITING WILL
215
+ ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE
216
+ PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL,
217
+ SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY
218
+ TO USE THE PROGRAM INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
219
+ RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF
220
+ THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
221
+ PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
222
+
223
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1,10 @@
1
+ leaf-server-common SDK Software
2
+ Copyright (C) 2022 Cognizant Digital Business, Evolutionary AI. All Rights Reserved.
3
+
4
+ This product contains software developed by the
5
+ Cognizant Evolutionary AI organization, and may contain already
6
+ patented, patent pending, or yet to be patented material.
7
+
8
+ Any use of this software for any purpose requires a
9
+ commercially negotiated contract between any party
10
+ posessing or using the software, and Cognizant Digital Business.
@@ -0,0 +1,31 @@
1
+ Metadata-Version: 2.4
2
+ Name: leaf-server-common
3
+ Version: 0.1.18
4
+ Summary: Library for common service infrastructure for use by Cognizant AI Lab services
5
+ Author-email: Dan Fink <Daniel.Fink@cognizant.com>
6
+ License-Expression: LicenseRef-CognizantAcademicSource
7
+ Project-URL: Homepage, https://github.com/leaf-ai/leaf-server-common
8
+ Project-URL: Repository, https://github.com/leaf-ai/leaf-server-common
9
+ Project-URL: Documentation, https://github.com/leaf-ai/leaf-server-common#readme
10
+ Keywords: service,infrastructure,grpc
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Intended Audience :: Developers
15
+ Requires-Python: >=3.10
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE.txt
18
+ Requires-Dist: leaf-common==1.2.21
19
+ Requires-Dist: grpcio>=1.62.0
20
+ Requires-Dist: grpcio-health-checking>=1.62.0
21
+ Requires-Dist: grpcio-reflection>=1.62.0
22
+ Requires-Dist: grpcio-tools>=1.62.0
23
+ Requires-Dist: protobuf<5.0,>=4.25.3
24
+ Requires-Dist: opentelemetry-api<=1.27.0,>=1.23.0
25
+ Requires-Dist: opentelemetry-sdk<=1.27.0,>=1.23.0
26
+ Requires-Dist: opentelemetry-exporter-otlp<=1.27.0,>=1.23.0
27
+ Dynamic: license-file
28
+
29
+ # leaf-server-common
30
+
31
+ Library for common server code for use by ESP, ENN and Unileaf services
@@ -0,0 +1,3 @@
1
+ # leaf-server-common
2
+
3
+ Library for common server code for use by ESP, ENN and Unileaf services
@@ -0,0 +1,77 @@
1
+ # Base image
2
+ FROM python:3.10-slim
3
+
4
+ ##############################################################
5
+ # Basic Housekeeping
6
+ ##############################################################
7
+ LABEL maintainer=donn.goodhew@cognizant.com
8
+ ENV LANG C.UTF-8
9
+ ENV PYTHON_VERSION 3.10
10
+ ENV PIP3_VERSION 24.3.1
11
+ ENV DEBIAN_FRONTEND noninteractive
12
+
13
+ # Debian basics
14
+ RUN apt-get update -y
15
+ RUN apt-get install curl git -y
16
+
17
+ # Install shellcheck test utility.
18
+ # Get all our apt-get installs out of the way early
19
+ RUN apt-get install shellcheck -y
20
+
21
+ # Change EXTERNAL_BUILD_ROOT to . if debugging locally
22
+ ENV EXTERNAL_BUILD_ROOT .
23
+
24
+ ARG USERNAME leaf
25
+ RUN adduser --disabled-password --gecos '' ${USERNAME}
26
+
27
+ # The APP_HOME home is our root directory within the image
28
+ # where we place the repo's source directory.
29
+ ARG APP_HOME /home/${USERNAME}
30
+
31
+ ENV OUR_VENV ${APP_HOME}/venv/python-${PYTHON_VERSION}
32
+ ENV PATH="$OUR_VENV/bin:$PATH"
33
+
34
+ # Make directories as needed
35
+ RUN mkdir -p ${APP_HOME}
36
+
37
+ # Set up python and pip
38
+ RUN python${PYTHON_VERSION} -m venv $OUR_VENV
39
+ RUN pip3 install --upgrade pip==${PIP3_VERSION} \
40
+ && pip3 install wheel \
41
+ virtualenv
42
+
43
+ ARG REPO
44
+ ARG APP_SOURCE ${APP_HOME}/${REPO}
45
+ RUN mkdir -p ${APP_SOURCE}
46
+
47
+ # Now bring all of our requirement files in and pip install as needed.
48
+ # Create a separate layer for each of the requirements files for maximum
49
+ # caching performance. Ordered by general frequency of change, least-to-most.
50
+ # We use A COPY step before the pip install in the RUN step so that requirements
51
+ # only changes cause a proper container rebuild.
52
+ COPY --chown=${USERNAME}:${USERNAME} ${EXTERNAL_BUILD_ROOT}/requirements-build.txt ${APP_SOURCE}
53
+ RUN /bin/bash -c "pip3 install -r ${APP_SOURCE}/requirements-build.txt"
54
+
55
+ COPY --chown=${USERNAME}:${USERNAME} ${EXTERNAL_BUILD_ROOT}/requirements.txt ${APP_SOURCE}
56
+ RUN /bin/bash -c "pip3 install -r ${APP_SOURCE}/requirements.txt"
57
+
58
+ # Use the with_creds_requirements secret as the basis for the pip install
59
+ # of the main requirements. We still do the COPY first so the container
60
+ # cache is properly broken on changes.
61
+ #
62
+ # NOTE: We expect the with_creds_requirement file to provide us with
63
+ # ephemeral GitHub creds from vault as the proper replacement mechanism
64
+ # for LEAF_SOURCE_CREDENTIALS. This way, it's OK if these inherently
65
+ # short-lived happen to be stored in the container.
66
+ COPY --chown=${USERNAME}:${USERNAME} ${EXTERNAL_BUILD_ROOT}/requirements-private.txt ${APP_SOURCE}
67
+ RUN --mount=type=secret,id=with_creds_requirements \
68
+ /bin/bash -c "pip3 install -r <(cat /run/secrets/with_creds_requirements)"
69
+
70
+ # Now we copy the full source tree into the container, which will almost always
71
+ # in practice break the cache since we build when code changes.
72
+ # We do this after all the requirements are installed as code changes more often than requirements
73
+ COPY --chown=${USERNAME}:${USERNAME} . ${APP_SOURCE}
74
+
75
+ USER ${USERNAME}
76
+
77
+ WORKDIR ${APP_HOME}