Codecrumbs: deprecate and refactor code across library boundaries

I wrote a library with the intention to rename things easily GitHub - 15r10nk/codecrumbs: deprecate and refactor code across library boundaries

The goal is to shorten deprecation periods like this, by giving the developer an easy way to update their code base.

This example would look like this:

class UnitTest:
    assertRaises = codecrumbs.renamed_attribute("assert_raises")

    def assert_raises(...):
        ...

The old and new method are both available and there are some things which should accelerate a adoption of the new method:

  1. a deprecation warning is raised
  2. pytest --codecrumbs-fix can be used to refactor all usages which where triggered during the test.

The barrier for the developer to use codecrumbs is really low. The pytest-plugin is part of codecrumbs and already usable. This reduces the time for refactoring N lines of code to executing pytest 1 time with --codecrumbs-fix.

I am aware that this would not allow to solve the problem in this thread now, because:

  • codecrumbs is still pretty new
  • works currently only with pytest
  • has currently not the goal to be used inside cpython
  • and still has to prove itself in the real world

But it might provide a way to solve issues like this in the future.

Please let me know if you have some feedback.