Skip to content
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

Added typestring parser checker #1402

Merged
merged 31 commits into from May 7, 2021

Conversation

Nikhil0504
Copy link
Contributor

@Nikhil0504 Nikhil0504 commented Apr 24, 2021

Changelog / Overview

Added typestring-parser

Motivation

Now the contributors can check if their typestrings are correct more easily.

Explanation for Changes

This could lessen the reviews and can PR's can be done faster. For first-timers, this would save them a lot of time as they could check here directly without going through many websites on whether they are correct or not.

Testing Status

Further Comments

Closes #1394

Checklist

  • I have read the Contributing Guidelines
  • I have written a descriptive PR title (see top of PR template for examples)
  • I have written a changelog entry for the PR or deem it unnecessary
  • My new functions/classes either have a docstring or are private
  • My new functions/classes have tests added and (optional) examples in the docs
  • My new documentation builds, looks correctly formatted, and adds no additional build warnings

Reviewer Checklist

  • The PR title is descriptive enough
  • The PR is labeled correctly
  • The changelog entry is completed if necessary
  • Newly added functions/classes either have a docstring or are private
  • Newly added functions/classes have tests added and (optional) examples in the docs
  • Newly added documentation builds, looks correctly formatted, and adds no additional build warnings

@Nikhil0504
Copy link
Contributor Author

@MrMallIronmaker can you check what the error is?

@markromanmiller
Copy link
Collaborator

Nikhil - Thanks for the work you've been doing with the repo the past couple of days. I wanted to mention a couple things about communication, though.

First, I don't think I needed a ping on this issue. While I did reply to the original Discord comment, I don't have any special knowledge about doctypes or the module. Any member of the dev team could be equally suited for this question.

Second, I expected a more informative question than "can you check what the error was." Depending on how much experience you have with Github, CI, RTD, etc, I think good questions would be "How can I see what the problem was?" or "Why is RTD trying to run the code in my docs?" or "It works on my machine, why is it different here?" All of these questions are much more specific, so they show that you've put in the legwork in trying to teach yourself, they inform me a lot better about your experience so far, and they help me compose a better answer to your question.

I do appreciate your enthusiasm, and this message is one of those social norms to learn as you're getting started with FOSS and community software development, and in particular development with Manim.

@Nikhil0504
Copy link
Contributor Author

Nikhil0504 commented Apr 25, 2021

I am actually getting an error because typestring-parser isn't being recognized in the docs as it is not being downloaded via pip.
Maybe someone can tell where should I put this package to be installed as it is not being installed from requirements.txt

Logs:

File "contributing/documentation.rst", line ?, in default
Failed example:
    from typestring_parser import parse
Exception raised:
    Traceback (most recent call last):
      File "/opt/hostedtoolcache/Python/3.7.10/x64/lib/python3.7/doctest.py", line 1337, in __run
        compileflags, 1), test.globs)
      File "<doctest default[0]>", line 1, in <module>
        from typestring_parser import parse
    ModuleNotFoundError: No module named 'typestring_parser

@markromanmiller
Copy link
Collaborator

Oh sorry, I realized I misspoke in my message earlier. I still think we should not add a dependency for a single section of the docs. The solution would not be live code to be run by the docstring engine but rather a handful of examples in the text itself.

For future reference, the right place to add it to the list is the pyproject.toml file.

Copy link
Collaborator

@markromanmiller markromanmiller left a comment

Choose a reason for hiding this comment

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

This addition looks good, let me know when you address the smaller changes.

@@ -2,4 +2,4 @@ Sphinx==3.1.2
furo
recommonmark>=0.5.0
sphinx-copybutton
sphinxext-opengraph
Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like this line didn't actually change; can you checkout the old requirements.txt so that this file doesn't have a change here?

docs/source/contributing/documentation.rst Outdated Show resolved Hide resolved
@kolibril13 kolibril13 added the documentation Improvements or additions to documentation label Apr 27, 2021
@markromanmiller
Copy link
Collaborator

It looks like "testsetup" gets rendered into the document. Is this intentional?

Screenshot from 2021-04-27 12-58-13

@RickyC0626
Copy link
Contributor

It looks like "testsetup" gets rendered into the document. Is this intentional?

I don't think so, maybe removing Example will help.

Copy link
Collaborator

@markromanmiller markromanmiller left a comment

Choose a reason for hiding this comment

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

lgtm, i can squash and merge this in a bit

Comment on lines 330 to 337
>>> parse('int')
<class 'int'>
>>> parse('int or str')
typing.Union[int, str]
>>> parse('list of str or str')
typing.Union[typing.List[str], str]
>>> parse('list of (int, str)')
typing.List[typing.Tuple[int, str]]
Copy link
Member

Choose a reason for hiding this comment

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

this doesn't render properly with syntax highlighting
image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No let's not have it as it just makes the CI fail.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would think there's some way to have a code block highlighted in the documentation, but not run - right? @naveen521kk

If not, this is definitely not a breaking change.

Copy link
Member

Choose a reason for hiding this comment

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

@Nikhil0504 I know how to do this without breaking things, but I want you to search or rather explore to find things out.
You can easily add syntax highlighting, browse through though how it is done in other parts of manim itself or look at the reStructuredText Primer from sphinx or search the internet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey, I tried fixing the issue and couldn't find a solution for it. Is it possible for you to fix it?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Collaborator

@markromanmiller markromanmiller left a comment

Choose a reason for hiding this comment

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

requesting changes to enable syntax highlighting

@Nikhil0504
Copy link
Contributor Author

Nikhil0504 commented May 1, 2021

be accessed by first downloading it via ``pip`` - ``pip install typestring-parser`` and
then using ``from typestring_parser import parse``.

.. code-block:: bash
Copy link
Member

Choose a reason for hiding this comment

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

how is the below code bash? It's python.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We use it under bash or cmd so it's not python right?

Copy link
Member

Choose a reason for hiding this comment

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

Again, see how this is done in other places. It's obviously not bash.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made another change and checked locally which passed but over here the pre commit is failing

@Nikhil0504
Copy link
Contributor Author

All checks have passed and I removed the bash Code which was changed to a doctest block

@@ -318,6 +318,24 @@ elements that are either a ``str`` or ``None``;
``(str, int)``; ``Tuple[:class:`int`, ...]`` for a tuple of variable
length with only integers.

.. note::
As a helper for tool for typesets, you can use ``typestring-parser``: https://github.com/Dominik1123/typestring-parser
Copy link
Member

Choose a reason for hiding this comment

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

rather than pasting the link near typestring-parser make that clickable.

Copy link
Collaborator

@markromanmiller markromanmiller left a comment

Choose a reason for hiding this comment

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

docs are looking good to me.

Copy link
Member

@naveen521kk naveen521kk left a comment

Choose a reason for hiding this comment

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

sgtm

@markromanmiller
Copy link
Collaborator

@Nikhil0504 we can't merge until it's up-to-date, and we can't update the branch. Did you disable edits from maintainers on this branch?

@Nikhil0504
Copy link
Contributor Author

I gave the access and made the branch up to date.

@markromanmiller markromanmiller merged commit 1746073 into ManimCommunity:master May 7, 2021
@Nikhil0504 Nikhil0504 deleted the typestring_parser branch May 7, 2021 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Addition of typestring parser checker
7 participants