Skip to main content

Python deprecation factory ensuring useful warnings and docstrings for different deprecations.

Project description

Deprecation Factory

pypi Travis Docs

Python3 deprecation factory. Automatically write boilerplate code for many kinds of deperecations through python decorators.

Motivations

Breaking things is important! Breaking other's things is just mean!

The goal of deprecations is to warn other library writers that their code is about to break so you can keep making agressive changes to your own.

Often when you want to deprecate a feature, you end up following a procedure similar to

  1. Make the useful modification to your code.
  2. Decide on when the old behaviour should be switched over.
  3. Add warnings INSIDE your function to warn users.
  4. Change the function signature to something non-sensical to detect the default behaviour.
  5. Add messages in the documentation.

Finally, when the behaviour is official depreprecated, you need to do all these changes again.

  1. Remove the warnings.
  2. Remove the documentation messages.
  3. Remove the old behaviour.
  4. Change the function signature back to something useful.

The goal of this library is to allow you to shortcut steps 3-9. You shouldn't have to revisit the deprecation long after you completed implementing your new features

This library modifies function signatures and docstrings to make the current version of the function appear in autocompletions and on the automatically generated documentation.

The library will point the user to their line of code, so that they can make the appropriate modifications.

It is even safe to leave the deprecators in place after the threshold version has been reached. The decorator will behave as a no-op and your library will use the updated version of your code. Deprecations should not have to be blockers for your development.

Installation

While you can depend on this, I strongly recommend you version the files you need in your project as the API is highly likely to change and break your code.

Make sure you keep a BSD notice in your code when you version this.

Current deprecators

  • Deprecator for change of default values in kwargs. Handles kwargs passed as positional arguments too!

Future deprecators

  • Transitionning to keyword only arguments.
  • Swapping the order of positional arguments
  • Making an old kwarg a manditory positional arg
  • Feature requests are welcome!

Other directions

  • Input sanitization.

Development Lead

  • Mark Harfouche

Contributors

None yet. Why not be the first?

How to contribute

Ready to contribute? We use the standard github contribution model. Scikit-Image has a great writeup on how to setup your environment. Adapt it for our environment.

Cookiecutter

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

0.1.1 (2018.08.09)

  • Deprecated arguments appear in order for Python 3.5 as well.

0.1.0 (2018.08.09)

  • New deprecator for changing the default value of kwards. Handles arguments passed as positional argumnets too.

0.0.1 (2018-07-29)

  • First release on PyPi

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deprecation_factory-0.2.0.tar.gz (29.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deprecation_factory-0.2.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file deprecation_factory-0.2.0.tar.gz.

File metadata

  • Download URL: deprecation_factory-0.2.0.tar.gz
  • Upload date:
  • Size: 29.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.3

File hashes

Hashes for deprecation_factory-0.2.0.tar.gz
Algorithm Hash digest
SHA256 03db6abf8dbc6b1a5ce79c3190bccdd21d15dca335f4cd6e2c8fc7e90b1d38a0
MD5 91a266711fd94bd187c338f105be7689
BLAKE2b-256 d8b2c8541a5ec1da1193d2519a2a0a5418126e78e8a431bc1ca9e2ae4ca8e751

See more details on using hashes here.

File details

Details for the file deprecation_factory-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: deprecation_factory-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.3

File hashes

Hashes for deprecation_factory-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4c33113865a6e674e823b50388326bd48d3c694bd657e0df916e6aa277b7be5b
MD5 4f045881a8825fcd55fcd0a4d3dcc9e7
BLAKE2b-256 bad4ead070d49bbc3d501129c91ea9c38d5412910d14831e03fc7e6bb7e1d349

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page