Skip to main content

Never let your TODOs rot in your python code ever again

Project description

todo-or-die [Python edition]

Don't let your TODOs rot in your python projects anymore !

Inspired by :

Examples

Once installed in your project, you can use it in any part of your code:

from todo_or_die import todo_or_die, TodoOrDie

# raise an OverdueException when we're after a certain date or datetime
todo_or_die("This should be fixed by now.", by = datetime.datetime(2021, 6, 25, 15, 34, 55))

# raise an OverdueException when a given condition is true
todo_or_die("This should fail when we reach 1000 users", when = DB.users.count() > 1000)

# it also accepts a callable as a first argument
def myfunc():
    return 42

result = todo_or_die(myfunc, "Fix this in 6 months", by=datetime.date(2021, 6, 31))
result == 42 # True

# or simply any value will be passed back
result = todo_or_die(42, "Fix this in 6 months", by=datetime.date(2021, 6, 31))
result == 42 # True

# Finally, you can use it as a function decorator
@TodoOrDie("This function should be removed in the next version", when= build > 2000)
def myfunc(some = "arg"):
    pass

Keep your projects clean

To understand why you would ever call a function to write a comment, read on.

If you have some code you know you'll need to change later, don't just leave a comment for later that you'll never read, ever again.

For all the following cases, forgetting a TODO is NOT GOOD:

  • remove some code when the dependency support expires,
  • remove a feature flag,
  • update some code related to another project,
  • update a dependency when another refactoring is done,
  • ...

This can lead to nasty issues so make your TODOs speak up when they need to with this module ;)

You can now replace your simple comment with this function that will raise and error when the time or the condition are met and remind you to do something about it.

Caution

This can cause some production apps to break ! This code is named todo_or_die, not todo_and_kittens so be careful.

Pull-Requests are welcome to make this more production-ready !

Note this module has no warranty, see the LICENSE !

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

todo-or-die-0.1.1.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

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

todo_or_die-0.1.1-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file todo-or-die-0.1.1.tar.gz.

File metadata

  • Download URL: todo-or-die-0.1.1.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.6

File hashes

Hashes for todo-or-die-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5bdde8e486dbd2cc5c1f2b59a851898c1cea82ee99c6f1bc2195ae6d5c45fa40
MD5 4e718ee4b2d9820b89526ad79bdbe596
BLAKE2b-256 76aa29827b293249d0a3cdb407f0f2d77ea9b49e1b066c05b2362ba6fa721363

See more details on using hashes here.

File details

Details for the file todo_or_die-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: todo_or_die-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.6

File hashes

Hashes for todo_or_die-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 76ef868b0bff2da07fcd5a5eba01da449dd65d6aab28e9391b9c0254deed5c61
MD5 0e2df148470115826ca6086c8dab775c
BLAKE2b-256 c6dac09a029d3187c0c66e9cc93cfd19973ff19060364690267c7b5c8dd762e4

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