# How does one transition to underscore naming while still using other packages?

**URL:** <https://www.rubin.community/t/how-does-one-transition-to-underscore-naming-while-still-using-other-packages/985>\
**Category:** Data Management\
**Tags:** pep8\
**Created:** [July 27, 2016, 1:06pm UTC](https://www.rubin.community/t/how-does-one-transition-to-underscore-naming-while-still-using-other-packages/985 "2016-07-27T13:06:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mwv](https://avatars.discourse-cdn.com/v4/letter/m/e79b87/32.png) [@mwv](https://www.rubin.community/u/mwv)\
**Post date:** [July 27, 2016, 1:06pm UTC](https://www.rubin.community/t/how-does-one-transition-to-underscore-naming-while-still-using-other-packages/985/1 "2016-07-27T13:06:42Z")

</div>

How does one implement a switch to underscores for the entire package, when one is still calling camelCase routines from other modules? Is it kosher to only change to underscores for things defined in the present package? That, sadly, seems like it would still be confusing.

---

<div class="post-metadata">

**Author:** ![price](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/price/32/488_2.png) [@price](https://www.rubin.community/u/price)\
**Post date:** [July 27, 2016, 1:32pm UTC](https://www.rubin.community/t/how-does-one-transition-to-underscore-naming-while-still-using-other-packages/985/2 "2016-07-27T13:32:55Z")

</div>

Yeah, that’s the can of worms that we chose to open by changing our naming standards halfway along. But here’s the way I see it. Firstly, there’s always going to be a mix of camelCase and under\_scores for external modules because not all the modules we use share the same convention. I don’t even think that all the modules in the python standard library share the same convention. There’s nothing we can do about that, so don’t sweat it. Secondly, I think the guidelines rightly call for consistency as the most important thing. If you’re editing a file that uses camelCase, then all the names you _introduce_ (as opposed to all the names you _use_) should be camelCase. And vice versa.

Personally, I think it’s a terrible pity to not only have changed naming standards and introduced this can of worms, but to have left things in limbo for so long (the [DM Python Style Guide](https://developer.lsst.io/coding/python_style_guide.html) still says camelCase) that we’re introducing more inconsistency. In my opinion, we need to choose a standard and standardise on it. No doubt some will dislike the naming standard that we standardise on, but that’s inevitable, and the halfway-standard we currently have is worse than half our developers being mildly dissatisfied with our coding standard. If you’re going to do something, do it well or don’t do it at all.

---

<div class="post-metadata">

**Author:** ![jsick](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/jsick/32/672_2.png) [@jsick](https://www.rubin.community/u/jsick)\
**Post date:** [July 27, 2016, 4:08pm UTC](https://www.rubin.community/t/how-does-one-transition-to-underscore-naming-while-still-using-other-packages/985/3 "2016-07-27T16:08:13Z")

</div>

(My personal opinion). I think it’s fine, in practice, to switch an _entire_ [eups] package to a PEP8-advocated underscore-style naming while other packages in the Stack remain camelCase. After all, in Python we work in an ecosystem where underscores dominate (we use astropy, numpy, scipy, matplotlib, …, all the time without confusion).

> [@price](#):
>
> I don’t even think that all the modules in the python standard library share the same convention.

It’s only the truly ancient modules in the standard library that still use camel case. Once PEP8 was introduced, everyone rallied around underscores.

* * *

**Update** : I just realized that my statement above missed the _real_ challenge, which is that changing naming conventions introduces a massive API change to any dependent packages. (Above I was thinking only about Packages that had no existing API users).

For this concern the alternatives are:

1. Rename functions, methods, and attributes to the new style, and then create facade functions, methods and attributes (via properties) that retain the camelCase style. Put a decorator on those facades to indicate that those APIs are deprecated.

2. Take advantage of EUPS’ ability to manage versions and somehow pin versions for dependent packages until the package is ready to use the new API.

---

<div class="post-metadata">

**Author:** ![timj](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/timj/32/10_2.png) [@timj](https://www.rubin.community/u/timj)\
**Post date:** [July 28, 2016, 5:28pm UTC](https://www.rubin.community/t/how-does-one-transition-to-underscore-naming-while-still-using-other-packages/985/4 "2016-07-28T17:28:18Z")

</div>

> [@jsick](#):
>
> Rename functions, methods, and attributes to the new style, and then create facade functions, methods and attributes (via properties) that retain the camelCase style. Put a decorator on those facades to indicate that those APIs are deprecated.

I am strongly in favor of this option and I advocated it last year. Python even has a scheme for marking APIs as deprecated (I know because every time I run tests on Python 3 it tells me to stop using `assertEquals` and `assert_`). The only way to change the APIs is to provide a backwards compatibility shim (presumably enabled in the ` __init__.py` file. This allows packages to be updated one at a time without having to do a big bang migration.
