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

[Bug] zulip_bots does not include importlib-metadata as a dependency on Python>=3.10 but tries to import it regardless of version #829

Closed
cauebs opened this issue Sep 3, 2024 · 6 comments · Fixed by #842
Assignees

Comments

@cauebs
Copy link

cauebs commented Sep 3, 2024

Running on Python 3.10:

  File ".../zulip_bots/finder.py", line 11, in <module>

    import importlib_metadata as metadata
ModuleNotFoundError: No module named 'importlib_metadata'

Solution is to either always include importlib-metadata as a dependency in zulip_bots/setup.py, independently of the Python version, or do a conditional import checking for the Python version and using std's importlib.metadata instead of importlib_metadata for Python>=3.10.

Whichever the maintainers decide, I can file a pull request for it.

@hr1shu
Copy link

hr1shu commented Nov 20, 2024

Hi @cauebs @timabbott , Can I work on this issue?

@timabbott
Copy link
Member

Yep, please do!

27piyus added a commit to 27piyus/python-zulip-api that referenced this issue Nov 28, 2024
Hopefully, this will help improve the quality of new-contirbutor pull
requests to this project.

<!-- Describe your pull request here.-->
This pull request addresses the issue with the importlib-metadata dependency in the zulip_bots project. The dependency was missing for Python >= 3.10, causing import errors. I have updated the setup.py file to ensure that the importlib-metadata package is conditionally included for Python versions < 3.10, ensuring compatibility.

Fixes: <!-- Issue link, or clear description.-->
This PR fixes the issue zulip#829, where importlib_metadata was being imported in Python >= 3.10 without being listed as a required dependency.

<!-- If the PR changes output, always include screenshots or code blocks to demonstrate your changes. If it seems helpful, add a screen capture of the new functionality as well.

Tooling tips: https://zulip.readthedocs.io/en/latest/tutorials/screenshot-and-gif-software.html
-->

No visual changes were made. The functionality was tested by running the bot with Python 3.10, and the error no longer occurs.

<details>
<summary>Self-review checklist</summary>

<!-- Prior to submitting a PR, follow our step-by-step guide to review your own code:
https://zulip.readthedocs.io/en/latest/contributing/code-reviewing.html#how-to-review-code -->

<!-- Once you create the PR, check off all the steps below that you have completed.
If any of these steps are not relevant or you have not completed, leave them unchecked.-->

- [ ] [Self-reviewed](https://zulip.readthedocs.io/en/latest/contributing/code-reviewing.html#how-to-review-code) the changes for clarity and maintainability
      (variable names, code reuse, readability, etc.).

Communicate decisions, questions, and potential concerns.

- [ ] Explains differences from previous plans (e.g., issue description).
- [ ] Highlights technical choices and bugs encountered.
- [ ] Calls out remaining decisions and concerns.
- [ ] Automated tests verify logic where appropriate.

Individual commits are ready for review (see [commit discipline](https://zulip.readthedocs.io/en/latest/contributing/commit-discipline.html)).

- [ ] Each commit is a coherent idea.
- [ ] Commit message(s) explain reasoning and motivation for changes.

Completed manual review and testing of the following:

- [ ] Visual appearance of the changes.
- [ ] Responsiveness and internationalization.
- [ ] Strings and tooltips.
- [ ] End-to-end functionality of buttons, interactions and flows.
- [ ] Corner cases, error conditions, and easily imagined bugs.
</details>
@27piyus 27piyus mentioned this issue Nov 28, 2024
12 tasks
@27piyus
Copy link

27piyus commented Nov 28, 2024

@zulipbot claim

@zulipbot
Copy link
Member

@27piyus This issue cannot be claimed, as someone else is already working on it. Please see our contributor guide for advice on finding an issue to work on. Thanks!

@27piyus
Copy link

27piyus commented Nov 28, 2024

@timabbott can you please tell me why is there issue in checking as i already solved the issue

Niloth-p added a commit to Niloth-p/python-zulip-api that referenced this issue Dec 4, 2024
Use `importlib-metadata` for newer Python versions as well.

Fixes zulip#829.
@xeruf
Copy link

xeruf commented Dec 4, 2024

having this error as well, making the setup not quite usable, please check again

timabbott pushed a commit that referenced this issue Dec 5, 2024
Use `importlib-metadata` for newer Python versions as well.

Fixes #829.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants