Skip to content

Commit b0d9907

Browse files
Merge branch 'main' into fix-sqlalchemy-engine-from-config-monkeypatching
2 parents eeb464a + 4606cf2 commit b0d9907

File tree

342 files changed

+7794
-2518
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

342 files changed

+7794
-2518
lines changed

Diff for: .flake8

-37
This file was deleted.

Diff for: .github/component_owners.yml

+7
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,10 @@ components:
6666

6767
processor/opentelemetry-processor-baggage:
6868
- codeboten
69+
70+
instrumentation-genai/:
71+
- karthikscale3
72+
- lmolkova
73+
- lzchen
74+
- gyliu513
75+
- nirga

Diff for: .github/workflows/generate_workflows.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
from pathlib import Path
22

33
from generate_workflows_lib import (
4-
generate_test_workflow,
54
generate_lint_workflow,
6-
generate_misc_workflow
5+
generate_misc_workflow,
6+
generate_test_workflow,
77
)
88

99
tox_ini_path = Path(__file__).parent.parent.parent.joinpath("tox.ini")
+6-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
21
from pathlib import Path
32

3+
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
44

5-
class CustomBuildHook(BuildHookInterface):
65

6+
class CustomBuildHook(BuildHookInterface):
77
def initialize(self, version, build_data):
8-
98
with open(
109
Path(__file__).parent.parent.parent.parent.joinpath("tox.ini")
1110
) as tox_ini_file_0:
1211
with open(
13-
Path(__file__).parent.joinpath("src/generate_workflows_lib/tox.ini"), "w"
12+
Path(__file__).parent.joinpath(
13+
"src/generate_workflows_lib/tox.ini"
14+
),
15+
"w",
1416
) as tox_ini_file_1:
1517
tox_ini_file_1.write(tox_ini_file_0.read())
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1+
from collections import defaultdict
2+
from pathlib import Path
13
from re import compile as re_compile
4+
25
from jinja2 import Environment, FileSystemLoader
3-
from pathlib import Path
46
from tox.config.cli.parse import get_options
5-
from tox.session.state import State
67
from tox.config.sets import CoreConfigSet
78
from tox.config.source.tox_ini import ToxIni
8-
from collections import defaultdict
9-
9+
from tox.session.state import State
1010

1111
_tox_test_env_regex = re_compile(
1212
r"(?P<python_version>py\w+)-test-"
@@ -19,27 +19,23 @@
1919

2020

2121
def get_tox_envs(tox_ini_path: Path) -> list:
22-
2322
tox_ini = ToxIni(tox_ini_path)
2423

2524
conf = State(get_options(), []).conf
2625

2726
tox_section = next(tox_ini.sections())
2827

29-
core_config_set = (
30-
CoreConfigSet(conf, tox_section, tox_ini_path.parent, tox_ini_path)
28+
core_config_set = CoreConfigSet(
29+
conf, tox_section, tox_ini_path.parent, tox_ini_path
3130
)
3231

3332
(
34-
core_config_set.
35-
loaders.
36-
extend(
37-
tox_ini.
38-
get_loaders(
33+
core_config_set.loaders.extend(
34+
tox_ini.get_loaders(
3935
tox_section,
4036
base=[],
4137
override_map=defaultdict(list, {}),
42-
conf=core_config_set
38+
conf=core_config_set,
4339
)
4440
)
4541
)
@@ -48,11 +44,7 @@ def get_tox_envs(tox_ini_path: Path) -> list:
4844

4945

5046
def get_test_job_datas(tox_envs: list, operating_systems: list) -> list:
51-
52-
os_alias = {
53-
"ubuntu-latest": "Ubuntu",
54-
"windows-latest": "Windows"
55-
}
47+
os_alias = {"ubuntu-latest": "Ubuntu", "windows-latest": "Windows"}
5648

5749
python_version_alias = {
5850
"pypy3": "pypy-3.8",
@@ -67,17 +59,16 @@ def get_test_job_datas(tox_envs: list, operating_systems: list) -> list:
6759

6860
for operating_system in operating_systems:
6961
for tox_env in tox_envs:
70-
7162
tox_test_env_match = _tox_test_env_regex.match(tox_env)
7263

7364
if tox_test_env_match is None:
7465
continue
7566

7667
groups = tox_test_env_match.groupdict()
7768

78-
aliased_python_version = (
79-
python_version_alias[groups["python_version"]]
80-
)
69+
aliased_python_version = python_version_alias[
70+
groups["python_version"]
71+
]
8172
tox_env = tox_test_env_match.string
8273

8374
test_requirements = groups["test_requirements"]
@@ -99,20 +90,17 @@ def get_test_job_datas(tox_envs: list, operating_systems: list) -> list:
9990
),
10091
"python_version": aliased_python_version,
10192
"tox_env": tox_env,
102-
"os": operating_system
93+
"os": operating_system,
10394
}
104-
10595
)
10696

10797
return test_job_datas
10898

10999

110100
def get_lint_job_datas(tox_envs: list) -> list:
111-
112101
lint_job_datas = []
113102

114103
for tox_env in tox_envs:
115-
116104
tox_lint_env_match = _tox_lint_env_regex.match(tox_env)
117105

118106
if tox_lint_env_match is None:
@@ -126,18 +114,15 @@ def get_lint_job_datas(tox_envs: list) -> list:
126114
"ui_name": f"{tox_lint_env_match.groupdict()['name']}",
127115
"tox_env": tox_env,
128116
}
129-
130117
)
131118

132119
return lint_job_datas
133120

134121

135122
def get_contrib_job_datas(tox_envs: list) -> list:
136-
137123
contrib_job_datas = []
138124

139125
for tox_env in tox_envs:
140-
141126
tox_contrib_env_match = _tox_contrib_env_regex.match(tox_env)
142127

143128
if tox_contrib_env_match is None:
@@ -157,30 +142,25 @@ def get_contrib_job_datas(tox_envs: list) -> list:
157142

158143
contrib_job_datas.append(
159144
{
160-
"ui_name": (
161-
f"{groups['name']}"
162-
f"{contrib_requirements}"
163-
),
145+
"ui_name": (f"{groups['name']}" f"{contrib_requirements}"),
164146
"tox_env": tox_env,
165147
}
166-
167148
)
168149

169150
return contrib_job_datas
170151

171152

172153
def get_misc_job_datas(tox_envs: list) -> list:
173-
174154
misc_job_datas = []
175155

176156
_tox_benchmark_env_regex = re_compile(r"benchmark.+")
177157

178158
for tox_env in tox_envs:
179159
if (
180-
_tox_test_env_regex.match(tox_env) is not None or
181-
_tox_lint_env_regex.match(tox_env) is not None or
182-
_tox_contrib_env_regex.match(tox_env) is not None or
183-
_tox_benchmark_env_regex.match(tox_env) is not None
160+
_tox_test_env_regex.match(tox_env) is not None
161+
or _tox_lint_env_regex.match(tox_env) is not None
162+
or _tox_contrib_env_regex.match(tox_env) is not None
163+
or _tox_benchmark_env_regex.match(tox_env) is not None
184164
):
185165
continue
186166

@@ -192,76 +172,64 @@ def get_misc_job_datas(tox_envs: list) -> list:
192172
def _generate_workflow(
193173
job_datas: list, name: str, workflow_directory_path: Path
194174
):
195-
196175
# Github seems to limit the amount of jobs in a workflow file, that is why
197176
# they are split in groups of 250 per workflow file.
198177
for file_number, job_datas in enumerate(
199178
[
200-
job_datas[index:index + 250]
179+
job_datas[index : index + 250]
201180
for index in range(0, len(job_datas), 250)
202181
]
203182
):
204-
205183
with open(
206-
workflow_directory_path.joinpath(f"{name}_{file_number}.yml"),
207-
"w"
184+
workflow_directory_path.joinpath(f"{name}_{file_number}.yml"), "w"
208185
) as test_yml_file:
209-
210186
test_yml_file.write(
211-
Environment(
212-
loader=FileSystemLoader(Path(__file__).parent)
213-
).get_template(f"{name}.yml.j2").render(
214-
job_datas=job_datas, file_number=file_number
215-
)
187+
Environment(loader=FileSystemLoader(Path(__file__).parent))
188+
.get_template(f"{name}.yml.j2")
189+
.render(job_datas=job_datas, file_number=file_number)
216190
)
217191
test_yml_file.write("\n")
218192

219193

220194
def generate_test_workflow(
221-
tox_ini_path: Path,
222-
workflow_directory_path: Path,
223-
*operating_systems
195+
tox_ini_path: Path, workflow_directory_path: Path, *operating_systems
224196
) -> None:
225-
226197
_generate_workflow(
227198
get_test_job_datas(get_tox_envs(tox_ini_path), operating_systems),
228199
"test",
229-
workflow_directory_path
200+
workflow_directory_path,
230201
)
231202

232203

233204
def generate_lint_workflow(
234205
tox_ini_path: Path,
235206
workflow_directory_path: Path,
236207
) -> None:
237-
238208
_generate_workflow(
239209
get_lint_job_datas(get_tox_envs(tox_ini_path)),
240210
"lint",
241-
workflow_directory_path
211+
workflow_directory_path,
242212
)
243213

244214

245215
def generate_contrib_workflow(
246216
workflow_directory_path: Path,
247217
) -> None:
248-
249218
_generate_workflow(
250219
get_contrib_job_datas(
251220
get_tox_envs(Path(__file__).parent.joinpath("tox.ini"))
252221
),
253222
"contrib",
254-
workflow_directory_path
223+
workflow_directory_path,
255224
)
256225

257226

258227
def generate_misc_workflow(
259228
tox_ini_path: Path,
260229
workflow_directory_path: Path,
261230
) -> None:
262-
263231
_generate_workflow(
264232
get_misc_job_datas(get_tox_envs(tox_ini_path)),
265233
"misc",
266-
workflow_directory_path
234+
workflow_directory_path,
267235
)

Diff for: .github/workflows/generate_workflows_lib/src/generate_workflows_lib/misc.yml.j2

+5-3
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,17 @@ jobs:
2323
{%- if job_data == "generate-workflows" %}
2424
if: |
2525
!contains(github.event.pull_request.labels.*.name, 'Skip generate-workflows')
26-
&& github.actor != 'opentelemetrybot' && github.event_name == 'pull_request'
26+
&& github.event.pull_request.user.login != 'opentelemetrybot' && github.event_name == 'pull_request'
2727
{%- endif %}
2828
{%- if job_data == "public-symbols-check" %}
2929
if: |
3030
!contains(github.event.pull_request.labels.*.name, 'Approve Public API check')
3131
&& github.actor != 'opentelemetrybot' && github.event_name == 'pull_request'
3232
{%- endif %}
33+
{%- if job_data == "docs" %}
34+
if: |
35+
github.event.pull_request.user.login != 'opentelemetrybot' && github.event_name == 'pull_request'
36+
{%- endif %}
3337
steps:
3438
- name: Checkout repo @ SHA - ${% raw %}{{ github.sha }}{% endraw %}
3539
uses: actions/checkout@v4
@@ -46,13 +50,11 @@ jobs:
4650
- name: Checkout pull request
4751
run: git checkout ${% raw %}{{ github.event.pull_request.head.sha }}{% endraw %}
4852
{%- endif %}
49-
{%- if job_data != "shellcheck" %}
5053

5154
- name: Set up Python 3.10
5255
uses: actions/setup-python@v5
5356
with:
5457
python-version: "3.10"
55-
{%- endif %}
5658

5759
- name: Install tox
5860
run: pip install tox

Diff for: .github/workflows/lint_0.yml

+18
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,24 @@ env:
1616

1717
jobs:
1818

19+
lint-instrumentation-openai-v2:
20+
name: instrumentation-openai-v2
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout repo @ SHA - ${{ github.sha }}
24+
uses: actions/checkout@v4
25+
26+
- name: Set up Python 3.12
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: "3.12"
30+
31+
- name: Install tox
32+
run: pip install tox
33+
34+
- name: Run tests
35+
run: tox -e lint-instrumentation-openai-v2
36+
1937
lint-resource-detector-container:
2038
name: resource-detector-container
2139
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)