Part 1
요약·해설
API maturity 전이 조건, semantic version 규칙, stable 승격, breaking-change RFC와 PR, 두 release deprecation 및 제거 절차를 다룹니다.
Experimental → Stable
RFC · Version · Migration
Deprecated · Retired
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
548658B6C1D7EF0F857A4AF4DF37179BD98DB47E0B2C8A3795F12C283FA22666
.. _api_lifecycle:
API Lifecycle
#############
Developers using Zephyr's APIs need to know how long they can trust that a
given API will not change in future releases. At the same time, developers
maintaining and extending Zephyr's APIs need to be able to introduce
new APIs that aren't yet fully proven, and to potentially retire old APIs when they're
no longer optimal or supported by the underlying platforms.
.. figure:: ../../../../develop/api/api_lifecycle.png
:align: center
:alt: API Life Cycle
:figclass: align-center
API Life Cycle
An up-to-date table of all APIs and their maturity level can be found in the
:ref:`api_overview` page.
.. _api_lifecycle_experimental:
Experimental
*************
Experimental APIs denote that a feature was introduced recently, and may change
or be removed in future versions. Try it out and provide feedback
to the community via the `Developer mailing list <https://lists.zephyrproject.org/g/devel>`_.
The following requirements apply to all new APIs:
- Documentation of the API (usage)
explaining its design and assumptions, how it is to be used, current
implementation limitations, and future potential, if appropriate.
- The API introduction should be accompanied by at least one implementation
of said API (in the case of peripheral APIs, this corresponds to one driver)
- At least one sample using the new API (may only build on one single board)
When introducing a new and experimental API, mark the API version in the headers
where the API is defined. An experimental API shall have a version where the minor
version is up to one (0.1.z). (see :ref:`api_overview`)
Peripheral APIs (Hardware Related)
==================================
When introducing an API (public header file with documentation) for a new
peripheral or driver subsystem, review of the API is enforced and is driven by
the Architecture working group consisting of representatives from different vendors.
The API shall be promoted to ``unstable`` when it has at least two
implementations on different hardware platforms.
.. _api_lifecycle_unstable:
Unstable
********
The API is in the process of settling, but has not yet had sufficient real-world
testing to be considered stable. The API is considered generic in nature and can
be used on different hardware platforms.
When the API changes status to unstable API, mark the API version in the headers
where the API is defined. Unstable APIs shall have a version where the minor
version is larger than one (0.y.z | y > 1 ). (see :ref:`api_overview`)
.. note::
Changes will not be announced.
Peripheral APIs (Hardware Related)
==================================
The API shall be promoted from ``experimental`` to ``unstable`` when it has at
least two implementations on different hardware platforms.
Hardware Agnostic APIs
=======================
For hardware agnostic APIs, multiple applications using it are required to
promote an API from ``experimental`` to ``unstable``.
.. _api_lifecycle_stable:
Stable
*******
The API has proven satisfactory, but cleanup in the underlying code may cause
minor changes. Backwards-compatibility will be maintained if reasonable.
An API can be declared ``stable`` after fulfilling the following requirements:
- Test cases for the new API with 100% coverage
- Complete documentation in code. All public interfaces shall be documented
and available in online documentation.
- The API has been in-use and was available in at least 2 development releases
- Stable APIs can get backward compatible updates, bug fixes and security fixes
at any time.
In order to declare an API ``stable``, the following steps need to be followed:
#. A Pull Request must be opened that changes the corresponding entry in the
:ref:`api_overview` table
#. An email must be sent to the ``devel`` mailing list announcing the API
upgrade request
#. The Pull Request must be submitted for discussion in the next
`Zephyr Architecture meeting`_ where, barring any objections, the Pull Request
will be merged
When the API changes status to stable API, mark the API version in the headers
where the API is defined. Stable APIs shall have a version where the major
version is one or larger (x.y.z | x >= 1 ). (see :ref:`api_overview`)
.. _breaking_api_changes:
Introducing breaking API changes
================================
A stable API, as described above, strives to remain backwards-compatible through
its life-cycle. There are however cases where fulfilling this objective prevents
technical progress, or is simply unfeasible without unreasonable burden on the
maintenance of the API and its implementation(s).
A breaking API change is defined as one that forces users to modify their
existing code in order to maintain the current behavior of their application.
The need for recompilation of applications (without changing the application
itself) is not considered a breaking API change.
In order to restrict and control the introduction of a change that breaks the
promise of backwards compatibility, the following steps must be followed whenever
such a change is considered necessary in order to accept it in the project:
#. An :ref:`RFC issue <rfcs>` must be opened on GitHub with the following
content:
.. code-block:: none
Title: RFC: Breaking API Change: <subsystem>
Contents: - Problem Description:
- Background information on why the change is required
- Proposed Change (detailed):
- Brief description of the API change
- Detailed RFC:
- Function call changes
- Device Tree changes (source and bindings)
- Kconfig option changes
- Dependencies:
- Impact to users of the API, including the steps required
to adapt out-of-tree users of the API to the change
Instead of a written description of the changes, the RFC issue may link to a
Pull Request containing those changes in code form.
#. The RFC issue must be labeled with the GitHub ``Breaking API Change`` label
#. The RFC issue must be submitted for discussion in the next `Zephyr
Architecture meeting`_
#. An email must be sent to the ``devel`` mailing list with a subject identical
to the RFC issue title and that links to the RFC issue
The RFC will then receive feedback through issue comments and will also be
discussed in the Zephyr Architecture meeting, where the stakeholders and the
community at large will have a chance to discuss it in detail.
Finally, and if not done as part of the first step, a Pull Request must be
opened on GitHub. It is left to the person proposing the change to decide
whether to introduce both the RFC and the Pull Request at the same time or to
wait until the RFC has gathered consensus enough so that the implementation can
proceed with confidence that it will be accepted.
The Pull Request must include the following:
- A title that matches the RFC issue
- A link to the RFC issue
- The actual changes to the API
- Changes to the API header file
- Changes to the API implementation(s)
- Changes to the relevant API documentation
- Changes to Device Tree source and bindings
- The changes required to adapt in-tree users of the API to the change.
Depending on the scope of this task this might require additional help from
the corresponding maintainers
- An entry in the "API Changes" section of the release notes for the next
upcoming release
- The labels ``API``, ``Breaking API Change`` and ``Release Notes``, as well as
any others that are applicable
- The label ``Architecture Review`` if the RFC was not yet discussed and agreed upon in `Zephyr
Architecture meeting`_
Once the steps above have been completed, the outcome of the proposal will
depend on the approval of the actual Pull Request by the maintainer of the
corresponding subsystem. As with any other Pull Request, the author can request
for it to be discussed and ultimately even voted on in the `Zephyr TSC meeting`_.
If the Pull Request is merged then an email must be sent to the ``devel`` and
``user`` mailing lists informing them of the change.
The API version shall be changed to signal backward incompatible changes. This
is achieved by incrementing the major version (X.y.z | X > 1). It MAY also
include minor and patch level changes. Patch and minor versions MUST be reset to
0 when major version is incremented. (see :ref:`api_overview`)
.. note::
Breaking API changes will be listed and described in the migration guide.
Deprecated
***********
.. note::
Unstable APIs can be removed without deprecation at any time.
Deprecation and removal of APIs will be announced in the "API Changes"
section of the release notes.
The following are the requirements for deprecating an existing API:
- Deprecation Time (stable APIs): 2 Releases
The API needs to be marked as deprecated in at least two full releases.
For example, if an API was first deprecated in release 1.14,
it will be ready to be removed in 1.16 at the earliest.
There may be special circumstances, determined by the Architecture working group,
where an API is deprecated sooner.
- What is required when deprecating:
- Mark as deprecated. This can be done by using the compiler itself
(``__deprecated`` for function declarations and ``__DEPRECATED_MACRO`` for
macro definitions), or by introducing a Kconfig option (typically one that
contains the ``DEPRECATED`` word in it) that, when enabled, reverts the APIs
back to their previous form
- Document the deprecation
- Include the deprecation in the "API Changes" of the release notes for the
next upcoming release
- Code using the deprecated API needs to be modified to remove usage of said
API
- The change needs to be atomic and bisectable
- Create a GitHub issue to track the removal of the deprecated API, and
add it to the roadmap targeting the appropriate release
(in the example above, 1.16).
During the deprecation waiting period, the API will be in the ``deprecated``
state. The Zephyr maintainers will track usage of deprecated APIs on
``docs.zephyrproject.org`` and support developers migrating their code. Zephyr
will continue to provide warnings:
- API documentation will inform users that the API is deprecated.
- Attempts to use a deprecated API at build time will log a warning to the
console.
Retired
*******
In this phase, the API is removed.
The target removal date is 2 releases after deprecation is announced.
The Zephyr maintainers will decide when to actually remove the API: this
will depend on how many developers have successfully migrated from the
deprecated API, and on how urgently the API needs to be removed.
If it's OK to remove the API, it will be removed. The maintainers will remove
the corresponding documentation, and communicate the removal in the usual ways:
the release notes, mailing lists, Github issues and pull-requests.
If it's not OK to remove the API, the maintainers will continue to support
migration and update the roadmap with the aim to remove the API in the next
release.
.. _`Zephyr TSC meeting`: https://github.com/zephyrproject-rtos/zephyr/wiki/Zephyr-Committee-and-Working-Group-Meetings#technical-steering-committee-tsc
.. _`Zephyr Architecture meeting`: https://github.com/zephyrproject-rtos/zephyr/wiki/Architecture-Working-Group
Part 3
한국어 전문 번역
API lifecycle
Zephyr API를 사용하는 developer는 특정 API가 future release에서도 바뀌지 않을 것이라고 얼마나 오래 믿을 수 있는지 알아야 합니다. 동시에 Zephyr API를 유지보수하고 확장하는 developer는 아직 충분히 검증되지 않은 새 API를 도입하고, 더는 최적이 아니거나 underlying platform이 지원하지 않는 오래된 API를 폐기할 수 있어야 합니다.

모든 API와 현재 maturity level의 최신 표는 API Overview에서 확인할 수 있습니다.
Experimental
Experimental API는 feature가 최근 도입되어 future version에서 바뀌거나 제거될 수 있음을 뜻합니다. 직접 사용해 보고 Developer mailing list로 community에 feedback을 제공하십시오.
모든 새 API에는 다음 요구 사항이 적용됩니다.
- Design과 가정, 사용 방법, 현재 implementation limitation, 적절한 경우 future potential까지 설명하는 API usage documentation
- API 도입과 함께 제공하는 최소 한 개의 implementation. Peripheral API라면 driver 하나에 해당합니다.
- 새 API를 사용하는 sample 최소 한 개. 단 하나의 board에서만 build되어도 됩니다.
새 experimental API를 도입할 때 API가 정의된 header에 version을 표시합니다. Experimental API의 minor version은 최대 1인 0.1.z여야 합니다.
Peripheral API(hardware 관련)
새 peripheral 또는 driver subsystem의 API, 즉 documentation이 있는 public header file을 도입하면 여러 vendor representative로 구성된 Architecture Working Group이 API review를 주도하고 강제합니다.
서로 다른 hardware platform에 implementation이 최소 두 개 생기면 API를 unstable로 승격해야 합니다.
Unstable
API가 정착하는 과정에 있지만 stable로 간주할 만큼 real-world test를 충분히 거치지 않은 상태입니다. API는 본질적으로 generic하며 서로 다른 hardware platform에서 사용할 수 있다고 봅니다.
상태를 unstable로 바꿀 때 API가 정의된 header에 version을 표시합니다. Unstable API의 minor version은 1보다 큰 0.y.z | y > 1여야 합니다.
Peripheral API(hardware 관련)
서로 다른 hardware platform에 implementation이 최소 두 개 생기면 API를 experimental에서 unstable로 승격해야 합니다.
Hardware 비종속 API
Hardware에 종속되지 않은 API를 experimental에서 unstable로 승격하려면 그 API를 사용하는 application이 여러 개 있어야 합니다.
Stable
API가 만족스럽다는 것이 입증됐지만 underlying code 정리로 사소한 변경이 생길 수 있습니다. 합리적인 경우 backward compatibility를 유지합니다.
stable로 선언하려면 다음 요구 사항을 충족해야 합니다.
- 새 API test case의 coverage가 100%일 것
- Code documentation이 완전하고 모든 public interface가 문서화되어 online documentation에서 제공될 것
- API가 실제로 사용됐으며 최소 두 번의 development release에서 제공됐을 것
- Backward-compatible update, bug fix, security fix는 언제든 stable API에 적용할 수 있음
stable 선언 절차:
- API Overview 표의 해당 entry를 바꾸는 Pull Request를 엽니다.
develmailing list에 API upgrade 요청을 알리는 email을 보냅니다.- Pull Request를 다음 Zephyr Architecture meeting의 discussion 대상으로 제출하고 반대가 없으면 merge합니다.
상태를 stable로 바꿀 때 API가 정의된 header에 version을 표시합니다. Stable API major version은 1 이상인 x.y.z | x >= 1이어야 합니다.
호환성을 깨는 API 변경 도입
Stable API는 lifecycle 전체에서 backward-compatible 상태를 유지하려고 합니다. 하지만 이 목표가 기술 발전을 막거나 API와 implementation 유지보수에 불합리한 부담을 주어 실현할 수 없는 경우도 있습니다.
Breaking API change는 application의 현재 동작을 유지하기 위해 사용자가 기존 code를 수정하도록 강제하는 변경입니다. Application 자체는 바꾸지 않고 다시 compile하기만 하면 되는 경우는 breaking API change로 보지 않습니다.
Backward compatibility 약속을 깨는 변경의 도입을 제한하고 통제하기 위해, 필요하다고 판단한 변경을 project가 수락하려면 다음 절차를 따라야 합니다.
- RFC issue를 GitHub에 열고 다음 내용을 포함합니다.
변경을 글로 설명하는 대신 실제 code 변경이 있는 Pull Request를 RFC issue에서 link할 수도 있습니다.Title: RFC: Breaking API Change: <subsystem> Contents: - Problem Description: - Background information on why the change is required - Proposed Change (detailed): - Brief description of the API change - Detailed RFC: - Function call changes - Device Tree changes (source and bindings) - Kconfig option changes - Dependencies: - Impact to users of the API, including the steps required to adapt out-of-tree users of the API to the change - RFC issue에 GitHub
Breaking API Changelabel을 붙입니다. - RFC issue를 다음 Zephyr Architecture meeting의 discussion 대상으로 제출합니다.
develmailing list에 RFC issue title과 똑같은 subject를 사용하고 RFC issue link를 담은 email을 보냅니다.
RFC는 issue comment로 feedback을 받고 Zephyr Architecture meeting에서도 논의합니다. Stakeholder와 전체 community가 세부 내용을 토론할 기회를 얻습니다.
첫 단계에서 만들지 않았다면 마지막으로 GitHub Pull Request를 열어야 합니다. 변경 제안자가 RFC와 PR을 동시에 낼지, RFC가 충분한 consensus를 얻어 구현이 수락될 것이라는 확신이 생길 때까지 기다릴지 결정합니다.
Pull Request에는 다음을 포함해야 합니다.
- RFC issue와 일치하는 title
- RFC issue link
- 실제 API 변경:
- API header file 변경
- API implementation 변경
- 관련 API documentation 변경
- Devicetree source와 binding 변경
- Tree 내부 API 사용자를 변경에 맞게 고치는 데 필요한 수정. 범위에 따라 해당 maintainer의 추가 도움이 필요할 수 있습니다.
- 다음 upcoming release의 release note에 있는 ‘API Changes’ section entry
API,Breaking API Change,Release Noteslabel과 적용 가능한 다른 label- RFC가 Zephyr Architecture meeting에서 아직 논의되고 합의되지 않았다면
Architecture Reviewlabel
위 절차가 끝나면 proposal 결과는 해당 subsystem maintainer가 실제 Pull Request를 승인하는지에 달려 있습니다. 다른 PR과 마찬가지로 author는 Zephyr TSC meeting에서 논의하고 필요하면 표결해 달라고 요청할 수 있습니다.
Pull Request가 merge되면 devel과 user mailing list에 변경을 알리는 email을 보내야 합니다.
Backward-incompatible change를 나타내도록 API version의 major version을 증가시켜 X.y.z | X > 1로 만듭니다. Minor와 patch level도 함께 바꿀 수 있지만 major version을 올릴 때 patch와 minor version은 반드시 0으로 reset해야 합니다.
Deprecated
기존 API를 deprecate하기 위한 요구 사항:
- Deprecation 기간(stable API)은 두 release입니다. API는 완전한 release 최소 두 번 동안 deprecated로 표시해야 합니다. 예를 들어 release 1.14에서 처음 deprecate한 API는 빨라도 1.16에서 제거할 수 있습니다. Architecture Working Group이 특별한 사정이 있다고 판단하면 더 일찍 deprecate할 수 있습니다.
- Deprecate할 때 필요한 조치:
__deprecatedfunction declaration이나__DEPRECATED_MACROmacro definition으로 compiler가 표시하게 하거나, 활성화하면 API를 이전 형태로 되돌리는DEPRECATED이름의 Kconfig option을 도입합니다.- Deprecation을 documentation에 기록합니다.
- 다음 upcoming release의 release note ‘API Changes’에 deprecation을 포함합니다.
- Deprecated API를 쓰는 code를 수정해 해당 API 사용을 제거합니다.
- 변경은 atomic하고 bisectable해야 합니다.
- Deprecated API 제거를 추적할 GitHub issue를 만들고 적절한 release를 target으로 roadmap에 추가합니다. 위 예에서는 1.16입니다.
Deprecation 대기 기간 동안 API는 deprecated 상태입니다. Zephyr maintainer는 docs.zephyrproject.org에서 deprecated API 사용을 추적하고 developer의 code migration을 지원합니다. Zephyr는 계속 warning을 제공합니다.
- API documentation에서 API가 deprecated임을 알립니다.
- Build할 때 deprecated API 사용을 시도하면 console에 warning을 기록합니다.
Retired
이 단계에서는 API를 제거합니다.
목표 제거 시점은 deprecation 공지 뒤 두 release입니다. 실제 제거 시점은 deprecated API에서 migration에 성공한 developer 수와 API를 얼마나 긴급히 제거해야 하는지에 따라 Zephyr maintainer가 결정합니다.
API를 제거해도 괜찮다면 제거하고 해당 documentation도 지우며 release note, mailing list, GitHub issue와 Pull Request라는 일반 경로로 제거 사실을 알립니다.
아직 제거하면 안 된다면 maintainer가 migration 지원을 계속하고 다음 release 제거를 목표로 roadmap을 갱신합니다.
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.