Skip to content

Explained import shortcuts in API design documentation#1281

Open
stevepiercy wants to merge 4 commits intomainfrom
1161-explain-black-magic
Open

Explained import shortcuts in API design documentation#1281
stevepiercy wants to merge 4 commits intomainfrom
1161-explain-black-magic

Conversation

@stevepiercy
Copy link
Member

@stevepiercy stevepiercy commented Mar 16, 2026

Closes #1161

Description

Explained import shortcuts in API design documentation.

Checklist

  • I've added a change log entry to CHANGES.rst.
  • I've added or updated tests if applicable.
  • I've run and ensured all tests pass locally by following Run tests.
  • I've added or edited documentation, both as docstrings to be rendered in the API documentation and narrative documentation, as necessary.

📚 Documentation preview 📚: https://icalendar--1281.org.readthedocs.build/

@coveralls
Copy link

coveralls commented Mar 16, 2026

Pull Request Test Coverage Report for Build 23378472901

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.008%) to 97.965%

Files with Coverage Reduction New Missed Lines %
src/icalendar/cli.py 1 94.74%
Totals Coverage Status
Change from base Build 23377264062: -0.008%
Covered Lines: 11751
Relevant Lines: 11989

💛 - Coveralls
The preferred way to access their values is through lower case properties as described in :ref:`property-access`.
Advantages and disadvantages of the other approaches are discussed below.

As a convenience, icalendar offers shortcuts to import its classes instead of using their fully qualified Python path.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The interface that should be used is from icalendar import X. That is the stable, public interface. From icalendar.Y import X is discouraged.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in b3127aa.

Comment on lines +21 to +23
icalendar builds components and subcomponents.
It then adds, modifies, or removes properties to components and subcomponents, all within the RFC requirements.
This is done in the :doc:`prop <../reference/api/icalendar.prop>` module.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a development reference, I would add that for resposibility clarity. This is not quite right though and I would remove this or clarify the intention of why this us needed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's required because you can't understand properties without an understanding of components and subcomponents. Modified in b3127aa.


.. _import-shortcuts:

Import shortcuts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this section is right and still needs a focus on the !do not import from icalender subpackages! Then, it would be more suitable.in the design decisions document as it has nothing to do with the decisions around how components relate to the rfc.

how components relate and map to the rfcs is the focus of this document.

Import shortcuts are a Python API structuring for maintenance and development and stability.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This document describes the API design. It's an explanation of the reasoning behind the choices made. This section is an explanation of both how and why you implemented shorter imports. Where else would it go, beside API design?

Copy link
Member Author

@stevepiercy stevepiercy Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, this file doesn't belong in reference, but should be moved into a new section, explanation, to align with Diátaxis. It's not at all like a dictionary, glossary, or API reference, but more of an explanation of the design decisions. We have nothing that explains choices made at this time. What do you think? See https://diataxis.fr/reference-explanation/.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right! That makes total sense... It is an explanation

@read-the-docs-community
Copy link

read-the-docs-community bot commented Mar 19, 2026

Documentation build overview

📚 icalendar | 🛠️ Build #31907961 | 📁 Comparing be241b0 against latest (a73f4d3)


🔍 Preview build

Show files changed (5 files in total): 📝 5 modified | ➕ 0 added | ➖ 0 deleted
File Status
404.html 📝 modified
genindex.html 📝 modified
reference/changelog.html 📝 modified
reference/component-api.html 📝 modified
reference/index.html 📝 modified
@niccokunzmann
Copy link
Member

Let me know when I should have a look again! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants