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

Feat/25 clean up workflow and schema #28

Open
wants to merge 23 commits into
base: main
Choose a base branch
from

Conversation

radishmouse
Copy link
Contributor

@radishmouse radishmouse commented Sep 30, 2024

Closes #18 #19 #23 #27 #24 #25

This PR:

@radishmouse
Copy link
Contributor Author

@aaspinwall and @MelissaAutumn - The validate_json check fails because there is no existing json/notifications.json file.
However, the convert_yaml_to_json check passes, creates the json/notifications.json, and subsequently runs the validate_json check.

Since there are no notifications, we can disregard the failing standalone validate_json check.

But also, I'm wondering: when exactly should we run the validate_json action? It is implicitly run via convert_yaml_to_json when:

  • a push is made to main and there are changes to files in yaml/
  • there is a pull request on any branch

When should we explicitly run validate_json?
Currently, it runs on any pull request.

@Sancus
Copy link
Member

Sancus commented Oct 2, 2024

General comment: There is still some 4-space indention in generate_json_schema.py but don't 2-space indent Python, it should always be 4. We probably ought to decide on a standard linter and rules for all of Python repos, something for later.

@MelissaAutumn
Copy link
Member

General comment: There is still some 4-space indention in generate_json_schema.py but don't 2-space indent Python, it should always be 4. We probably ought to decide on a standard linter and rules for all of Python repos, something for later.

For most of our projects we have ruff setup and some settings setup.
https://github.com/thunderbird/appointment/blob/main/backend/pyproject.toml#L66

I have setup in my ide to run on save and format. Works well!

Copy link
Member

@MelissaAutumn MelissaAutumn left a comment

Choose a reason for hiding this comment

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

Just some python clean up. Can you add ruff to this project and copy over appointment's ruff settings?

scripts/convert_yaml.py Outdated Show resolved Hide resolved
src/notifications/lib/notification_model.py Outdated Show resolved Hide resolved
return None

@staticmethod
def from_yaml_dir(directory):
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
def from_yaml_dir(directory):
def from_yaml_dir(directory: str) -> NotificationModel:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems like you can't use NotificationModel for the return type on this method.
Maybe because while the definition of the class is being parsed, the class doesn't exist yet?

Copy link
Member

Choose a reason for hiding this comment

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

Try making it a string. Basically lazy loads it.

src/notifications/lib/notification_model.py Outdated Show resolved Hide resolved
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.

Remove unused schema files
3 participants