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

Move hash prototype definitions into json file #29

Open
psypanda opened this issue Mar 14, 2015 · 4 comments
Open

Move hash prototype definitions into json file #29

psypanda opened this issue Mar 14, 2015 · 4 comments
Milestone

Comments

@psypanda
Copy link
Owner

@bburky Since the list of regular expressions is growing very fast and hashID is now installed via a setup.py (as you suggested earlier), maybe we can reconsider f36444c and move the prototype definitions into a json file.
What do you think?

@bburky
Copy link
Collaborator

bburky commented Mar 14, 2015

That sounds good. I can look at it a bit more in a few days. Do you want me to do this, or did you just want some feedback?

Also, it's possible to have setup.py install arbitrary data files (like JSON files) for you too. I think it's a data_files option and it installs the files right beside your python files. The code I already have in f36444c should work fine. We may also want to let users specify a path to the JSON file so that they can more easily contribute new regexes.

@psypanda
Copy link
Owner Author

Well at first I wanted some feedback since the regular expressions will be harder to maintain because we can't use raw strings. If you want you can start working on this (Pull Requests are welcome 😉).
I'm curious, how did you dump the namedtuple to JSON in f36444c?

The idea of having an option to let users specify the path to the JSON file sounds good!
As you mentioned setup.py should install the the JSON file using data_files as described here.

@psypanda psypanda added this to the v3.2.0 milestone Mar 14, 2015
@bburky
Copy link
Collaborator

bburky commented Mar 17, 2015

I'm curious, how did you dump the namedtuple to JSON in f36444c?

You know.... I have no idea how I did that. Here's a completely different solution: https://gist.github.com/bburky/c7e1f955b10570c38f16. That has the new JSON for the current list of prototypes and the Python code I used to generate it.

Do you want to the work to adapt the current HashID code to load the prototypes from JSON, or should I do it? I haven't kept up with HashID recently. It looks like it changed a little since I last looked at it.

@psypanda
Copy link
Owner Author

I never really dealt with JSON or installing data files using setup.py before, so I think it would be a good idea if you would do it. Thanks for including the code to dump the JSON file from the tuple in your gist.
I think the code to load the JSON file from f36444c should work fine.

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

No branches or pull requests

2 participants