Skip to content

Instantly share code, notes, and snippets.

say we claim support for >=1, <3

  • 1.0 is the first supported version.
    • if this isn't tested, features from later versions may be depended on that break compatibility with this version.
  • 1.x adds to it.
    • test the latest version available to detect new features that collide (e.g. variables named async are fine in python 3.6 but async becomes a keyword in python 3.7).
      • only the latest version needs to be tested because features cannot be removed without a major version bump.
    • if something breaks, either
      • a new feature collided with existing code
      • upstream did not follow semver and broke compatibility
  • existing code uses upstream code that is not part of the public API
import os
import py
def _relpath(path, *, relto):
# TODO py35+ commonpath = os.path.commonpath([path, relto])
commonpath = str(py.path.local(path).common(py.path.local(relto)))
def _commonpath_to(_path):
return _path[len(commonpath):].strip(os.path.sep)
#!/usr/bin/env python3
ROMAN_LEGEND = {
'I': 1,
'V': 5,
'X': 10,
'L': 50,
'C': 100,
'D': 500,
import math
def apy(apr, periods=12):
return (((apr / periods) + 1) ** periods) - 1
def apr(apy, periods=12):
return (((apy + 1) ** (1 / periods)) - 1) * periods
@dmtucker
dmtucker / Pipfile
Last active December 4, 2024 17:02 — forked from corny/dynv6.sh
Update script for dynv6.com to set your IPv6 address
[requires]
python_version = "3.11"
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]