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

Expose submodules and add type annotations #67

Closed
wants to merge 3 commits into from

Conversation

MichaelJFishman
Copy link
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
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
Copy link
Owner

@tomsilver tomsilver left a comment

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
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
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
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

@@ -99,6 +99,7 @@ def _create_preconds_pddl_str(self, preconds):
class PDDLParser:
"""PDDL parsing class.
"""
predicates: Dict[str, Predicate]
Copy link
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
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
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
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
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