-
Notifications
You must be signed in to change notification settings - Fork 3
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
python 3 and siggen 1.0.0+ support #5
Conversation
* update to support Python 3 and siggen 1.0.0+ * fixes example so it works * adds test and example to README
*~ | ||
*.swp | ||
__pycache__ | ||
fx_crash_sig.egg-info/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.gitignore
helps deal with random files that shouldn't get checked in. I threw things that affected me in here.
|
||
```sh | ||
python setup.py test | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is how to run the tests. It ran the tests for me. If this isn't, then let me know and I can adjust this.
|
||
```sh | ||
python example.py | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that there's an example.py
module that shows how to do some things, I thought I'd surface that.
To run it, you either have to have .
on your PYTHONPATH
or we needed to bump it up to the parent directory. I did the latter figuring it's easier to document.
Let me know if you'd rather we did something different.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's good with me. The Example script
link above was broken though.
print(symbolicated) | ||
|
||
if symbolicated is not None: | ||
signature = crash_processor.get_signature_from_symbolicated(symbolicated) | ||
print(signature) | ||
result = crash_processor.get_signature_from_symbolicated(symbolicated) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
siggen 0.2.0 changed the API so it returns a Result
now. I adjusted the code accordingly.
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
SYMBOLS_API = 'https://symbols.mozilla.org/symbolicate/v5' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SYMBOLS_API
was defined in a couple of places. I lifted it to this module.
@@ -24,7 +28,7 @@ def test_symbolicate_single2(self): | |||
|
|||
def test_symbolicate_none(self): | |||
symbolicated = self.symbolicator.symbolicate(None) | |||
self.assertEquals(symbolicated, {}) | |||
self.assertEqual(symbolicated, {}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assertEquals
is deprecated in favor of assertEqual
(with no s) so I fixed that.
@@ -1,3 +1,3 @@ | |||
requests==2.19.1 | |||
siggen==0.1.2 | |||
siggen<2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we restrict it to <2
, then it'll pick up the latest version that's below major version 2. I'll keep to semantic versioning, so that should work and won't break the API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be safer and more predictable to specify a single version? Is the reasoning for this so that signature lists can be kept up to date?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just read #4 so this makes sense to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is one of those tough decisions: what to pin on. I was thinking that we control siggen, so we can make sure that anything under 2.0.0 guarantees API backwards compatibility. I think with that guarantee, it's safe to do this here and doing this here means we don't have to do an fx-crash-sig update for every siggen update. I think we want to have to do fewer fx-crash-sig updates.
Having said that, I don't really understand the Telemetry code or databricks or how this would get used. Is it likely that one of those systems will cache fx-crash-sig? In which case if we don't increment the fx-crash-sig version, they won't pick up newer versions of siggen, either?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I remember correctly databricks just does a pip install for each new cluster without caching so I think in this case it would install the latest siggen even if fx-crash-sig isn't updated. You may want to double check that with someone else.
@@ -36,7 +36,7 @@ def read_file(name): | |||
""", | |||
classifiers=[ | |||
'License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)', | |||
'Programming Language :: Python :: 2 :: Only', | |||
'Programming Language :: Python :: 3 :: Only', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
siggen 1.0.0 is Python 3 only. Because of that, this effectively becomes Python 3 only. Python 2 is unsupported as of the end of this year and supporting Python 2 and 3 is a maintenance burden, so I'd rather we just stuck with Python 3.
If that turns out to be an unfeasible, we can figure something out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't expect any issues with python 3 only. This library is fairly simple and machines using this should have 3.
This doesn't surface debugging information. I was thinking of adding a |
For debug info the command line util could just take a The changes here seem fine to me, just a couple of comments. I can give you access to the repo so you can merge it yourself if you'd like. Does this also fix #4? |
Oh, I like the idea of a |
This adds get_version_info() which returns the versions for siggen, fix-crash-sig and Python. This will greatly ease debugging issues. This also adds a --version flag to fx-crash-sig command which spits those things out to stdout.
I added Does that look ok? |
fx_crash_sig/crash_processor.py
Outdated
from siggen.generator import SignatureGenerator | ||
|
||
from fx_crash_sig import SYMBOLS_API | ||
from fx_crash_sig.symbolicate import Symbolicator | ||
|
||
|
||
def get_version_info(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should get_version_info
be in crash_processor.py
? I think it would make more sense to just be in cmd_get_crash_sig.py
or __init__.py
. If you don't agree you can just leave it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better if it's in the library rather than just in the command. Then if someone uses fx-crash-sig like a library and not like a command, it's still available. So I think it shouldn't be in cmd_get_crash_sig.py
.
I'll move it to __init__.py
.
fx_crash_sig/cmd_get_crash_sig.py
Outdated
if args.version: | ||
version_info = get_version_info() | ||
for key in sorted(version_info): | ||
print('%s: %s' % (key, version_info[key])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer .format()
over %
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can do!
@ben-wu ^^^ How's that look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just two small things but otherwise everything looks good to me.
fx_crash_sig/__init__.py
Outdated
fx_crash_sig_version = 'unknown' | ||
|
||
return { | ||
'siggen': '%s (%s)' % (siggen_version, siggen_releasedate), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.format()
here too. I forgot to mention it last time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops--I missed this. Sorry about that!
@@ -34,3 +34,14 @@ Command line (using [sample.json](/sample.json)): | |||
```sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On line 20 above can you change the link to /example.py? I can't comment on the actual line.
^^^ That should cover the request changes. Sorry about that! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Do you want to merge this now?
Done! Thank you! |
Fixes #3, #4.