Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

By default don't import 3rd-party Python modules, only stdlib ones. … #857

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

gjcarneiro
Copy link

@gjcarneiro gjcarneiro commented Sep 13, 2016

Fixes #854.


This change is Reviewable

@dcramer
Copy link
Member

dcramer commented Sep 14, 2016

This will break a backwards compat change (where we let you configure the transport with the DSN), but as long as we mentioned that in the CHANGES I'm totally ok with it.

We also should simply remove the comments and just kill the lines (we're using version control after all).

@gjcarneiro
Copy link
Author

So I fixed the tests and cleaned up the code. One issue that I had was that I have to access Client._registry, and we shouldn't be required to access attributes marked private. So I propose to rename, Client._registry to Client.registry, what do you think?

@dcramer
Copy link
Member

dcramer commented Sep 15, 2016

Thanks!

I'm fine with renaming it to .registry as well.

Copy link
Member

@dcramer dcramer left a comment

Choose a reason for hiding this comment

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

(still getting used to the code review process)

CHANGES Outdated
from raven.transport.threaded_requests import ThreadedRequestsHTTPTransport
from raven.base import Client

for transport in [EventletHTTPTransport,
Copy link
Member

Choose a reason for hiding this comment

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

of note we dont actually need to do this since you can pass transport to the Client() itself. It was purely for backwards compatibility for a period of time.

Copy link
Author

Choose a reason for hiding this comment

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

But the problem is that a typical Django setup just adds raven.contrib.django.raven_compat to the list of INSTALLED_APPS. If they also have a weird DSN configured, they would need to register the transports in the registry for it to work, as the Django Sentry app creates its own Client() and I honestly have no idea how to customize creation of this Client()...

Copy link
Member

Choose a reason for hiding this comment

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

You can actually just pass it into SENTRY_CONFIG via 'transport' (same as all of the other config options).

Copy link
Author

Choose a reason for hiding this comment

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

Ah, OK then. I guess I can update the documentation to reflect this. Seems cleaner the way you suggest.

conftest.py Outdated



for transport in [EventletHTTPTransport,
Copy link
Member

Choose a reason for hiding this comment

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

assuming things break without this?

Copy link
Author

Choose a reason for hiding this comment

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

Sadly yes. The reason is that all tests build clients based on DSN, so a few test cases fail. And I guess using the DSN and registry is part of the things we test, so we can't remove it?

_________________________________________________________________________________________________ ThreadedTransportTest.test_does_send __________________________________________________________________________________________________
InvalidDsn: Unsupported Sentry DSN scheme: threaded+requests+http (threaded+requests+http://some_username:some_password@localhost:8143/1)
__________________________________________________________________________________________ ThreadedTransportTest.test_shutdown_waits_for_send ___________________________________________________________________________________________
InvalidDsn: Unsupported Sentry DSN scheme: threaded+requests+http (threaded+requests+http://some_username:some_password@localhost:8143/1)
_________________________________________________________________________________________________ RequestsTransportTest.test_does_send __________________________________________________________________________________________________
InvalidDsn: Unsupported Sentry DSN scheme: requests+http (requests+http://some_username:some_password@localhost:8143/1)
________________________________________________________________________________ TornadoTransportTests.test__sending_successfully_calls_success_callback ________________________________________________________________________________
InvalidDsn: Unsupported Sentry DSN scheme: tornado+http (tornado+http://uver:pass@localhost:46754/1)
__________________________________________________________________________________ TornadoTransportTests.test__sending_with_error_calls_error_callback __________________________________________________________________________________
InvalidDsn: Unsupported Sentry DSN scheme: tornado+http (tornado+http://uver:pass@localhost:46754/1)
____________________________________________________________________________________________________ TornadoTransportTests.test_send ____________________________________________________________________________________________________
InvalidDsn: Unsupported Sentry DSN scheme: tornado+https (tornado+https://user:pass@host:1234/1?timeout=1&verify_ssl=1&ca_certs=/some/path/somefile)

Copy link
Member

Choose a reason for hiding this comment

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

Yeah we'd have to update these tests to pass it in directly, but I'd be ok with that in order to remove the legacy compatibility.

Copy link
Author

Choose a reason for hiding this comment

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

OK. Will probably have to wait a few days before I commit more changes, as I'll be travelling today (to PyCon UK) and I don't have a laptop.

Copy link
Member

@dcramer dcramer left a comment

Choose a reason for hiding this comment

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

I think I left comments but GitHub is broken.

@gjcarneiro
Copy link
Author

Please check if the latest commits address your comments.

@dcramer
Copy link
Member

dcramer commented Sep 23, 2016

Looks good we just need to update the tornado tests to remove the tornado+ prefix I think?

@gjcarneiro
Copy link
Author

gjcarneiro commented Sep 28, 2016

Hm, some Tornado test failing on Python 2.6, but I don't know why :(
Also I am unable to reproduce on my Ubuntu 16.04 box because of this bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=754248
Can we just drop Python 2.6 support?

@mitsuhiko
Copy link
Member

2.6 is very much alive, we can't kill it yet.

@gjcarneiro
Copy link
Author

It's all very fine to say "we must support Python2.6", but you have to realise it is incredibly hard, today, to do anything with Python2.6. After much insistence, I managed to get a docker image with python2.6 and pip, but even then I didn't manage to run the tests. The latest error is:

Collecting billiard<3.6.0,>=3.5.0.2 (from celery>=2.5->raven)
  Downloading billiard-3.5.0.2.tar.gz (157kB)
    100% |################################| 163kB 5.7MB/s 
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-QHA8oe/billiard/setup.py", line 90, in <module>
        raise ValueError('Versions of Python before 2.7 are not supported')
    ValueError: Versions of Python before 2.7 are not supported
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-QHA8oe/billiard/
make: *** [bootstrap] Error 1
root@45ac8d430fc8:/code# 

Please, please, reconsider Python 2.6, it is dragging raven-python down!

Maybe rebrand raven-python into a new major release and state in the release notes that whoever needs Python 2.6 support should continue using the old raven version?

Oh, drat, I see now you had a major release recently :(

There must be something we can do, this is ridiculous. How are we supposed to fix tests if can't even run them?

@ashwoods ashwoods added this to the 6.2.0 milestone Jul 17, 2017
@ashwoods ashwoods modified the milestones: 6.2.0, 6.3.0 Sep 23, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants