From cd4ea96bd12b78000b9aab52a6ecb4496657b913 Mon Sep 17 00:00:00 2001 From: Catherine Date: Fri, 1 Sep 2023 00:27:57 +0000 Subject: [PATCH] Implement RFC 19: Remove `amaranth.lib.scheduler` --- amaranth/lib/scheduler.py | 7 +++++++ docs/changes.rst | 4 ++++ tests/test_lib_scheduler.py | 5 ++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/amaranth/lib/scheduler.py b/amaranth/lib/scheduler.py index 47bc38f..84799b3 100644 --- a/amaranth/lib/scheduler.py +++ b/amaranth/lib/scheduler.py @@ -1,3 +1,10 @@ +import warnings + +warnings.warn("the `amaranth.lib.scheduler` module will be removed without a replacement; " + "copy the module into your project to continue using it", + DeprecationWarning, stacklevel=2) + + from .. import * diff --git a/docs/changes.rst b/docs/changes.rst index 50da43a..c1bce49 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -28,6 +28,7 @@ Apply the following changes to code written against Amaranth 0.3 to migrate it t * Update imports of the form ``from amaranth.vendor.some_vendor import SomeVendorPlatform`` to ``from amaranth.vendor import SomeVendorPlatform``. This change will reduce future churn. * Replace uses of ``Const.normalize(value, shape)`` with ``Const(value, shape).value``. * Replace uses of ``Repl(value, count)`` with ``value.replicate(count)``. +* Remove uses of ``amaranth.lib.scheduler.RoundRobin`` by inlining or copying the implementation of that class. While code that uses the features listed as deprecated below will work in Amaranth 0.4, they will be removed in the next version. @@ -44,6 +45,7 @@ Implemented RFCs .. _RFC 10: https://amaranth-lang.org/rfcs/0010-move-repl-to-value.html .. _RFC 15: https://amaranth-lang.org/rfcs/0015-lifting-shape-castables.html .. _RFC 18: https://amaranth-lang.org/rfcs/0018-reorganize-vendor-platforms.html +.. _RFC 19: https://amaranth-lang.org/rfcs/0019-remove-scheduler.html .. _RFC 22: https://amaranth-lang.org/rfcs/0022-valuecastable-shape.html * `RFC 1`_: Aggregate data structure library @@ -55,6 +57,7 @@ Implemented RFCs * `RFC 9`_: Constant initialization for shape-castable objects * `RFC 10`_: Move ``Repl`` to ``Value.replicate`` * `RFC 18`_: Reorganize vendor platforms +* `RFC 19`_: Remove ``amaranth.lib.scheduler`` * `RFC 15`_: Lifting shape-castable objects * `RFC 22`_: Define ``ValueCastable.shape()`` @@ -89,6 +92,7 @@ Standard library changes * Added: :mod:`amaranth.lib.enum`. (`RFC 3`_) * Added: :mod:`amaranth.lib.data`. (`RFC 1`_) * Added: :mod:`amaranth.lib.crc`. (`RFC 6`_) +* Deprecated: :mod:`amaranth.lib.scheduler`. (`RFC 19`_) Toolchain changes diff --git a/tests/test_lib_scheduler.py b/tests/test_lib_scheduler.py index c979d1c..ebfdc74 100644 --- a/tests/test_lib_scheduler.py +++ b/tests/test_lib_scheduler.py @@ -1,11 +1,14 @@ # amaranth: UnusedElaboratable=no import unittest +import warnings from amaranth.hdl import * from amaranth.asserts import * from amaranth.sim import * -from amaranth.lib.scheduler import * +with warnings.catch_warnings(): + warnings.filterwarnings(action="ignore", category=DeprecationWarning) + from amaranth.lib.scheduler import * from .utils import *