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

Add requirements #54

Merged
merged 8 commits into from
Sep 7, 2024
Merged

Add requirements #54

merged 8 commits into from
Sep 7, 2024

Conversation

clockwinder
Copy link
Owner

This PR adds a requirements.txt file, and reorganizes the imports section to make more sense.

Should close #26 #29

@clockwinder clockwinder requested a review from adamdiel September 3, 2024 21:15
@clockwinder
Copy link
Owner Author

Is there another way to have discovered I needed to use PyNaCl besides just knowing it was a pre-req?

How does discord.py use PyNaCl without it being imported? Does the library just access it directly?

Is it alright to add it to the imports (with a note) to make pipreqs easier to use? Along those lines, is pipreqs acceptable to use?

@clockwinder clockwinder linked an issue Sep 3, 2024 that may be closed by this pull request
from discord.ext import commands
from discord.ext import tasks
from datetime import datetime, timedelta, timezone
import nacl #This import is not required, but provides `requirements.txt` clarity, and use of `pipreqs`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah so this is how you ensure pynancl gets include in pipreqs? Neat

Copy link
Owner Author

Choose a reason for hiding this comment

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

It's a good way to do it, right? I didn't see documentation, just noticed how pipreqs worked, and went ahead with that.
Is there a better way to handle it?

Copy link
Collaborator

Choose a reason for hiding this comment

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

No I think this is a good way to do it. You could have just manually added it to the file but this will allow you to regenerate consistently for future changes.

from discord.ext import commands
from discord.ext import tasks
from datetime import datetime, timedelta, timezone
import nacl #This import is not required, but provides `requirements.txt` clarity, and use of `pipreqs`.
from rainwaveclient import RainwaveClient #Command to upgrade the rainwaveclient api: pip install -U python-rainwave-client
Copy link
Collaborator

Choose a reason for hiding this comment

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

This might be a good example of when to use TODO in your comments. This would be a great thing for your README

Copy link
Owner Author

Choose a reason for hiding this comment

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

Sorry, which part?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Weird, on the PR home page its showing I selected lines 15/16 but on the files view I had just selected line 16. The comment on line 16 about how to upgrade the client specifically

Copy link
Owner Author

Choose a reason for hiding this comment

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

Why TODO instead of NOTE?

Copy link
Collaborator

Choose a reason for hiding this comment

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

That works great too! Just something to help find these in the future for those that don't have issues created yet

aiocron==1.8
discord.py==2.4.0
python_rainwave_client==2024.2
PyNaCl==1.5.0 #I got this by using `pip show pynacl`. If I hadn't known what would I do?
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is your comment asking how to get the version?

Copy link
Owner Author

Choose a reason for hiding this comment

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

It's a "hidden" requirement, it's not something that gets imported so pipreqs doesn't see it.

So let's pretend I'm working on someone elses program and trying to containerize it, but I don't see a hidden requirement like this; is there a good way to detect requirements?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Well in reality we detect this one by simply trying to run it. The program throws the exception which is how you discovered it in the first place. Its up to the maintainer to ensure they have things like this in requirements in general I would say. For me this one is no different than ffmpeg or opus. This just happens to be a python import we need. Was weird pipreqs didn't get this by default though

Copy link
Owner Author

Choose a reason for hiding this comment

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

It's not required unless you are using voice with the bot, which is why it's not a flatout requirement.

Okay, so there's not a good solution in this instance, we just hope folks upstream keep things in order for us.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Gotcha, so yeah we are at the mercy of the upstream maintainer for discord and their documentation to figure that out.

@clockwinder clockwinder merged commit 58ff6a4 into main Sep 7, 2024
@clockwinder clockwinder deleted the add_requirements branch September 7, 2024 04:49
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.

Add requirements.txt Organize Imports
2 participants