Skip to content

Conversation

amolenaar
Copy link
Member

@amolenaar amolenaar commented Jan 19, 2024

PR Type

What kind of change does this PR introduce?

  • Bug fix
  • Feature
  • Chore (refactoring, formatting, local variables, other cleanup)
  • Documentation content changes

What is the current behavior?

If you install Gaphor from PyPI, it's not possible to install the GSettings schema.

Gaphor tells you to run poe install-schemas, but that only works if you checked out the code from GitHub.

Issue Number: N/A

What is the new behavior?

Install the GSettings schema with gaphor install-schemas.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@amolenaar amolenaar requested a review from danyeaw January 19, 2024 20:37
@github-actions github-actions bot added the python Pull requests that update Python code label Jan 19, 2024
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

PR Type: Enhancement

PR Summary: This pull request introduces a new feature that allows users to install the GSettings schema for Gaphor via a new subcommand gaphor install-schemas. This addresses the issue where users who install Gaphor from PyPI cannot install the GSettings schema, as the previous instructions were only applicable to users who checked out the code from GitHub.

Decision: Comment

📝 Type: 'Enhancement' - not supported yet.
  • Sourcery currently only approves 'Typo fix' PRs.
✅ Issue addressed: this change correctly addresses the issue or implements the desired feature.
No details provided.
📝 Complexity: the changes are too large or complex for Sourcery to approve.
  • Unsupported files: the diff contains files that Sourcery does not currently support during reviews.

General suggestions:

  • Consider implementing a more robust check for the 'install-schemas' argument in sys.argv to avoid potential unexpected behavior if additional arguments contain this substring.
  • Verify that the change in the warning message's quotation marks from single quotes to backticks is consistent with the application's documentation and other messages.
  • It may be beneficial to include a Python snippet in the docstring that demonstrates how to use the install_schemas_command programmatically, in addition to the provided shell commands.
  • Ensure that the default schema directory is suitable for all supported operating systems and installation methods, and that it aligns with user expectations for both system-wide and user-local installations.

Thanks for using Sourcery. We offer it for free for open source projects and would be very grateful if you could help us grow. If you like it, would you consider sharing Sourcery on your favourite social media? ✨

Share Sourcery

Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

"Settings schema not found and settings won't be saved, run `poe install-schemas`"
)
# Workaround: do not show this message if we're installing schemas
if "install-schemas" not in sys.argv:
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion (llm): The check for 'install-schemas' in sys.argv could lead to unexpected behavior if additional arguments contain this substring. Consider a more robust way to detect the installation context.

)
# Workaround: do not show this message if we're installing schemas
if "install-schemas" not in sys.argv:
logger.warning(
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick (llm): The warning message has been updated to use a backtick instead of single quotes around the command. Ensure this change is consistent with documentation and other messages in the application.

@@ -0,0 +1,46 @@
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion (llm): The docstring provides shell commands for manual installation. It would be helpful to include a Python snippet as well, showing how to use the install_schemas_command programmatically.

@danyeaw
Copy link
Member

danyeaw commented Jan 19, 2024

Wow, Sourcery got chatty!

@github-actions github-actions bot added the packaging Update to packaging aspects label Jan 21, 2024
@amolenaar amolenaar force-pushed the install-schemas branch 3 times, most recently from 175a89c to 8b42bca Compare January 21, 2024 20:01
Copy link
Member

@danyeaw danyeaw left a comment

Choose a reason for hiding this comment

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

This looks great @amolenaar!

@danyeaw danyeaw added feature A new feature and removed python Pull requests that update Python code packaging Update to packaging aspects labels Jan 23, 2024
@danyeaw danyeaw merged commit 350e375 into main Jan 23, 2024
@danyeaw danyeaw deleted the install-schemas branch January 23, 2024 03:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants