Make pytorch examples UV-compatible (#39635)

* update release.py

* add uv headers in some pytorch examples

* rest of pytorch examples

* style
This commit is contained in:
Quentin Lhoest
2025-07-25 10:46:22 +02:00
committed by GitHub
parent c46c17db57
commit 91f591f7bc
42 changed files with 511 additions and 9 deletions

View File

@@ -1,4 +1,4 @@
datasets>=1.14.0
datasets[audio]>=1.14.0
evaluate
librosa
torchaudio

View File

@@ -13,6 +13,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "datasets[audio]>=1.14.0",
# "evaluate",
# "librosa",
# "torchaudio",
# "torch>=1.6",
# ]
# ///
import logging
import os
import sys

View File

@@ -12,6 +12,16 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "torch>=1.5.0",
# "torchvision>=0.6.0",
# "datasets>=1.8.0",
# ]
# ///
"""
Training a CLIP like dual encoder models using text and vision encoders in the library.

View File

@@ -12,6 +12,18 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "accelerate>=0.12.0",
# "torch>=1.5.0",
# "torchvision>=0.6.0",
# "datasets>=2.14.0",
# "evaluate",
# "scikit-learn",
# ]
# ///
import logging
import os
import sys

View File

@@ -11,6 +11,19 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "accelerate>=0.12.0",
# "torch>=1.5.0",
# "torchvision>=0.6.0",
# "datasets>=2.14.0",
# "evaluate",
# "scikit-learn",
# ]
# ///
"""Finetuning any 🤗 Transformers model for image classification leveraging 🤗 Accelerate."""
import argparse

View File

@@ -12,6 +12,15 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "torch>=1.5.0",
# "torchvision>=0.6.0",
# "datasets>=1.8.0",
# ]
# ///
import logging
import os
import sys

View File

@@ -12,6 +12,15 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "torch>=1.5.0",
# "torchvision>=0.6.0",
# "datasets>=1.8.0",
# ]
# ///
import logging
import os
import sys

View File

@@ -12,6 +12,15 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "torch>=1.5.0",
# "torchvision>=0.6.0",
# "datasets>=1.8.0",
# ]
# ///
import argparse
import logging
import math

View File

@@ -12,6 +12,17 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "albumentations >= 1.4.16",
# "timm",
# "datasets",
# "torchmetrics",
# "pycocotools",
# ]
# ///
"""Finetuning 🤗 Transformers model for instance segmentation leveraging the Trainer API."""
import logging

View File

@@ -12,6 +12,17 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "albumentations >= 1.4.16",
# "timm",
# "datasets",
# "torchmetrics",
# "pycocotools",
# ]
# ///
"""Finetuning 🤗 Transformers model for instance segmentation with Accelerate 🚀."""
import argparse

View File

@@ -12,6 +12,21 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "albumentations >= 1.4.16",
# "accelerate >= 0.12.0",
# "torch >= 1.3",
# "datasets >= 2.14.0",
# "sentencepiece != 0.1.92",
# "protobuf",
# "evaluate",
# "scikit-learn",
# ]
# ///
"""
Fine-tuning the library models for causal language modeling (GPT, GPT-2, CTRL, ...) on a text file or a dataset.

View File

@@ -12,6 +12,21 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "albumentations >= 1.4.16",
# "accelerate >= 0.12.0",
# "torch >= 1.3",
# "datasets >= 2.14.0",
# "sentencepiece != 0.1.92",
# "protobuf",
# "evaluate",
# "scikit-learn",
# ]
# ///
"""
Fine-tuning the library models for causal language modeling (GPT, GPT-2, CTRL, ...)
on a text file or a dataset without using HuggingFace Trainer.

View File

@@ -12,6 +12,21 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "albumentations >= 1.4.16",
# "accelerate >= 0.12.0",
# "torch >= 1.3",
# "datasets >= 2.14.0",
# "sentencepiece != 0.1.92",
# "protobuf",
# "evaluate",
# "scikit-learn",
# ]
# ///
"""
Fine-tuning the library models for causal language modeling using
Fill-in-the middle (FIM) objective on a text file or a dataset.

View File

@@ -12,6 +12,21 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "albumentations >= 1.4.16",
# "accelerate >= 0.12.0",
# "torch >= 1.3",
# "datasets >= 2.14.0",
# "sentencepiece != 0.1.92",
# "protobuf",
# "evaluate",
# "scikit-learn",
# ]
# ///
"""
Fine-tuning the library models for causal language modeling using
Fill-in-the middle (FIM) objective on a text file or a dataset without using HuggingFace Trainer.

View File

@@ -12,6 +12,21 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "albumentations >= 1.4.16",
# "accelerate >= 0.12.0",
# "torch >= 1.3",
# "datasets >= 2.14.0",
# "sentencepiece != 0.1.92",
# "protobuf",
# "evaluate",
# "scikit-learn",
# ]
# ///
"""
Fine-tuning the library models for masked language modeling (BERT, ALBERT, RoBERTa...) on a text file or a dataset.

View File

@@ -12,6 +12,21 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "albumentations >= 1.4.16",
# "accelerate >= 0.12.0",
# "torch >= 1.3",
# "datasets >= 2.14.0",
# "sentencepiece != 0.1.92",
# "protobuf",
# "evaluate",
# "scikit-learn",
# ]
# ///
"""
Fine-tuning the library models for masked language modeling (BERT, ALBERT, RoBERTa...)
on a text file or a dataset without using HuggingFace Trainer.

View File

@@ -12,6 +12,21 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "albumentations >= 1.4.16",
# "accelerate >= 0.12.0",
# "torch >= 1.3",
# "datasets >= 2.14.0",
# "sentencepiece != 0.1.92",
# "protobuf",
# "evaluate",
# "scikit-learn",
# ]
# ///
"""
Fine-tuning the library models for permutation language modeling.
"""

View File

@@ -12,6 +12,18 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "accelerate >= 0.12.0",
# "sentencepiece != 0.1.92",
# "protobuf",
# "torch >= 1.3",
# "evaluate",
# ]
# ///
"""
Fine-tuning the library models for multiple choice.
"""

View File

@@ -12,6 +12,18 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "accelerate >= 0.12.0",
# "sentencepiece != 0.1.92",
# "protobuf",
# "torch >= 1.3",
# "evaluate",
# ]
# ///
"""
Fine-tuning a 🤗 Transformers model on multiple choice relying on the accelerate library without using a Trainer.
"""

View File

@@ -12,6 +12,17 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "albumentations >= 1.4.16",
# "timm",
# "datasets>=4.0",
# "torchmetrics",
# "pycocotools",
# ]
# ///
"""Finetuning any 🤗 Transformers model supported by AutoModelForObjectDetection for object detection leveraging the Trainer API."""
import logging

View File

@@ -11,6 +11,18 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "albumentations >= 1.4.16",
# "timm",
# "datasets>=4.0",
# "torchmetrics",
# "pycocotools",
# ]
# ///
"""Finetuning 🤗 Transformers model for object detection with Accelerate."""
import argparse

View File

@@ -12,6 +12,18 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "datasets >= 2.0.0",
# "torch >= 1.3",
# "accelerate",
# "evaluate""
# "Pillow",
# "albumentations >= 1.4.16",
# ]
# ///
import json
import logging
import os

View File

@@ -11,6 +11,19 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "datasets >= 2.0.0",
# "torch >= 1.3",
# "accelerate",
# "evaluate""
# "Pillow",
# "albumentations >= 1.4.16",
# ]
# ///
"""Finetuning any 🤗 Transformers model supported by AutoModelForSemanticSegmentation for semantic segmentation."""
import argparse

View File

@@ -1,4 +1,4 @@
datasets >= 1.12.0
datasets[audio] >= 1.12.0
torch >= 1.5
torchaudio
accelerate >= 0.12.0

View File

@@ -12,6 +12,17 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "datasets[audio] >= 1.12.0",
# "torch >= 1.5",
# "torchaudio",
# "accelerate >= 0.12.0",
# "librosa",
# ]
# ///
"""Pre-Training a 🤗 Wav2Vec2 model on unlabeled audio data"""
import argparse

View File

@@ -1,4 +1,4 @@
datasets >= 1.18.0
datasets[audio] >= 1.18.0
torch >= 1.5
torchaudio
librosa

View File

@@ -13,6 +13,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "datasets[audio] >= 1.18.0",
# "torch >= 1.5",
# "torchaudio",
# "librosa",
# "jiwer",
# "evaluate",
# ]
# ///
"""Fine-tuning a 🤗 Transformers CTC model for automatic speech recognition"""
import functools

View File

@@ -13,6 +13,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "datasets[audio] >= 1.18.0",
# "torch >= 1.5",
# "torchaudio",
# "librosa",
# "jiwer",
# "evaluate",
# ]
# ///
"""Fine-tuning a 🤗 Transformers CTC adapter model for automatic speech recognition"""
import functools

View File

@@ -12,6 +12,19 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "datasets[audio] >= 1.18.0",
# "torch >= 1.5",
# "torchaudio",
# "librosa",
# "jiwer",
# "evaluate",
# ]
# ///
"""
Fine-tuning the library models for sequence to sequence speech recognition.
"""

View File

@@ -12,6 +12,22 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "accelerate >= 0.12.0",
# "datasets >= 1.8.0",
# "sentencepiece != 0.1.92",
# "protobuf",
# "rouge-score",
# "nltk",
# "py7zr",
# "torch >= 1.3",
# "evaluate",
# ]
# ///
"""
Fine-tuning the library models for sequence to sequence.
"""

View File

@@ -12,6 +12,22 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "accelerate >= 0.12.0",
# "datasets >= 1.8.0",
# "sentencepiece != 0.1.92",
# "protobuf",
# "rouge-score",
# "nltk",
# "py7zr",
# "torch >= 1.3",
# "evaluate",
# ]
# ///
"""
Fine-tuning a 🤗 Transformers model on summarization.
"""

View File

@@ -12,6 +12,21 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "accelerate >= 0.12.0",
# "datasets >= 1.8.0",
# "sentencepiece != 0.1.92",
# "scipy",
# "scikit-learn",
# "protobuf",
# "torch >= 1.3",
# "evaluate",
# ]
# ///
"""Finetuning the library models for text classification."""
# You can also adapt this script on your own text classification task. Pointers for this are left as comments.

View File

@@ -12,6 +12,21 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "accelerate >= 0.12.0",
# "datasets >= 1.8.0",
# "sentencepiece != 0.1.92",
# "scipy",
# "scikit-learn",
# "protobuf",
# "torch >= 1.3",
# "evaluate",
# ]
# ///
"""Finetuning the library models for sequence classification on GLUE."""
# You can also adapt this script on your own text classification task. Pointers for this are left as comments.

View File

@@ -11,6 +11,21 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "accelerate >= 0.12.0",
# "datasets >= 1.8.0",
# "sentencepiece != 0.1.92",
# "scipy",
# "scikit-learn",
# "protobuf",
# "torch >= 1.3",
# "evaluate",
# ]
# ///
"""Finetuning a 🤗 Transformers model for sequence classification on GLUE."""
import argparse

View File

@@ -13,6 +13,21 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "accelerate >= 0.12.0",
# "datasets >= 1.8.0",
# "sentencepiece != 0.1.92",
# "scipy",
# "scikit-learn",
# "protobuf",
# "torch >= 1.3",
# "evaluate",
# ]
# ///
"""Finetuning multi-lingual models on XNLI (e.g. Bert, DistilBERT, XLM).
Adapted from `examples/text-classification/run_glue.py`"""

View File

@@ -13,6 +13,17 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "accelerate >= 0.21.0",
# "sentencepiece != 0.1.92",
# "protobuf",
# "torch >= 1.3",
# ]
# ///
"""Conditional text generation with the auto-regressive models of the library (GPT/GPT-2/CTRL/Transformer-XL/XLNet)"""
import argparse

View File

@@ -12,6 +12,17 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "accelerate >= 0.21.0",
# "sentencepiece != 0.1.92",
# "protobuf",
# "torch >= 1.3",
# ]
# ///
"""The examples of running contrastive search on the auto-APIs;
Running this example:

View File

@@ -12,6 +12,18 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "accelerate >= 0.12.0",
# "seqeval",
# "datasets >= 1.8.0",
# "torch >= 1.3",
# "evaluate",
# ]
# ///
"""
Fine-tuning the library models for token classification.
"""

View File

@@ -12,6 +12,18 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "accelerate >= 0.12.0",
# "seqeval",
# "datasets >= 1.8.0",
# "torch >= 1.3",
# "evaluate",
# ]
# ///
"""
Fine-tuning a 🤗 Transformers model on token classification tasks (NER, POS, CHUNKS) relying on the accelerate library
without using a Trainer.

View File

@@ -12,6 +12,21 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "accelerate >= 0.12.0",
# "datasets >= 1.8.0",
# "sentencepiece != 0.1.92",
# "protobuf",
# "sacrebleu >= 1.4.12",
# "py7zr",
# "torch >= 1.3",
# "evaluate",
# ]
# ///
"""
Fine-tuning the library models for sequence to sequence.
"""

View File

@@ -12,6 +12,21 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "accelerate >= 0.12.0",
# "datasets >= 1.8.0",
# "sentencepiece != 0.1.92",
# "protobuf",
# "sacrebleu >= 1.4.12",
# "py7zr",
# "torch >= 1.3",
# "evaluate",
# ]
# ///
"""
Fine-tuning a 🤗 Transformers model on text translation.
"""

View File

@@ -59,6 +59,14 @@ REPLACE_PATTERNS = {
"examples": (re.compile(r'^check_min_version\("[^"]+"\)\s*$', re.MULTILINE), 'check_min_version("VERSION")\n'),
"init": (re.compile(r'^__version__\s+=\s+"([^"]+)"\s*$', re.MULTILINE), '__version__ = "VERSION"\n'),
"setup": (re.compile(r'^(\s*)version\s*=\s*"[^"]+",', re.MULTILINE), r'\1version="VERSION",'),
"uv_script_release": (
re.compile(r'^# "transformers(\[.+\])?.*$', re.MULTILINE),
r'# "transformers\g<1>==VERSION",',
),
"uv_script_dev": (
re.compile(r'^# "transformers(\[.+\])?.*$', re.MULTILINE),
r'# "transformers\g<1> @ git+https://github.com/huggingface/transformers.git",',
),
}
# This maps a type of file to its path in Transformers
REPLACE_FILES = {
@@ -66,6 +74,7 @@ REPLACE_FILES = {
"setup": "setup.py",
}
README_FILE = "README.md"
UV_SCRIPT_MARKER = "# /// script"
def update_version_in_file(fname: str, version: str, file_type: str):
@@ -86,12 +95,13 @@ def update_version_in_file(fname: str, version: str, file_type: str):
f.write(code)
def update_version_in_examples(version: str):
def update_version_in_examples(version: str, patch: bool = False):
"""
Update the version in all examples files.
Args:
version (`str`): The new version to set in the examples.
patch (`bool`, *optional*, defaults to `False`): Whether or not this is a patch release.
"""
for folder, directories, fnames in os.walk(PATH_TO_EXAMPLES):
# Removing some of the folders with non-actively maintained examples from the walk
@@ -99,6 +109,12 @@ def update_version_in_examples(version: str):
directories.remove("legacy")
for fname in fnames:
if fname.endswith(".py"):
if UV_SCRIPT_MARKER in Path(folder, fname).read_text():
# Update the depdendencies in UV scripts
uv_script_file_type = "uv_script_dev" if ".dev" in version else "uv_script_release"
update_version_in_file(os.path.join(folder, fname), version, file_type=uv_script_file_type)
if not patch:
# We don't update the version in the examples for patch releases.
update_version_in_file(os.path.join(folder, fname), version, file_type="examples")
@@ -112,9 +128,7 @@ def global_version_update(version: str, patch: bool = False):
"""
for pattern, fname in REPLACE_FILES.items():
update_version_in_file(fname, version, pattern)
if not patch:
# We don't update the version in the examples for patch releases.
update_version_in_examples(version)
update_version_in_examples(version, patch=patch)
def remove_conversion_scripts():