This is an automated email from the ASF dual-hosted git repository.
dongjoon-hyun pushed a commit to branch branch-4.x
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-4.x by this push:
new 058c20e78bb3 [SPARK-57977][PYTHON] Remove obsolete encoding
declarations from Python files
058c20e78bb3 is described below
commit 058c20e78bb30f069013cadd79d4965dc1e63480
Author: Dongjoon Hyun <[email protected]>
AuthorDate: Mon Jul 6 16:55:29 2026 -0700
[SPARK-57977][PYTHON] Remove obsolete encoding declarations from Python
files
### What changes were proposed in this pull request?
This PR removes the obsolete PEP 263 encoding declarations (`# -*- coding:
utf-8 -*-` and the `# -*- encoding: utf-8 -*-` variant) from the first line of
25 hand-written Python files.
The auto-generated protobuf files (`*_pb2.py`) are excluded because they
are regenerated by the codegen script, and their declarations are already
no-ops (placed after the license header, beyond the first two lines required by
PEP 263).
### Why are the changes needed?
Since Python 3, the default source encoding is UTF-8 ([PEP
3120](https://peps.python.org/pep-3120/)), so these declarations are redundant.
Most of the codebase already dropped them; this cleans up the remaining
stragglers for consistency.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Manual review.
**BEFORE**
```
$ git grep 'coding: utf' | grep -v 'pb2.py' | wc -l
25
```
**AFTER**
```
$ git grep 'coding: utf' | grep -v 'pb2.py' | wc -l
0
```
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Fable 5
Closes #57055 from dongjoon-hyun/SPARK-57977.
Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
(cherry picked from commit 6cb0e509bfc3b0daafdb1adc2e86bbbe5dc679db)
Signed-off-by: Dongjoon Hyun <[email protected]>
---
python/docs/source/conf.py | 1 -
python/pyspark/errors/tests/test_connect_errors_conversion.py | 1 -
python/pyspark/errors/tests/test_errors.py | 1 -
python/pyspark/instrumentation_utils.py | 1 -
python/pyspark/logger/logger.py | 1 -
python/pyspark/logger/tests/test_logger.py | 1 -
python/pyspark/ml/tests/connect/test_connect_classification.py | 1 -
python/pyspark/ml/tests/connect/test_connect_pipeline.py | 1 -
python/pyspark/ml/tests/connect/test_connect_tuning.py | 1 -
python/pyspark/ml/tests/connect/test_legacy_mode_classification.py | 1 -
python/pyspark/ml/tests/connect/test_legacy_mode_evaluation.py | 1 -
python/pyspark/ml/tests/connect/test_legacy_mode_feature.py | 1 -
python/pyspark/ml/tests/connect/test_legacy_mode_pipeline.py | 1 -
python/pyspark/ml/tests/connect/test_legacy_mode_summarizer.py | 1 -
python/pyspark/ml/tests/connect/test_legacy_mode_tuning.py | 1 -
python/pyspark/ml/tests/test_feature.py | 1 -
python/pyspark/ml/tests/test_param.py | 1 -
python/pyspark/sql/tests/test_column.py | 1 -
python/pyspark/sql/tests/test_geographytype.py | 1 -
python/pyspark/sql/tests/test_geometrytype.py | 1 -
python/pyspark/sql/tests/test_types.py | 1 -
python/pyspark/sql/tests/test_utils.py | 1 -
python/pyspark/tests/test_worker.py | 1 -
python/pyspark/tests/test_zero_copy_byte_stream.py | 1 -
python/pyspark/util.py | 1 -
25 files changed, 25 deletions(-)
diff --git a/python/docs/source/conf.py b/python/docs/source/conf.py
index ad8119fc4ae7..53e940add09e 100644
--- a/python/docs/source/conf.py
+++ b/python/docs/source/conf.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# pyspark documentation build configuration file, created by
# sphinx-quickstart on Thu Aug 28 15:17:47 2014.
diff --git a/python/pyspark/errors/tests/test_connect_errors_conversion.py
b/python/pyspark/errors/tests/test_connect_errors_conversion.py
index 6caf790cc466..d3bf96c4acb4 100644
--- a/python/pyspark/errors/tests/test_connect_errors_conversion.py
+++ b/python/pyspark/errors/tests/test_connect_errors_conversion.py
@@ -1,4 +1,3 @@
-# -*- encoding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
diff --git a/python/pyspark/errors/tests/test_errors.py
b/python/pyspark/errors/tests/test_errors.py
index 57c393be0edd..17ca6a34c6dd 100644
--- a/python/pyspark/errors/tests/test_errors.py
+++ b/python/pyspark/errors/tests/test_errors.py
@@ -1,4 +1,3 @@
-# -*- encoding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
diff --git a/python/pyspark/instrumentation_utils.py
b/python/pyspark/instrumentation_utils.py
index 9ad76c4209f8..1f822207c4af 100644
--- a/python/pyspark/instrumentation_utils.py
+++ b/python/pyspark/instrumentation_utils.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
diff --git a/python/pyspark/logger/logger.py b/python/pyspark/logger/logger.py
index 8f5cfb8628cc..8d08275fe03c 100644
--- a/python/pyspark/logger/logger.py
+++ b/python/pyspark/logger/logger.py
@@ -1,4 +1,3 @@
-# -*- encoding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
diff --git a/python/pyspark/logger/tests/test_logger.py
b/python/pyspark/logger/tests/test_logger.py
index 28bd29b1ca33..7c3fd4b1e61e 100644
--- a/python/pyspark/logger/tests/test_logger.py
+++ b/python/pyspark/logger/tests/test_logger.py
@@ -1,4 +1,3 @@
-# -*- encoding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
diff --git a/python/pyspark/ml/tests/connect/test_connect_classification.py
b/python/pyspark/ml/tests/connect/test_connect_classification.py
index 52cbc95214e8..7540c0e276a1 100644
--- a/python/pyspark/ml/tests/connect/test_connect_classification.py
+++ b/python/pyspark/ml/tests/connect/test_connect_classification.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
diff --git a/python/pyspark/ml/tests/connect/test_connect_pipeline.py
b/python/pyspark/ml/tests/connect/test_connect_pipeline.py
index f83c6b082e63..dcdc1de62d29 100644
--- a/python/pyspark/ml/tests/connect/test_connect_pipeline.py
+++ b/python/pyspark/ml/tests/connect/test_connect_pipeline.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
diff --git a/python/pyspark/ml/tests/connect/test_connect_tuning.py
b/python/pyspark/ml/tests/connect/test_connect_tuning.py
index 6acaa2e40019..21ada5443112 100644
--- a/python/pyspark/ml/tests/connect/test_connect_tuning.py
+++ b/python/pyspark/ml/tests/connect/test_connect_tuning.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
diff --git a/python/pyspark/ml/tests/connect/test_legacy_mode_classification.py
b/python/pyspark/ml/tests/connect/test_legacy_mode_classification.py
index 48283d341fab..0028feb6cce7 100644
--- a/python/pyspark/ml/tests/connect/test_legacy_mode_classification.py
+++ b/python/pyspark/ml/tests/connect/test_legacy_mode_classification.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
diff --git a/python/pyspark/ml/tests/connect/test_legacy_mode_evaluation.py
b/python/pyspark/ml/tests/connect/test_legacy_mode_evaluation.py
index 2b64a390bcd1..cc7822c43930 100644
--- a/python/pyspark/ml/tests/connect/test_legacy_mode_evaluation.py
+++ b/python/pyspark/ml/tests/connect/test_legacy_mode_evaluation.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
diff --git a/python/pyspark/ml/tests/connect/test_legacy_mode_feature.py
b/python/pyspark/ml/tests/connect/test_legacy_mode_feature.py
index 2255e8a8e4d4..de65858e2f51 100644
--- a/python/pyspark/ml/tests/connect/test_legacy_mode_feature.py
+++ b/python/pyspark/ml/tests/connect/test_legacy_mode_feature.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
diff --git a/python/pyspark/ml/tests/connect/test_legacy_mode_pipeline.py
b/python/pyspark/ml/tests/connect/test_legacy_mode_pipeline.py
index 8cbd171f6437..bc85f98619a6 100644
--- a/python/pyspark/ml/tests/connect/test_legacy_mode_pipeline.py
+++ b/python/pyspark/ml/tests/connect/test_legacy_mode_pipeline.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
diff --git a/python/pyspark/ml/tests/connect/test_legacy_mode_summarizer.py
b/python/pyspark/ml/tests/connect/test_legacy_mode_summarizer.py
index 586e356dcd2d..567f6d854d3b 100644
--- a/python/pyspark/ml/tests/connect/test_legacy_mode_summarizer.py
+++ b/python/pyspark/ml/tests/connect/test_legacy_mode_summarizer.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
diff --git a/python/pyspark/ml/tests/connect/test_legacy_mode_tuning.py
b/python/pyspark/ml/tests/connect/test_legacy_mode_tuning.py
index ac99e113c447..4a819520963b 100644
--- a/python/pyspark/ml/tests/connect/test_legacy_mode_tuning.py
+++ b/python/pyspark/ml/tests/connect/test_legacy_mode_tuning.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
diff --git a/python/pyspark/ml/tests/test_feature.py
b/python/pyspark/ml/tests/test_feature.py
index d44c8697f209..0047d0810699 100644
--- a/python/pyspark/ml/tests/test_feature.py
+++ b/python/pyspark/ml/tests/test_feature.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
diff --git a/python/pyspark/ml/tests/test_param.py
b/python/pyspark/ml/tests/test_param.py
index c6d358afc04b..fc4fa07863e2 100644
--- a/python/pyspark/ml/tests/test_param.py
+++ b/python/pyspark/ml/tests/test_param.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
diff --git a/python/pyspark/sql/tests/test_column.py
b/python/pyspark/sql/tests/test_column.py
index 28333cb3f622..143e11a922db 100644
--- a/python/pyspark/sql/tests/test_column.py
+++ b/python/pyspark/sql/tests/test_column.py
@@ -1,4 +1,3 @@
-# -*- encoding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
diff --git a/python/pyspark/sql/tests/test_geographytype.py
b/python/pyspark/sql/tests/test_geographytype.py
index fa0e93baae66..52a45c398616 100644
--- a/python/pyspark/sql/tests/test_geographytype.py
+++ b/python/pyspark/sql/tests/test_geographytype.py
@@ -1,4 +1,3 @@
-# -*- encoding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
diff --git a/python/pyspark/sql/tests/test_geometrytype.py
b/python/pyspark/sql/tests/test_geometrytype.py
index 291e41c8a4ae..074b02c45723 100644
--- a/python/pyspark/sql/tests/test_geometrytype.py
+++ b/python/pyspark/sql/tests/test_geometrytype.py
@@ -1,4 +1,3 @@
-# -*- encoding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
diff --git a/python/pyspark/sql/tests/test_types.py
b/python/pyspark/sql/tests/test_types.py
index 826c66d5a306..c1e0ee6f096a 100644
--- a/python/pyspark/sql/tests/test_types.py
+++ b/python/pyspark/sql/tests/test_types.py
@@ -1,4 +1,3 @@
-# -*- encoding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
diff --git a/python/pyspark/sql/tests/test_utils.py
b/python/pyspark/sql/tests/test_utils.py
index 3454a5f8b66c..6b7f6f3d3fbb 100644
--- a/python/pyspark/sql/tests/test_utils.py
+++ b/python/pyspark/sql/tests/test_utils.py
@@ -1,4 +1,3 @@
-# -*- encoding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
diff --git a/python/pyspark/tests/test_worker.py
b/python/pyspark/tests/test_worker.py
index 3075f21e70c7..b9ba8223a1cd 100644
--- a/python/pyspark/tests/test_worker.py
+++ b/python/pyspark/tests/test_worker.py
@@ -1,4 +1,3 @@
-# -*- encoding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
diff --git a/python/pyspark/tests/test_zero_copy_byte_stream.py
b/python/pyspark/tests/test_zero_copy_byte_stream.py
index 8c6314dac7d2..1750ffb6e154 100644
--- a/python/pyspark/tests/test_zero_copy_byte_stream.py
+++ b/python/pyspark/tests/test_zero_copy_byte_stream.py
@@ -1,4 +1,3 @@
-# -*- encoding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
diff --git a/python/pyspark/util.py b/python/pyspark/util.py
index e66f6283ead1..0d1440962f7f 100644
--- a/python/pyspark/util.py
+++ b/python/pyspark/util.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]