Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .changelog/5491.changed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`opentelemetry-python`: enable Ruff default ruleset and fix auto-fixable lint issues
41 changes: 9 additions & 32 deletions .github/workflows/generate_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
r"(?P<name>[-\w]+\w)-?(?P<test_requirements>\d+)?"
)
_tox_lint_env_regex = re_compile(r"lint-(?P<name>[-\w]+)")
_tox_contrib_env_regex = re_compile(
r"py310-test-(?P<name>[-\w]+\w)-?(?P<contrib_requirements>\d+)?"
)
_tox_contrib_env_regex = re_compile(r"py310-test-(?P<name>[-\w]+\w)-?(?P<contrib_requirements>\d+)?")


def get_tox_envs(tox_ini_path: Path) -> list:
Expand All @@ -25,9 +23,7 @@ def get_tox_envs(tox_ini_path: Path) -> list:

tox_section = next(tox_ini.sections())

core_config_set = CoreConfigSet(
conf, tox_section, tox_ini_path.parent, tox_ini_path
)
core_config_set = CoreConfigSet(conf, tox_section, tox_ini_path.parent, tox_ini_path)

(
core_config_set.loaders.extend(
Expand Down Expand Up @@ -67,9 +63,7 @@ def get_test_job_datas(tox_envs: list, operating_systems: list) -> list:

groups = tox_test_env_match.groupdict()

aliased_python_version = python_version_alias[
groups["python_version"]
]
aliased_python_version = python_version_alias[groups["python_version"]]
tox_env = tox_test_env_match.string

test_requirements = groups["test_requirements"]
Expand All @@ -84,10 +78,7 @@ def get_test_job_datas(tox_envs: list, operating_systems: list) -> list:
{
"name": f"{tox_env}_{operating_system}",
"ui_name": (
f"{groups['name']}"
f"{test_requirements}"
f"{aliased_python_version} "
f"{os_alias[operating_system]}"
f"{groups['name']}{test_requirements}{aliased_python_version} {os_alias[operating_system]}"
),
"python_version": aliased_python_version,
"tox_env": tox_env,
Expand Down Expand Up @@ -128,21 +119,15 @@ def get_misc_job_datas(tox_envs: list) -> list:
re_compile(r"benchmark.+"),
]

return [
tox_env
for tox_env in tox_envs
if not any(pattern.match(tox_env) for pattern in regex_patterns)
]
return [tox_env for tox_env in tox_envs if not any(pattern.match(tox_env) for pattern in regex_patterns)]


def _generate_workflow(
job_datas: list,
template_name: str,
output_dir: Path,
) -> None:
env = Environment(
loader=FileSystemLoader(Path(__file__).parent.joinpath("templates"))
)
env = Environment(loader=FileSystemLoader(Path(__file__).parent.joinpath("templates")))
with open(output_dir.joinpath(f"{template_name}.yml"), "w") as yml_file:
yml_file.write(
env.get_template(f"{template_name}.yml.j2").render(
Expand All @@ -152,9 +137,7 @@ def _generate_workflow(
yml_file.write("\n")


def generate_test_workflow(
tox_ini_path: Path, workflow_directory_path: Path, operating_systems
) -> None:
def generate_test_workflow(tox_ini_path: Path, workflow_directory_path: Path, operating_systems) -> None:
_generate_workflow(
get_test_job_datas(get_tox_envs(tox_ini_path), operating_systems),
"test",
Expand Down Expand Up @@ -189,11 +172,7 @@ def generate_ci_workflow(
) -> None:
with open(output_dir.joinpath("ci.yml"), "w") as ci_yml_file:
ci_yml_file.write(
Environment(
loader=FileSystemLoader(
Path(__file__).parent.joinpath("templates")
)
)
Environment(loader=FileSystemLoader(Path(__file__).parent.joinpath("templates")))
.get_template("ci.yml.j2")
.render()
)
Expand All @@ -203,9 +182,7 @@ def generate_ci_workflow(
if __name__ == "__main__":
tox_ini_path = Path(__file__).parent.parent.parent.joinpath("tox.ini")
output_dir = Path(__file__).parent
generate_test_workflow(
tox_ini_path, output_dir, ["ubuntu-latest", "windows-latest"]
)
generate_test_workflow(tox_ini_path, output_dir, ["ubuntu-latest", "windows-latest"])
generate_lint_workflow(tox_ini_path, output_dir)
generate_misc_workflow(tox_ini_path, output_dir)
generate_ci_workflow(output_dir)
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ indent-after-paren=4
indent-string=' '

# Maximum number of characters on a single line.
max-line-length=79
max-line-length=120

# Maximum number of lines in a module.
max-module-lines=1000
Expand Down
4 changes: 1 addition & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -554,9 +554,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
from opentelemetry.sdk._logs import ReadableLogRecord


def export(
self, batch: Sequence[ReadableLogRecord]
) -> LogRecordExportResult: ...
def export(self, batch: Sequence[ReadableLogRecord]) -> LogRecordExportResult: ...
```

- **For Log Processors:** Use `ReadWriteLogRecord` for processing, `ReadableLogRecord` for exporting
Expand Down
Loading