Skip to content

Conversation

@knutnergaard
Copy link
Contributor

@knutnergaard knutnergaard commented May 30, 2025

Rationale

BaseLib allows nested collection types (list, tuple and dict. Because of this, the type alias LibValueType has to use forward references as strings:

LibValueType = Union[
    str,
    IntFloatType,
    bool,
    CollectionType["LibValueType"],
    Dict[str, "LibValueType"],
    bytes,
    bytearray,
    datetime.datetime,
]

Sphinx, in turn, will not resolve correctly in the generated documentation.

Solution

  • Add a LibValue class to base.annotations purely for the purpose of documenting these types.
  • Replace the type alias with a reference to this class via autodoc_type_aliases in conf.py
  • Generate documentation for the LibValue class in objectref/valuetypes/index.rst.

Alternate Name

BaseLibValue might be a more appropriate name for this class.

@codecov
Copy link

codecov bot commented May 30, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.57%. Comparing base (907ad0d) to head (aca9844).
Report is 1 commits behind head on v1.

Additional details and impacted files
@@           Coverage Diff           @@
##               v1     #836   +/-   ##
=======================================
  Coverage   76.56%   76.57%           
=======================================
  Files          42       42           
  Lines        6444     6445    +1     
  Branches      963      963           
=======================================
+ Hits         4934     4935    +1     
  Misses       1273     1273           
  Partials      237      237           
Files with missing lines Coverage Δ
Lib/fontParts/base/annotations.py 89.28% <100.00%> (+0.39%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@knutnergaard
Copy link
Contributor Author

knutnergaard commented May 31, 2025

@benkiel I can't explain the mypy error, but it should be fine.

@benkiel
Copy link
Member

benkiel commented Jun 10, 2025

LibValue seems fine as a name

@benkiel benkiel merged commit 376fc53 into robotools:v1 Jun 10, 2025
11 of 12 checks passed
@knutnergaard knutnergaard deleted the lib-value branch June 10, 2025 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants