Repository navigation
v3.38.0
Reminder
Older Python versions are supported for 3 years after being obsoleted by a new major release. As Python 3.13 was
released on 7 October 2024, the codebase will be streamlined by removing support for Python 3.12 on or after 7
October 2027.
⚠ Breaking Changes
- Removed support for Python 3.11. As a reminder, older Python versions are supported for 3 years after being obsoleted
by a new major release. - The
empty_as_transientjob directive, introduced 3 days earlier in version 3.37.0, has been retired in favor
of the newempty_as_errorone (see below), whose name describes what you actually observe. It is no longer
recognized: if you use it, rename it in your jobs file, or the run aborts with the error
Directive 'empty_as_transient' is unrecognized.
See https://webchanges.readthedocs.io/en/stable/jobs.html#empty-as-error.
Added
- Support for Python 3.15, including its free-threaded (GIL-free) build 3.15t. Please note that certain optional
dependencies may not yet support free-threaded Python. On Python 3.15, thedeepdiffanddeepdiff_xml
extras installdeepdiff8.x, asdeepdiff9 requires a version ofcacheboxthat cannot be installed on
Python 3.15. On Windows, installing on Python 3.15 requires first setting the environment variable
PYYAML_FORCE_LIBYAML=0, as thePyYAMLdependency does not yet publish packages for Python 3.15 and building
its optional C extension fails there; see
https://webchanges.readthedocs.io/en/stable/introduction.html#install-windows. - New
xmltojsonandxmltoyamlfilters: they convert XML (e.g. an API response or a feed) to JSON or YAML using
thexmltodictpackage, so that changes are reported as readable keys and values; attributes become keys prefixed
with@.xmltojsonsupports the same sub-directives asformat-json. Install with
uv pip install --upgrade webchanges[xmltodict]. See
https://webchanges.readthedocs.io/en/stable/filters.html#xmltojson. - New
compactsub-directive of theformat-jsonfilter: removes all unnecessary whitespace. See
https://webchanges.readthedocs.io/en/stable/filters.html#format-json. - New
!envYAML tag: inserts the value of environment variables anywhere within a string value of the jobs or
configuration file. Reference a variable as${VAR}, or as${VAR:-default}to fall back todefaultwhen
the variable is not set; an unset variable without a default aborts the run with an error reporting the variable's
name and line. Useful to define a value shared by multiple jobs in a single place (e.g. a version number appearing
in multiple URLs and names, which can even be computed by a wrapper script before invoking webchanges) and to
keep secrets such as API tokens out of the YAML files. Suggested by Marcos Alano in
#99. See
https://webchanges.readthedocs.io/en/stable/advanced.html#using-environment-variables. - New
tagsjob directive: one tag, or a list of tags, grouping jobs so that they can be acted on together. Tags
are used by the new--tagscommand line argument and by the newtagsreporter directive (both below).
See https://webchanges.readthedocs.io/en/stable/jobs.html#tags. - New
--tagscommand line argument: runs only the jobs having any of the tags listed (comma-separated, and the
argument can be repeated), e.g.webchanges --tags personal,team. Can be combined with a joblist, in which case
both restrictions apply. See https://webchanges.readthedocs.io/en/stable/cli.html#tags-cli. - New
tagsreporter directive (accepted by every reporter): restricts the reporter to the jobs having any of the
tags listed. Reports so restricted note in their footer how many of the jobs run they cover, and a job that ends up
being reported by no reporter at all (typically a typo in a tag) is called out in a warning. See
https://webchanges.readthedocs.io/en/stable/reporters.html#reporter-tags. - A reporter can now be configured more than once, by replacing its single set of directives in the configuration
file with a list of them; each entry is an independent configuration of that reporter, and directives left out of
an entry take their default value. Combined with thetagsdirective above, this allows different jobs to be
reported to different destinations, e.g. to different email addresses or Telegram chats. See
https://webchanges.readthedocs.io/en/stable/reporters.html#multiple-reporters. - The
html2textfilter now JSON-decodes data whose media type is JSON and that consists entirely of a JSON string
(i.e. HTML returned inside a JSON-encoded string), so that its Unicode escape sequences are converted into the
characters they represent instead of being reported verbatim. - New
empty_as_errorjob directive: when the server or a command returns an empty response or output consisting
only of whitespace, or the filters leave nothing of it (e.g. anxpathselecting an element missing from a page
that did not render fully), it is treated as a transient error (with the synthetic HTTP response status code 999)
instead of as valid empty content, so the snapshot database retains the last non-empty content and a flaky site or
command that intermittently returns nothing no longer triggers a change report when the content "disappears" and
another one when it is restored. Combine withmax_triesto be notified only of persistent empty data, or set it
toignoreto never be notified of it. Suggested by Marcos Alano in
#169 and #195. See
https://webchanges.readthedocs.io/en/stable/jobs.html#empty-as-error. - New
markdown_extrasjob directive: sets the extras (https://github.com/trentm/python-markdown2/wiki/Extras) of
themarkdown2library used to render Markdown data as HTML in reports, in the same way as thehtml2text
filter passes its sub-directives to thehtml2textlibrary. Can be set for all jobs withjob_defaults. See
https://webchanges.readthedocs.io/en/stable/jobs.html#markdown-extras. - New
hook_datajob directive, for the code inhooks.py: it carries any data (typically a mapping of names to
values) from a job to the custom job, filter, differ or reporter Classes it uses, which read it as
self.hook_data(job) orself.job.hook_data(the others), so that one custom Class can serve many jobs. Unlike
directives declared by a custom job Class itself, it is known to the jobs file's JSON Schema, so editors don't flag
it as an error. See https://webchanges.readthedocs.io/en/stable/jobs.html#hook-data. - New
jobsandhooksconfiguration directives: they select the jobs and hooks files to use instead of the
defaultjobs.yamlandhooks.py, so that the--jobsand--hookscommand line arguments no longer need
to be typed at every run (they still override the directives). Each takes a file, a glob pattern or a directory, or
a list of these; relative paths are taken from the directory of the configuration file. Requested by drws in
#174. See
https://webchanges.readthedocs.io/en/stable/configuration.html#config-jobs. - The
--jobsand--hookscommand line arguments now also accept a directory, standing for all the*.yaml
(jobs) or*.py(hooks) files in its tree. See https://webchanges.readthedocs.io/en/stable/cli.html#cli-jobs.
Changed
- The error reported when an optional Python package needed by a filter, differ, reporter, job directive or database
engine cannot be imported now has the same form everywhere: it names what needs the package (and the job, if any),
the package to install, the underlying error, and the command to install it (e.g.
uv pip install --upgrade webchanges[pdf2text]). Previously the wording varied, mostly omitted how to install the
package, and sometimes named it in a way that cannot be installed (e.g.BeautifulSoupinstead of
beautifulsoup4). In particular, theemail(SMTP) andxmppreporters now report that thekeyring
package cannot be imported when they need it for a password, instead of reporting that no password is available. - The
jqfilter is now also available on Windows, as thejqPython library now publishes packages for it:
webchanges[jq]installs it on every operating system. See
https://webchanges.readthedocs.io/en/stable/filters.html#jq. - On Windows, the
stdoutreporter no longer depends on thecoloramapackage to display colors: it now enables
the console's native processing of ANSI escape sequences (supported since Windows 10), andcoloramahas been
dropped from the installation requirements. ai_googlediffer: the error summary for a transient Google AI API error (HTTP 429 or 503) that persists now
states how many automatic retries were made and for how long it waited in total, or that it was not retried, so
that a rate limit that outlasted the retries can be told apart from one that was never retried.cssandxpathfilters: theselectorandpathsub-directives respectively are no longer required when
excludeis specified; the filter then returns the whole document minus the excluded elements. See
https://webchanges.readthedocs.io/en/stable/filters.html#css and
https://webchanges.readthedocs.io/en/stable/filters.html#xpath.- Markdown emphasis markers (
_and*) within a word are no longer converted to emphasis when Markdown is
rendered as HTML (inhtmlandemailreports, and by thematrixreporter):snake_case_nameis now
shown as written instead of withcasein italics. Emphasis of whole words (_word_or*word*) and strong
emphasis (**word**) are unaffected. To reinstate it, use the newmarkdown_extrasjob directive (see above)
withmiddle-word-em: true. - The sub-directives of
job_defaultsin the configuration file are renamed after the job kind they apply to, so
that they can no longer be mistaken for the job directives of the same name:all_jobs,url_jobs,
browser_jobsandcommand_jobs. The previousall,url,browserandcommand(and the older
shell) continue to work unchanged. Suggested by drws in #173. See
https://webchanges.readthedocs.io/en/stable/configuration.html#job-defaults. - A header or cookie set to null (no value) in the
headersorcookiesdirective of a job, or ofurl_jobs
orbrowser_jobsinjob_defaults, now removes the one of the same name set in a less specific
job_defaultsentry, which is then not sent; previously, it was sent with the valueNone. Headers are merged
one at a time (job, then the job kind'sjob_defaults, thenall_jobs), ignoring case. See
https://webchanges.readthedocs.io/en/stable/jobs.html#headers and
https://webchanges.readthedocs.io/en/stable/jobs.html#cookies.
Deprecated
- The
remove-duplicate-linesfilter, inherited from urlwatch: useremove_repeatedwith
adjacent: false, which does the same. See https://webchanges.readthedocs.io/en/stable/filters.html#remove-repeated. - The
titlesub-directive of thegotifyreporter: usesubject(see Fixed, below).
Fixed
- In jobs with
use_browser: true, theignore_http_error_codesjob directive now also suppresses transient
HTTP errors (status codes 429, 500, 502, 503, 504, and the synthetic 999); previously it only matched
non-transient error responses. - A job containing both the
urland thecommanddirective is now rejected with an error, as the two are
mutually exclusive (each one identifies a different job kind). Such a job previously was erroneously accepted and
run as acommandone, silently ignoring the URL. - An HTTP 304 (Not Modified) response received while the job's consecutive-error counter was greater than zero (i.e.
the preceding run had failed) overwrote the stored snapshot with empty data, discarding the content and the ETag;
the following successful run then reported a spurious change. Only servers that reply 304 to an unconditional
request were affected, as webchanges strips the conditional request headers while retrying a failed job. - A dict-valued directive set in
job_defaultsfor one job kind (in practiceheaders) leaked into every other
job of the run, including jobs of a different kind: the defaults were merged into the shared class-level default
instead of into a copy of it. Headers set underjob_defaults.url(nowurl_jobs) were therefore also sent by
jobs withuse_browser: true, and appeared in the output of--test-diffand in any jobs file saved during that run. --rollback-database: the snapshots were deleted while computing the count displayed in the confirmation
prompt, i.e. before (and regardless of) the answer; declining did not prevent the deletion, and confirming
reportedNo snapshots foundas nothing was left to delete. In addition, the count itself was wrong (it
reported the number of rows affected by the previous database write rather than the number of snapshots to be
deleted).--rollback-database: a Unix timestamp with a fractional part (e.g.1789618017.98) was rejected as unparseable.- Reports of a transient HTTP error (status codes 429, 500, 502, 503, 504, and the synthetic 999) in
urljobs
withoutuse_browser: true, and incommandjobs, contained a full Python traceback instead of just the
error message, making a condition of the monitored resource look like a failure of webchanges. Jobs with
use_browser: truewere already reporting only the message. - The bundled
jobs.schema.jsonJSON Schema, used by editors to validate and autocomplete the jobs file, rejected
theocr,pdf2text,pypdf,remove-duplicate-lines,sha256sumandstriplinesfilters when
written without sub-directives, flagging valid jobs files as invalid. - The bundled
jobs.schema.jsonJSON Schema also rejected a filter's default sub-directive given directly (e.g.
html2text: bs4forhtml2text: {method: bs4}, orformat-json: 2) for thebeautify,csv2text,
format-json,html2text,jsontoyaml,pdf2text,pretty-xml,pypdf,remove-duplicate-lines,
remove_repeated,reverseandsortfilters, as well as any sub-directive ofpretty-xmland
remove-duplicate-lines. - The bundled
config.schema.jsonJSON Schema, used by editors to validate and autocomplete the configuration
file, marked every sub-directive of every reporter as required, flagging as invalid a configuration file from which
any of them had been trimmed. webchanges fills in any missing one with its default value, so none is required. - The
xmppreporter raised anAttributeErrorinstead of a clear error message when thekeyringPython
package is not installed and noinsecure_passwordis set. --detailed-versionscrashed with anUnboundLocalErrorwhen Playwright is installed butpsutilis not.- On Linux and macOS, webchanges could be killed by the operating system without reporting any error (exit
code 141) when a server it was sending data to closed the connection, e.g. a mail server while sending anemail
report, as it restored the system's default action for theSIGPIPEsignal. Such errors are now reported, while
output piped into a program that stops reading early (e.g.webchanges --list | head) still ends quietly. - The
emailreporter using thesmtpmethod, and--smtp-login, waited indefinitely for an SMTP server that
did not accept the connection or did not answer; they now give up after 60 seconds with a timeout error. See
https://webchanges.readthedocs.io/en/stable/reporters.html#smtp. - When
httpxis not installed (webchanges then usesrequestsor, failing that,curl_cffi), a job with
http_client: httpx, theimagediffer and the AI summaries (theai_googlediffer and theimagediffer's
ai_googlesub-directive) failed with an obscureAttributeError: theimagediffer now downloads images with
requests(orcurl_cffi), and the others report thathttpx, which they require, cannot be imported. - The
emailreporter using thesmtpmethod, and--smtp-login, could fail with
STARTTLS extension not supported by serveron a computer whose own hostname is slow to look up (e.g. because of
slow reverse DNS): the hostname, sent in theEHLOgreeting, was looked up after connecting, by which time the
server could have stopped waiting (e.g. Amazon SES replies451 4.4.2 Timeout waiting for data from client). It is
now looked up before connecting. - The
gotifyreporter'ssubjectsub-directive, which sets the message title and is the one shown in the
documentation, was flagged as unrecognized when the configuration file was loaded, while thetitleone listed in
the default configuration had no effect.subjectis now recognized, andtitleis deprecated and treated as
subject. See https://webchanges.readthedocs.io/en/stable/reporters.html#gotify. - The bundled
jobs.schema.jsonJSON Schema did not know thefingerprints,http_versionand
markdown_padded_tablesjob directives, nor the object form of thejqandelement-by-…filters (e.g.
jq: {query: …}), so editors flagged valid jobs files as invalid; it offered thedelayandstealthjob
directives, which do not exist; and it gave the deprecatedgrepandgrepifilters atextsub-directive
instead ofre. The deprecated job directivesdiff_tool,navigate,stderr,wait_forand
wait_for_navigationare now flagged by editors as deprecated rather than as invalid. - The deprecation warning of the
striplinesfilter named itstrip_each_line. - The
remove_repeatedfilter compared each line with the one before it as text contained within it rather than
as an equal line: withadjacent: true(the default), a line contained within the preceding one (e.g.ab
followed byb) was removed when it had also appeared earlier. - The
retriesjob directive, introduced in version 3.13, had no effect: a failed request was never retried. It
now retries, with any HTTP client, a request that fails with a connection error (e.g. a connection reset by the
server), a timeout, or a transient HTTP response (status codes 429, 500, 502, 503 and 504), waiting between
attempts for the time requested by the server'sRetry-Afterheader (up to 60 seconds) or else for 1, 2, 4...
seconds (up to 30). Other errors (e.g. a 404) are not retried. Reported by 101Dude in
#196. See https://webchanges.readthedocs.io/en/stable/jobs.html#retries. - The
ignore_dh_key_too_smalljob directive did not work: with the defaulthttp_client: httpxit made every
request to an HTTPS site fail withCERTIFICATE_VERIFY_FAILED(it replaced the verification of certificates
with one using no certificate authorities, and ignoredssl_no_verify), and withhttp_client: requestsit
had no effect with version 2.x of theurllib3library, which current versions ofrequestsinstall. With
both clients it now lowers the OpenSSL security level, so that a server's weak (1024-bit) Diffie-Hellman key is
accepted, while certificates are verified as usual. It remains unsupported byhttp_client: curl_cffi. See
https://webchanges.readthedocs.io/en/stable/jobs.html#ignore-dh-key-too-small. - With multiple jobs files,
--add,--deleteand--change-locationsaved all the jobs into the first file,
duplicating those of the other files into it (and the following run then failed on the duplicates). They now exit
with an error asking to select a single file with--jobs. See
https://webchanges.readthedocs.io/en/stable/cli.html#cli-jobs. - With multiple jobs files, the order in which they were combined, and with it the jobs' index numbers, could change
from run to run. They are now combined in the order given, with the files matching the same glob pattern or
directory in alphabetical order. - In jobs with
use_browser: true, aproxywithout credentials was sent with the username and password
None, and one without a port was ignored; credentials in the proxy URL are now also percent-decoded. See
https://webchanges.readthedocs.io/en/stable/jobs.html#proxy. - With
max_tries, the first error reported was flagged as a repeated one (the failures not yet reported had
stored the same error), so that withsuppress_repeated_errors: trueit was never reported, yet its end was. See
https://webchanges.readthedocs.io/en/stable/jobs.html#max-tries. - A job whose first run(s) failed was reported as changed (from no data) instead of as new when it first succeeded.
- The
telegramreporter mangled code blocks (e.g. the traceback of a differ error), could split a code block
across messages in a way that made a message longer than Telegram's maximum of 4096 characters, and merged a line
too long for one message with the following one. See
https://webchanges.readthedocs.io/en/stable/reporters.html#telegram.
Internals impacting hooks.py
FilterBase.raise_import_error(),DifferBase.raise_import_error()andReporterBase.raise_import_error()
now accept theImportErroritself as well as its message, and a new optionalextraargument naming the
webchanges extra that installs the package; they raise the standard error described above. The new
webchanges.util.missing_dependency()returns that error for code outside these classes.- Removed
webchanges.util.lazy_import()andwebchanges.util.import_optional_dependency(), which were no longer
used; use a plain import inside the function that needs the package, withmissing_dependency()for its
ImportError.
Internals
- Updated the vendored copy of
packaging(used as a fallback when thepackaginglibrary is not installed)
from v26.2 to v26.3. - CI: a release push updates two refs pointing to the same commit (the branch and the version tag, pushed
atomically), and each ref triggers its own workflow run; the branch run now detects that its commit is also tagged
on the remote and skips the test matrix, so the release test suite executes only once (in the tag's run). - tox: the
pre-commitenvironment now runspre-commit autoupdatebefore running the hooks, so hook version
updates are picked up as part of a normal local test run. - The fallback assignments of the optional imports (e.g.
httpx = Nonewhenhttpxcannot be imported) are now
hidden from the type checker, andraise_import_error()is annotated asNoReturn, restoring a clean
ty0.0.72 run. - The modules declare
__lazy_modules__(PEP 810, https://peps.python.org/pep-0810/), so that on Python 3.15 and
newer the standard-library and third-party modules they use only inside functions are imported when first needed,
speeding up start-up (e.g.webchanges --helpby about 8%); it has no effect on earlier Python versions. - Optional packages (e.g.
deepdiff,keyring,pypdf,beautifulsoup4,requests) are now imported
only by the code that uses them instead of when webchanges starts, so that a run only imports what its jobs and
reporters need: importing the modules of a run went from about 1.5 s to 0.45 s on Python 3.14, and from 0.95 s to
0.26 s on Python 3.15 (measured on Windows with all optional packages installed). - CI: the CodeQL workflow's analysis step had been mistakenly replaced by a second initialization step in version
3.34.2, so no code scanning results were produced since; it has been restored. - CI: the Redis storage tests never ran, as the
REDIS_URIenvironment variable they require was exported in a
step of its own and therefore lost before the tests ran. In addition, the workflow's token is now read-only except
in the deploy job, and test jobs time out after 30 minutes. - CI: before publishing, the deploy job now checks that the release tag matches both
__version__and the version
header of the topCHANGELOG.rstsection, and that this section is no longer dated "Unreleased". - CI: the test workflow runs on pushes only to the
mainandunreleasedbranches and to release tags, so that
a pull request's branch (e.g. a Dependabot one) is no longer tested twice, once for the push and once for the pull
request. - Testing: Python 3.15 and 3.15t replace 3.11 and 3.14t in the CI test matrix (and 3.15 replaces 3.11 in
tox), the
tests that run only on the latest Python version now run on 3.15, and a failing CI test job no longer cancels the
other ones. - Code modernized for Python 3.12 and newer: PEP 695 syntax for type aliases and generics.
- CI: removed the ClusterFuzzLite workflow, an unconfigured template (set up for C++, without fuzz targets) that
failed on every pull request. - Testing: the
jqfilter is now also tested on Windows and on free-threaded Python. - Testing: a new test checks that the code, the bundled JSON Schemas and the documentation list the same filters (and
their sub-directives), job directives and configuration directives, so that they no longer drift apart. - Testing: new tests of the classification of each run (new, changed, error, etc.) over consecutive runs, of the
httpx,requestsandcurl_cffiHTTP clients giving the same results, and of thetelegramreporter's
escaping and splitting into messages.