8000 Update documentation by knutnergaard · Pull Request #739 · robotools/fontParts · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Update documentation #739

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 49 commits into from
Oct 29, 2024
Merged

Update documentation #739

merged 49 commits into from
Oct 29, 2024

Conversation

knutnergaard
Copy link
Contributor
  • add type annotations and edit/add documentation to base/font.py
  • add new module for type annotation definitions: base/type.py
  • add intersphinx mapping to python 3 inventory to documentation/source/conf.py

@benkiel
Copy link
Member
benkiel commented Aug 9, 2024

Looks like fontshell.font may need to be updated here: tests are run via fontShell, fyi. Though, not sure tbh if that is the issue.

@knutnergaard
Copy link
Contributor Author

I think the issue simply is that I changed the name of the new module from types.py to type.py, as per your request, right before pushing the commit to my local branch, but forgot to update the name in the import statement in font.py. Should I file a new PR or are you able to edit the file before merging?

< 8000 div class=" timeline-comment-group js-minimizable-comment-group js-targetable-element TimelineItem-body my-0 " id="issuecomment-2278831293">
Copy link
codecov bot commented Aug 9, 2024

Codecov Report

Attention: Patch coverage is 77.04918% with 28 lines in your changes missing coverage. Please review.

Project coverage is 78.13%. Comparing base (2ac6630) to head (0d97f96).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
Lib/fontParts/base/layer.py 75.75% 23 Missing and 1 partial ⚠️
Lib/fontParts/fontshell/layer.py 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #739      +/-   ##
==========================================
- Coverage   78.30%   78.13%   -0.17%     
==========================================
  Files          41       42       +1     
  Lines        6094     6157      +63     
  Branches     1017     1028      +11     
==========================================
+ Hits         4772     4811      +39     
- Misses       1116     1138      +22     
- Partials      206      208       +2     
Files with missing lines Coverage Δ
Lib/fontParts/base/annotations.py 100.00% <100.00%> (ø)
Lib/fontParts/base/font.py 56.88% <ø> (+0.09%) ⬆️
Lib/fontParts/base/glyph.py 77.54% <ø> (+0.25%) ⬆️
Lib/fontParts/fontshell/layer.py 83.72% <0.00%> (-4.09%) ⬇️
Lib/fontParts/base/layer.py 60.95% <75.75%> (-4.40%) ⬇️

@knutnergaard
Copy link
Contributor Author
knutnergaard commented Aug 9, 2024

The error was related to a misguided attempt of mine to fix a naming issue with the defaultLayer properties. I think the names of those are reversed, compared to their status as base vs. environment related.

Anyway, reversing the changes I made, fixed the problem, and for fear of breaking something more, I haven't looked further into this, but you should definitely take a look at those properties.

@benkiel
Copy link
Member
benkiel commented Aug 12, 2024

Hey @knutnergaard, I am very sorry, I was typing far too quickly in my reply about the name for types.py: I do thing that types.py is better than type.py, the latter is going to be very confusing. Better to change it now before we merge.

@knutnergaard
Copy link
Contributor Author

Hey @knutnergaard, I am very sorry, I was typing far too quickly in my reply about the name for types.py: I do thing that types.py is better than type.py, the latter is going to be very confusing. Better to change it now before we merge.

I had some trouble with the lasts few commits from the terminal, but hopefully everything is ok now. Sorry about that!

I'll update layer.py once @typesupply gets back to me about my latest questions. :)

…methods in base/layer.py and fontshell/layer.py to return mappings to tuple.

- Update base/layer.py with doc revisions and type annotations.
- Update layer.rst accordingly.
- Fix link to fontParts.world in various .rst files.
@knutnergaard
Copy link
Contributor Author

@benkiel, In /base/layer.py at line 53 (in the _BaseGlyphVendor._setLayerInGlyph method saying "Instance of '_BaseGlyphVendor' has no 'defaultLayer' member". This missing attribute seemed like an oversight to me, so I just thought I'd mention it.

@benkiel
Copy link
Member
benkiel commented Aug 13, 2024

@knutnergaard I think that _BaseGlyphVendor._setLayerInGlyph bit is because _BaseGlyphVendor is subclassed by BaseFont which sets the logic for defaultLayer. Does that make sense?

@knutnergaard
Copy link
Contributor Author
knutnergaard commented Aug 14, 2024

@knutnergaard I think that _BaseGlyphVendor._setLayerInGlyph bit is because _BaseGlyphVendor is subclassed by BaseFont which sets the logic for defaultLayer. Does that make sense?

Yes, that makes sense, but I see this error also occurs in other cases, like here, in the BaseFont class:

def swapLayerNames(self, layerName: str, otherLayerName: str) -> None:
    ...
    self._swapLayers(layerName, otherLayerName) # Instance of 'BaseFont' has no '_swapLayers' member

I could not find any logic for _swapLayers in any other FontParts module.

BTW, after some revisions not yet committed, all type annotation and logic pass when running mypy on font.py except for these errors:

font.py:1360: error: "BaseFont" has no attribute "_swapLayers"  [attr-defined]
font.py:2017: error: Signature of "isCompatible" incompatible with supertype "InterpolationMixin"  [override]
font.py:2017: note:      Superclass:
font.py:2017: note:          def isCompatible(self, other: Any, cls: Any) -> Tuple[bool, str]
font.py:2017: note:      Subclass:
font.py:2017: note:          def isCompatible(self, other: BaseFont) -> Tuple[bool, str]
font.py:2095: error: "str" has no attribute "fatal"  [attr-defined]
font.py:2095: error: "str" has no attribute "warning"  [attr-defined]
font.py:2096: error: "str" has no attribute "fatal"  [attr-defined]
font.py:2098: error: "str" has no attribute "warning"  [attr-defined]

I've edited the line numbers to reflect my latest commit of font.py

@knutnergaard knutnergaard mentioned this pull request Aug 16, 2024
Copy link
Member
@benkiel benkiel left a comment

Choose a reason for hiding this comment

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

Changed mind about nomalizer text in docs, keeping to private methods by changing tense

@knutnergaard
Copy link
Contributor Author

Changed mind about nomalizer text in docs, keeping to private methods by changing tense

Just to be clear, should these references consistently be in the future tense in all modules?

@benkiel
Copy link
Member
benkiel commented Oct 28, 2024

@knutnergaard yes, future tense when the value obtained by the private method will be normalized in the public method, past tense when the value given to the private method has been normalized by the public method before being handed to the private method.

Hopefully that is clear (I know, confusing)

@knutnergaard knutnergaard changed the title Update documentation Update documentation, type annotations and improve code. Oct 29, 2024
@knutnergaard knutnergaard changed the title Update documentation, type annotations and improve code. Update documentation Oct 29, 2024
@knutnergaard
Copy link
Contributor Author

Apart from adding documentation 9e869d5 also adds type annotation where missing and improves code generally.

Copy link
Member
@benkiel benkiel left a comment

Choose a reason for hiding this comment

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

Just a couple of things!

@benkiel
Copy link
Member
benkiel commented Oct 29, 2024

APPROVED! Thank you so much for all this work, I know it is a lot!

@benkiel benkiel merged commit 3d67a1d into robotools:v1 Oct 29, 2024
knutnergaard added a commit to knutnergaard/fontParts that referenced this pull request Oct 30, 2024
benkiel added a commit that referenced this pull request Nov 2, 2024
* Update normalizers.rst

* Update normalizers.rst

* Update point.rst

add .. autoclass:: BasePoint to Reference section.

* Update point.rst

Correct last commit to autoclass:: BasePoint

* Update conf.py

Add intersphinx mapping to python 3 inventory.

* Add new module for type annotation definitions.

* Add type annotations and edit/add documentation.

* Update font.py

Correct import error.

* fixed name discrepancy in defaultLayer properties.

* Fix name discrepancy in defaultLayer properties.

* Add overview and reference items.

* Edit minor details.

* Change  to .

* Revert "Change  to ."

This reverts commit e7152b0.

i#

* Changed type.py to types.py and updtated font.py accordingly.

* Recommitting due to error.

* - Update _getReverseComponentMapping and _getReverseComponentMapping methods in base/layer.py and fontshell/layer.py to return mappings to tuple.
- Update base/layer.py with doc revisions and type annotations.
- Update layer.rst accordingly.
- Fix link to fontParts.world in various .rst files.

* Revise documentation.

* Add annotations.py.

* Remove types.py.

* Revise documentation.

* Fixed type annotation.

* Add documentation tools folder and module for docstring generation.

* vert "Add documentation tools folder and module for docstring generation."

This reverts commit fa52b70.

* Add docstring generation module.

* Refacor extraction of exceptions and normalizers with new CodeAnalyzer class.

* Add type annotation.

* Update fonttools from 4.53.1 to 4.54.1 (#746)

* Revise and add annotation and documentation.

- add Interpolatable protocol and compatible type variable to `annotations.py`
- add and improve annotations and documentation in `base.py`

* correct naming error.

* Add/improve documentation.

* Add documentation regarding review to `rererence` function.

* Add/improve documentation.

* Update base.py (#750)

* update docstrings of `base.reference` and `BaseBPoint.type`.

* Revise `annotations.py` with new generic container types.

* Revert "Update documentation (#739)"

This reverts commit 3d67a1d.

* Resolve merge conflicts.

* Add Sublime Text project folders.

* Add Sublime Text project folders.

* Remove unnecessary list comprehensions.

* Remove Sublime Text project files.

* Solve merge conflict.

* Resolve merge conflicts.

* Add Sublime Text project folders.

* Resolve merge conflicts.

* Resolve merge conflicts.

* Resolve merge conflicts.

* Add type aliases and improve names.

* Revise type annotation in accordance with changes in `annotations.py`

* Correct naming errors.

* Tweak error message language

* Fix type

* Remove list comprehensions

---------

Co-authored-by: pyup.io bot <github-bot@pyup.io>
Co-authored-by: Ben Kiel <ben@typefounding.com>
Co-authored-by: Ben Kiel <ben@benkiel.com>
@roberto-arista
Copy link
Contributor

👏

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.

5 participants
0