Skip to main content

wabisabi

pypi Travis Docs

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

Link above not working for now: https://deprecation-factory.readthedocs.io/en/latest/?badge=latest

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 (numpydoc compatible)

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. You write your code how it is supposed to look, this library, makes ensures your users have enough time to update their code.

This library

  • Modifies function signatures so to ensure correctness for the current version. This should help with autocompletions.
  • Adds a warning section to the docstrings. An attempt is made to properly indent the docstring.
  • Point the user to their line of code, so that they know where to make make the appropriate modification.
  • Leaving deprecators in place after the desired threshold results in a noop. This means that you can be lazy about ripping them out of code. Deprecations should not have to be blockers for your development.
  • If numpydoc > 0.7 is installed, the "Warns" sections are combined into a single section allowing you to chain deprecators.

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.

Current deprecators

  • Deprecator for change of default values in kwargs. Handles kwargs passed as positional arguments too!
  • Transitionning to keyword only arguments.
  • kwarg renaming

Future deprecators

  • Swapping the order of positional arguments
  • Making an old kwarg a manditory positional arg
  • Feature requests are welcome!

Development Lead

  • Mark Harfouche

Contributors

Could be you!

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.3.0 (2022.10.30)

  • Use packaging instead of distutils for version comaprison. Note that this might cause certain versions to fail. Notably, '0.1.dev3' is now older than '0.1'.
  • Require Python 3.8.
  • New explicit dependency on packaging.

0.2.4 (2018.08.13)

  • Apparently numpydoc 0.6 didn't have a __version__ attribute....

0.2.3 (2018.08.13)

  • Check for numpydoc 0.7
  • Fix a typo in the docstring message

0.2.2 (2018.08.12)

  • API change. change_default_parameter now takes a dictionary for the old_kwargs so that parameter names don't conflict

0.2.1 (2018.08.12)

  • Merge with other numpydocs so that documentation in Sphinx doesn't crash

0.2.0 (2018.08.11)

  • Provide a deprecator for changing the number of keyword only arguments.

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

Metadata

Release files for wabisabi 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wabisabi 0.3.0
File Size Uploaded
wabisabi-0.3.0.tar.gz 22.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wabisabi 0.3.0
File Interpreter ABI Platform
wabisabi-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 45.5 kB

Release files / wabisabi-0.3.0.tar.gz

Download URL wabisabi-0.3.0.tar.gz
Size 22.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0d3655926cd1360add5ca7301310b9fee18fa49537c68e1291e2525ae34b2b4e
BLAKE2b-256 checksum
How to use checksums
763b9a3146e83fad4fd279d204c4b0822042f37c5d639156f6c518e587477b4a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.15

Release files / wabisabi-0.3.0-py3-none-any.whl

Download URL wabisabi-0.3.0-py3-none-any.whl
Size 23.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
45a68f6616f55874c3ec401388d8fcf3d10fae33704cba540198cc761866b20a
BLAKE2b-256 checksum
How to use checksums
326cf1e001d0b7c5c1887f07bccc4a0e505df29f7011b0c3b03cdab26f821b31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.15

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.5

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page