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

Proposal: Add magic.set_magic_file #306

Closed
wants to merge 2 commits into from

Conversation

maringuu
Copy link
Contributor

This would be a solution to #305.
I'm not happy with the name of the function and would like to discuss this change in general.

Any comments?

As a user I don't really care about the `Magic` class.
All I want is to query the magic of some files.
Before this commit you had to create an instance of Magic.
After this commit you can pass all arguments you would pass
to its constructor to the instanceless methods.
@ahupp
Copy link
Owner

ahupp commented Oct 13, 2023

Since this is global state, other libraries that also depend on python-magic would pickup the change and may get unexpected behavior. I'd support an environment variable that sets the default, since that puts it under the users (rather than potentially a libraries) control.

@ahupp
Copy link
Owner

ahupp commented Oct 13, 2023

Obviously a library can set the environment variable, but that's going to be clearly wrong while a function makes it inviting.

@maringuu
Copy link
Contributor Author

environment variable that sets the default

That will be the MAGIC environment variable as defined by libmagic(3).

Since this is global state, other libraries that also depend on python-magic would pickup the change

Good point, I didn't think if that.

Closing.

@maringuu maringuu closed this Oct 13, 2023
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