Deprecation warnings

Hi all

I just thought I’d point out that a good way to do deprecation warnings is
to use the ‘warnings’ system

e.g.

import warnings

class A(object):
def init(self):
warnings.warn(“A is deprecated”, DeprecationWarning)

A benefit of doing it this was is that PyCharm and other IDE’s mark usages
of deprecated functions / classes (pycharm formats it with a strikethrough
wherever it is used). This also doesn’t log anything by default unless you
enable it so it won’t log on staging / prod (and hence won’t clog up
couchlog) .

I’ve submitted a PR to enable it if running in DEBUG mode:

··· -- Simon Kelly Senior Engineer | Dimagi South Africa

Very cool. I think I looked around for the Right Way™ to do this and came
up short a little while ago. Glad to see you were able to figure it out. I
agree we should all use this once it’s set up.

Cheers,
Danny

··· On Thu, Aug 22, 2013 at 6:47 AM, Simon Kelly wrote:

Hi all

I just thought I’d point out that a good way to do deprecation warnings is
to use the ‘warnings’ system

e.g.

import warnings

class A(object):
def init(self):
warnings.warn(“A is deprecated”, DeprecationWarning)

A benefit of doing it this was is that PyCharm and other IDE’s mark usages
of deprecated functions / classes (pycharm formats it with a strikethrough
wherever it is used). This also doesn’t log anything by default unless you
enable it so it won’t log on staging / prod (and hence won’t clog up
couchlog) .

I’ve submitted a PR to enable it if running in DEBUG mode:
https://github.com/dimagi/commcare-hq/pull/986


Simon Kelly
Senior Engineer | Dimagi South Africa


You received this message because you are subscribed to the Google Groups
"CommCare Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Does that include submission history report? Cause we (DSA) were wondering
why that isn’t emailable yesterday.

··· On Thu, Aug 22, 2013 at 4:22 PM, Daniel Roberts wrote:

Very cool. I think I looked around for the Right Way™ to do this and came
up short a little while ago. Glad to see you were able to figure it out. I
agree we should all use this once it’s set up.

Cheers,
Danny

On Thu, Aug 22, 2013 at 6:47 AM, Simon Kelly skelly@dimagi.com wrote:

Hi all

I just thought I’d point out that a good way to do deprecation warnings
is to use the ‘warnings’ system

e.g.

import warnings

class A(object):
def init(self):
warnings.warn(“A is deprecated”, DeprecationWarning)

A benefit of doing it this was is that PyCharm and other IDE’s mark
usages of deprecated functions / classes (pycharm formats it with a
strikethrough wherever it is used). This also doesn’t log anything by
default unless you enable it so it won’t log on staging / prod (and hence
won’t clog up couchlog) .

I’ve submitted a PR to enable it if running in DEBUG mode:
https://github.com/dimagi/commcare-hq/pull/986


Simon Kelly
Senior Engineer | Dimagi South Africa


You received this message because you are subscribed to the Google Groups
"CommCare Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


You received this message because you are subscribed to the Google Groups
"CommCare Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Simon Kelly
Senior Engineer | Dimagi South Africa

Was that the right thread?

It’s not emailable because we don’t support paginating email reports yet.

··· On Thu, Aug 22, 2013 at 10:28 AM, Simon Kelly wrote:

Does that include submission history report? Cause we (DSA) were wondering
why that isn’t emailable yesterday.

On Thu, Aug 22, 2013 at 4:22 PM, Daniel Roberts droberts@dimagi.comwrote:

Very cool. I think I looked around for the Right Way™ to do this and came
up short a little while ago. Glad to see you were able to figure it out. I
agree we should all use this once it’s set up.

Cheers,
Danny

On Thu, Aug 22, 2013 at 6:47 AM, Simon Kelly skelly@dimagi.com wrote:

Hi all

I just thought I’d point out that a good way to do deprecation warnings
is to use the ‘warnings’ system

e.g.

import warnings

class A(object):
def init(self):
warnings.warn(“A is deprecated”, DeprecationWarning)

A benefit of doing it this was is that PyCharm and other IDE’s mark
usages of deprecated functions / classes (pycharm formats it with a
strikethrough wherever it is used). This also doesn’t log anything by
default unless you enable it so it won’t log on staging / prod (and hence
won’t clog up couchlog) .

I’ve submitted a PR to enable it if running in DEBUG mode:
https://github.com/dimagi/commcare-hq/pull/986


Simon Kelly
Senior Engineer | Dimagi South Africa


You received this message because you are subscribed to the Google
Groups “CommCare Developers” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to commcare-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


You received this message because you are subscribed to the Google Groups
"CommCare Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Simon Kelly
Senior Engineer | Dimagi South Africa


You received this message because you are subscribed to the Google Groups
"CommCare Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.