Skip to content

Expose submodules and add type annotations - #67

Closed
MichaelJFishman wants to merge 3 commits into
tomsilver:masterfrom
MichaelJFishman:typehints
Closed

Expose submodules and add type annotations#67
MichaelJFishman wants to merge 3 commits into
tomsilver:masterfrom
MichaelJFishman:typehints

Conversation

@MichaelJFishman

Copy link
Copy Markdown
Contributor

Description

Make the core, structs, and spaces modules available for import. This allows importing libraries to use the contained classes for type annotations.

Add some (not all) type annotations.

Tests

Ran each test file in pddlgym/tests. They all passed.

Type annotations
More type annotations
@MichaelJFishman
MichaelJFishman marked this pull request as draft December 29, 2022 21:57
@MichaelJFishman

Copy link
Copy Markdown
Contributor Author

Converted to a draft while I test the new commit.

@MichaelJFishman
MichaelJFishman marked this pull request as ready for review December 29, 2022 22:08

@tomsilver tomsilver left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks so much for doing this. Looks broadly good but I want to take a closer look before merging and @ronuchit may too. To make it a little easier to review, would you mind splitting this into at least three PRs:

  1. exposing the submodules
  2. changing the tests to unittests
  3. adding type annotations

@@ -0,0 +1,11 @@
# import os

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

remove this file or uncomment?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oops, will remove 😅

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks so much for doing this. Looks broadly good but I want to take a closer look before merging and @ronuchit may too. To make it a little easier to review, would you mind splitting this into at least three PRs:

  1. exposing the submodules
  2. changing the tests to unittests
  3. adding type annotations

Sure! I'll link those here once they exist and ping you.

Unittests: #68

Expose submodules: #69

Type annotations: #70

Comment thread pddlgym/parser.py
class PDDLParser:
"""PDDL parsing class.
"""
predicates: Dict[str, Predicate]

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

what's up with this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I misread predicates as being set in one of PDDLParser's methods, I think, and just set the type def at the top of the class def.

Looking back at the code, predicates is actually set separately in PDDLProblemParser and PDDLDomainParser.

We could

  1. set the type hint in the parent PDDLParser class for both of them
  2. Set it separately in each
    1. For PDDLDomainParser, predicates is set in _parse_domain_predicates, rather than the init itself. We could either set the type hint in _parse_domain_predicates, or the top of the class, like I did here (but for PDDLDomainParser.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

But we can handle that in the split out PR.

@MichaelJFishman

Copy link
Copy Markdown
Contributor Author

Thanks so much for doing this. Looks broadly good but I want to take a closer look before merging and @ronuchit may too. To make it a little easier to review, would you mind splitting this into at least three PRs:

  1. exposing the submodules
  2. changing the tests to unittests
  3. adding type annotations

Sure! I'll link those here once they exist and ping you.

This was referenced Dec 30, 2022
@MichaelJFishman

Copy link
Copy Markdown
Contributor Author

unittests: #68

expose submodules: #69

type annotations: #70

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