Changelog

What changed in each release. Entries under a Changed heading can affect an existing app when you upgrade. From 1.0, such a change comes only in a release with a new major number: see what is promised.

1.0.0

Changed in 1.0.0

  • Cylinder needs Python 3.11 or newer. It ran on 3.10, which reached the end of its life in October 2026 and gets no more security fixes. The tools that build and check Cylinder had stopped installing on it, and the next Werkzeug needs 3.11 as well.

  • What app_map() returns is checked. It returns (site_dir, site_name) or (site_dir, site_name, extras), where the first two are a str or a path and extras is a dictionary or None. A fourth value was dropped without a word. A path returned alone, or the None of a lookup that found no webapp, failed further on, in an error that did not name app_map(), and a str of two letters was taken for a site_dir and a site_name. Anything but the two forms is now a 500 whose line in the log says what app_map() must return, and the types of what it returned.

  • Cylinder is installed with a Werkzeug older than 3.2. The package asked for 3.1.7 or newer, with no upper bound, so an installed copy would have taken any later Werkzeug as it came, the one that takes away what static_file calls among them. It now allows the releases that its tests have run on. The design notes say why, and when the bound is raised.

  • A log handler keeps a formatter of its own. get_app() gave its format to every handler that it was passed, so a handler that came with a formatter lost it, and the format could be changed only by replacing cylinder.log_formatter. A handler that has a formatter now keeps it, and that is how the format is changed: see Where logs go. A handler that has none is given Cylinder’s format, as before. The handler of pytest’s caplog has one, so caplog.text is in pytest’s format where it was in Cylinder’s.

  • An extra parameter cannot have the name of one that Cylinder passes itself. Where app_map() returned an extra named logger or abort, it took the place of Cylinder’s own for every handler. One named e, remainder, or response was dropped without a word, and one named request made every request a 500. Each is now a 500 whose log names the extra, as a placeholder with such a name already was.

  • site_name is the name of one webapp, and not a path. The second value that app_map() returns was joined to the first as a path, so it could be "group/site", an absolute path, or empty. A path could start a site below the hooks at its root, an absolute one served a directory outside site_dir, and a directory in it could be found in another letter case where the filesystem ignores case. The name is now looked up as it is in the listing of site_dir, as every other name is looked up in a listing, so a path names nothing there, which is a 500, as below. Webapps in different directories differ in site_dir: see Several sites from one process.

  • A Python file beneath a file server is sent, and a handler file is not. static_file sent no file with an extension that Python gives to code. The rule is from the time when a file was sent wherever it lay, and it kept a page from loading Python that runs in the browser, as Brython does. What is never sent now is the code that runs in the site: a file with the name of a page handler, a hook, or an error handler, and a copy of one such as admin.hook.early.py~. Any other Python file is a file like any other, so a module of your own is sent where a handler serves the directory that it is in. See What is never served.

  • The parameters of every main() and app_map() are read with inspect.signature(). A plain function was read in a faster way of Cylinder’s own, which is gone: it was a second way to do one thing. A request takes longer for it, by about a quarter on Linux and an eighth on Windows where it was measured, which was 25 to 35 microseconds and 75 to 90.

  • A file with the name that a hook once had is a file like any other. A file such as admin.early.default.py was an error, and every request that looked in its directory got a 500. That check is gone, with the rest of what was there only for someone who comes from an older release.

  • An app has no abort and no global_proxy attribute. The app that get_app() returns had four attributes, and the reference listed two of them: test_client() and logger. Of the other two, app.global_proxy was there for Cylinder’s own tests, which no longer read it, and app.abort was how the app kept the abort that it passes to handlers. Both are gone, so the app has the two attributes that the reference lists.

  • The module says its version, and nothing else about itself. cylinder.__author__, __credits__, __email__, __status__, __license__, and __copyright__ are gone. The package metadata has the authors and the license, and two of the six disagreed with it.

  • cylinder.__version__ is the number alone. It was "v0.8.0", where the package metadata, and so pip, said 0.8.0. It is now "1.0.0". The tag of a release keeps its v.

  • A redirect needs a URL to send the client to. abort(302) sent the client to /, and so did a location that was None. An empty location was sent as it was, and one in bytes was sent as b'/login'. A browser keeps a 301 as the new address of a page, so such a mistake in a handler could not be taken back. Each is now a 500 whose log says that the redirect has no URL. See Redirects.

  • The options of get_app() are passed by name. get_app(app_map, logging.INFO) set the log level. It is now a TypeError, so that a release can add an option, or put them in another order, without breaking an app.

  • app_map() and every handler can ask for request_id, the ID that the log records of the request carry. A 500 handler can give it to the visitor, so that the log lines of a report can be found: see Request IDs. It was in no parameter, and a handler that wanted it had to read Cylinder’s internals. An extra or a placeholder named request_id is now refused, as one with the name of any other parameter that Cylinder passes is.

  • A redirect says its status in words. str(e) of a redirect in a late hook was 302 HTTPRedirect: /login, and is now 302 Found: /login, as e.name is Found.

  • abort(response) sends the response as it is. The error handler file for its status ran, and could replace what was set on it: a page that built a JSON body for a 404 was sent the site’s 404 page. No error handler runs for it now, as none runs for a redirect, and the late hooks still do. See Ending a request with the response itself.

  • A parameter after a * is passed in. def main(response, *, logger=None) was given None, and def main(*, response) was a 500. Parameters are matched by name, so such a parameter is now given the value of its name, as any other is.

  • A site_dir that is not a directory, or a site_name that names nothing in it, is a 500. Either found nothing, so every URL was a 404, and the log said nothing of why. A relative path that is read from another working directory is the usual cause of the first, and a misspelled name of the second. The line in the log now names the path or the name.

  • from cylinder import * imports get_app and static_file. __all__ lists the names that the reference promises. Every other name in the module can change in any release.

  • The argument after the status of an error is its description. Werkzeug’s classes for 405 and 416 took it as something else. A 405 took it for the methods of its Allow header, so abort(405, "Only POST") sent Allow: O, n, l, y, ... and kept its own description, and a 416 took it for the length of a file, and sent it in a Content-Range header. abort() now passes the argument to the class of any status but a redirect by name, as the reference said, and a class registered with abort_extra is given it in the same way. Anything else that a class takes is passed by name too, such as abort(405, "Only POST", valid_methods=["POST"]).

Fixed in 1.0.0

  • A request whose error handling fails keeps its headers, its late hooks, and its cleanup. Where the 500 handler raised, called abort(500), or could not be run, Cylinder sent a new 500 that had nothing of the response before it. The headers that hooks had set were gone, no late hook ran, and what was registered with response.call_on_close() never ran, so a site that closes its database connection that way left one open for each such request. The 500 now takes the place of the response as any error does, and what the 500 handler itself had set or registered before it failed is kept as well: see Cylinder always answers.

  • A response that cannot be sent is answered by Cylinder. Werkzeug reads a Location as a URL when it writes the headers of a response, and raises for one that it cannot read, such as //[. That was after Cylinder had finished with the request, so the exception went to the WSGI server: nothing was logged, and what was registered with response.call_on_close() never ran. A redirect to the next of a login form could be made to do it by whoever wrote the link. Such a response is now a plain 500, logged, with its cleanup. A redirect does better. abort() makes its response and reads its URL as Werkzeug does, so a redirect that cannot be sent is an error where abort() is called: the 500 handler answers it, and the late hooks run on it. That goes for a URL with a line break in it too, which no header can hold. Such a redirect got a new 500 that had nothing of the response before it.

  • A response that the server refuses, or cannot write, is answered by Cylinder. A server checks the headers when it is given them, and Waitress and wsgiref refuse one that only a server may send, such as Connection. A server writes the headers in Latin-1 once Cylinder has returned, and fails on a character that Latin-1 does not have, as in the filename of a download. Either way the server sent a response of its own while Cylinder’s log said 200, and for a header that the server refused, what was registered with response.call_on_close() never ran. The test client took both, so the tests of an app passed. Each is now a plain 500, logged, with its cleanup, as a response that cannot be sent is: see Cylinder always answers.

  • A file that static_file cannot open is answered by Cylinder. The file was opened when its first byte was sent, after the server had been given the headers of a 200. So a file that another program had locked, or that the user the server runs as may not read, failed in the server: the visitor got the server’s own error or a body cut short, the 500 handler did not run, and Cylinder’s log said 200 with nothing of why. The file is now opened before static_file returns, so such a file is a 500 that the 500 handler answers, with its traceback in the log. A HEAD request for it is the same 500, as a HEAD request answers as its GET does.

  • A placeholder that is refused is answered by the files above it. A second placeholder in one directory, or one with the name of another parameter, got a plain 500: no error handler ran and no late hook, so a header that a late hook at the root sets was missing from it. The 500 handler and the late hooks for the path of the directory, and for every path above it, now run for it.

  • static_file answers If-Match and If-Unmodified-Since itself. Werkzeug sent the whole file with the 412 of a tag that was not the file’s, took If-Match: * for such a tag, and did not look at the header for a Range that it could serve, so a download in parts went on with a file that had changed. It did nothing with If-Unmodified-Since. A request whose If-Match fails is now aborted with a 412, before any other header is looked at, and so is one with no If-Match and an If-Unmodified-Since that the file is newer than.

  • A Host header cannot send an exception to the server. Cylinder read request.url for its log before anything could catch what that raises, and Werkzeug raises for a Host that it cannot make a URL of, such as [::1.2.3.999]. One header from any client was a traceback in the server, with no line in Cylinder’s log and no hook run. The URL in the log is now put together without it, in ASCII with everything else percent-encoded, so /é is logged as /%C3%A9. A log file in an encoding that could not hold a character of a URL lost the line for that request, and no longer does.

  • The method of a request is logged in ASCII, as its URL is. A client can put any characters in the method, and Werkzeug’s development server and wsgiref pass them on. They were written to the log as they came: an escape sequence that a terminal acts on, and a character that a log file in another encoding could not hold, so that it lost the line. The method is now percent-encoded as the URL is, all but the characters that HTTP allows in one.

  • A record from a logger beneath the app’s own is written. A record logged through logger.getChild("billing"), or through logging.getLogger("cylinder.billing"), had no request_id and no timestamp, so it could not be formatted, and was lost with an error on standard error.

  • A copy of a hook or of an error handler is not sent. static_file held back a file whose name had the whole suffix of a handler file in it, as admin.hook.early.py~ has. A copy that is named before the .py did not: a file server sent the source of admin.hook.early - Copy.py, which is what Windows names a copy, and of admin.404.old.py. A name is now held back if it has the part that says what a handler file is, with .py anywhere after it.

  • An error is not saved as the download that it took the place of. A Content-Disposition header that was set before a request was aborted stayed on the error response, and on a redirect and on the 500 for an uncaught exception. So where a late hook refused a download, a browser saved the error page as a file, under the name of the download. Cylinder left behind the headers on a list that it took from Werkzeug, and this one was not on it. Content-Disposition is now left behind, and so are five more that say something about a body that is gone, or what to do with it. A client checks the body against Content-Digest, Repr-Digest, and Digest. And X-Accel-Redirect and X-Sendfile tell a proxy to send a file in place of the body, so a proxy was still told to send a file that a late hook had refused. What survives an abort lists every header that is not kept.

  • A Range request reads the part of a file that it is sent. static_file read a file from its start up to the end of the range, and sent the range alone. Where it was measured, a request for the last 864 bytes of a file of 64 megabytes read all of it, which is what a player asks for when a visitor skips to the end of a video. The file is now read from the first byte of the range. What a client is sent is as it was.

  • A handler file is run when its turn comes, and not when it is found. Cylinder ran the code outside main() of every file of a request, the page and the late hooks among them, before the main() of the first early hook. So the top of a page ran for a request that an early hook then turned away. And a file that failed there, as one with a syntax error does, was answered before any hook had run: a visitor that a hook would have turned away with a 401 got a 500, no late hook ran on that 500, so a header set in one was missing from it, and an error handler file that failed got a plain 500 without the 500 handler. Each file is now run from its first line when it is about to answer, and one that fails outside main() is answered as one whose main() raises.

  • The log gives the path of a handler file, without a number after it. While two requests run the top-level code of one handler file at once, the module of the second is named for the path with a number after it, such as users.page.get.py#2. Cylinder wrote that name into its own log: in the DEBUG lines that say which file a request was passed to and how long the file took, and in the error for a parameter that is not there. Those now give the path of the file, which is the same for every request. __name__ in the file itself is as it was.

  • The time that a request took is measured on a clock that only goes forward. Cylinder read the system clock when a request arrived and again when it was answered, and logged the difference. When that clock was corrected in between, as a time service corrects it, the time in the log was too long, too short, or less than zero. The times in the log, for each request and for each handler file, are now measured with time.perf_counter().

  • An annotation that cannot be run no longer stops a handler that is not a plain function. Since Python 3.14 an annotation is run when something asks for it, and not where it is written. For a main() or an app_map() that is a decorated function, a method, a partial, or an object that can be called, Cylinder asked. So one with an annotation that names a type which only a type checker imports got a 500 for every request. Cylinder now reads the parameters without running the annotations. A plain function was not affected.

  • The error for a parameter that is not there does not need the function to have a name. For a main() or an app_map() that is a partial or an object that can be called, the message could not be built, and an AttributeError took its place. The message now starts with the path of the handler file, or with app_map(), and asks the function for nothing.

  • static_file takes the Content-Type from Python, and not from the machine. It took the type from what the machine said, which on Windows is the registry, where a program can have named .mjs text/plain. A browser does not run a module script that is sent as text/plain. The type now comes from Python’s own table, so a file is sent with the same type on every machine that runs the same Python. Before Python 3.14 that table has no fonts, so a font that Linux gave a type in /etc/mime.types is now sent as application/octet-stream, which a browser loads as a font all the same: see Static files.

  • A request that fails lets go at once of what its handler held. Its exception was kept with the request, and an exception refers to the frames that it was raised through. So every variable of a handler that raised, a connection from a pool among them, was kept until the garbage collector ran. Where it was measured, five failed requests left five connections out of their pool. In an outage, where every request fails, a pool could run dry.

Improved in 1.0.0

  • Cylinder does three things itself that it asked Werkzeug for. The development branch of Werkzeug 3.2, as it stood in December 2026, marks get_path_info(), is_entity_header(), and Response.set_etag() for removal in 4.0. Cylinder now reads the path of a URL from the WSGI environment, keeps its own list of the headers that an error does not carry over, and sets the ETag of a static file as a header. That changes nothing that a client is sent, on any Werkzeug. With 3.2 something would have changed: Werkzeug’s list of those headers is cut from ten to four there, and an error would have carried over the Last-Modified of a file that a late hook refused. static_file still calls Response.make_conditional(), which that branch marks too, because what takes its place is in no earlier Werkzeug. Cylinder’s own tests now fail on any warning, so the next call that is marked is seen when its warning first appears. The design notes have the rest.

  • The package on PyPI says that it is stable, and links to the documentation, the changelog, and the issues. Its summary is the line that the README starts with: a small WSGI web framework where the filesystem is the routing table.

  • help(cylinder.get_app) says what the function does, and where the reference is.

Documentation in 1.0.0

  • The reference says what is promised: from 1.0, Cylinder follows semantic versioning, and what the reference lists is what a release with the same major number keeps. Every other name in cylinder.py can change in any release. The request and response are Werkzeug’s, and a release that allows a Werkzeug with a new minor number, which can take away what an earlier one deprecated, has a new minor number itself. The security policy says that a security problem is fixed in a new release, and not in older ones. The reference also promises two things that only the guide said: a handler file runs as a new module for every request, and the headers and cookies that were set before an abort stay on the error, except the ones that describe its body. A release that needs a newer Python or Werkzeug has a new minor number, and so does one that allows a newer Werkzeug. A parameter is added only in a release with a new major number, because no extra or placeholder may have the name of one.

  • The reference lists the plain 500 for a response that cannot be sent among the statuses that Cylinder produces, and says that app_map() can return a list as well as a tuple.

  • Errors and redirects shows Werkzeug’s default page for a status as Werkzeug sends it. A formatter had rewritten it in the page.

  • Errors and redirects lists the error statuses that Werkzeug has no class for, which abort() raises once a class for each is registered with abort_extra. It said that Werkzeug knows the standard HTTP errors. It also says that such a class can be raised where no abort() is at hand. The skill file says that “no exception for” in the log is a status with no class, where it said a status that is not an error.

  • Large applications and the skill file no longer give one file two URLs. store was the webapp in one place and a directory in it in another.

  • Operations says how to send Cylinder’s records to the root logger. get_app() takes off the handlers that were on its logger and keeps its records from going on, so that a server that sets up the root logger afterwards, as waitress.serve() does, does not write each line twice. Nothing said so.

  • Operations says which header to name in request_id_header: one that your proxy sets on every request, in place of what a client sent. Cylinder uses the value as it arrives, so with any other header a client chooses the ID that its requests are logged under. The security checklist says so too.

  • The contributing guide describes a third job in CI, which runs the tests on Windows and on macOS. The tests for junctions and for names in another letter case ran only on the machine of whoever ran them. A fourth job runs them on Python 3.12, 3.13, and 3.14, which the package is listed for and CI had not tested. A failure in any of the jobs holds up a merge, where only one in the first job did. The guide no longer asks for Java: the linters for HTML, CSS, and JavaScript had nothing to check but placeholder files, and are gone.

  • Hooks and the security checklist say which response a late hook does not reach: the plain 500 that takes the place of a response that cannot be sent at all. Hooks said that a header set in a late hook is never skipped.

  • Routing says that the value of a placeholder never holds a slash: the server decodes %2F before the path is split. It said that the value is the segment that the client sent.

  • Errors says that an exception that Python raises to stop a program, such as the SystemExit of sys.exit(), reaches the WSGI server. It said that no exception does.

  • Static files says that script.js.br is application/javascript before Python 3.12. It gave text/javascript alone.

  • Routing and Hooks say that an error handler ends in its status. They said that every handler file ends in three parts.

  • Operations and the security checklist say that Cylinder keeps nothing of one request for the next. They said that it keeps no state between requests, where it keeps the compiled code of handler files and the listings of directories.

  • The skill file says that remainder holds every segment of the path where no page handler serves the URL, as a hook or an error handler then sees it. It said that remainder is [] unless the handler is a .tree. one.

  • Handlers says when a late hook that reads the body fails: at once where the page handler reads nothing, and otherwise on the first request that no page handler read, such as one that an early hook turned away. It said that such a hook fails the first time it runs. Handlers and the skill file also say that request.get_json() in a hook reads nothing for a body that is not JSON, and raises a 415.

  • Errors and redirects says that abort() is the one that Cylinder passes in, with the redirects and the codes in abort_extra, and not werkzeug.exceptions.abort(), which raises a LookupError for them.

  • Design notes is a new page for someone who reads or changes the framework itself. It says why the code is written the way it is, with what was measured and what was considered and not done: why a name is looked up in a listing, what is kept between requests, and why a handler file is run for every request. The longer of those reasons were comments in the code, and the code is shorter for it.

  • The home page no longer keeps a link target for each section that the README of v0.2.3 links to, and the pages no longer say what to do with a hook that still has the name it had before 0.7.0.

  • The README and the home page say how Cylinder differs from what you might use in its place: from Flask, FastAPI, and Django, where routes are registered in code, and from other file-based routers.

  • Limits is a new page that says what Cylinder does not do, and what to use in its place. The list was in Large applications, which now points to the page, and the home page had part of it.

  • The security checklist says that nothing in a request is checked: Cylinder has no schemas and no typed parameters, so a handler checks what it uses.

  • The skill file for AI assistants is rewritten around what an assistant needs to build an app. It now gives the order a request runs in, the content type that a response starts with, how a hook passes data to a page or answers a request itself, how to make the errors of an API JSON, and what Cylinder leaves to other libraries. It no longer says that a file with the name a hook once had is an error, which has not been true since such a file became a file like any other, and it no longer links to the design notes and the changelogs, which no app needs. AI assistants no longer says what is in the skill file, or lists the raw Markdown of each page: the skill file links the pages that an app needs.

  • Errors and redirects says that abort() can be given the response itself, which ends a request with a response of your own making. Nothing said so. Hooks has an example that uses it to answer the OPTIONS request that a browser sends before a cross-origin one.

  • Static files says that a linter reports the one-line file server as an unused import, that ruff check --fix deletes it, and how to mark the line.

0.8.0

Changed in 0.8.0

  • Only a page handler reads the request body without saying so. app_map() and early hooks were already given a request whose body could not be read. Error handlers and late hooks were not, so the body of a request that an early hook had turned away could still be read by the error handler that answered it, or by a late hook. They are now given the same request as an early hook: reading the body there raises an error, and the request gets a 500, unless the code sets request.shallow = False first. That holds on every request, so a late hook that reads the body fails the first time it runs, and not the first time a visitor is turned away. What a page handler has already read is still there for them: request.form, request.get_json(), and request.get_data() return what they returned to the page handler. If an error handler or a late hook reads the request body, put request.shallow = False before the line that reads it. See Only a page handler reads the request body.

  • An uncaught exception is logged whether or not a 500 handler answers for it. Cylinder logged the traceback only where a site had no 500 error handler, and left it to the handler where it had one. A 500 handler that only built the error page, as the two-line ones in Building a JSON API do, kept every traceback out of the log. The traceback is now logged before the 500 handler is looked for. The same goes for an exception in another error handler or in a late hook, and for abort(500). If your 500 handler logs the traceback, take that line out, or every traceback is logged twice. See Uncaught exceptions.

  • A file is kept back as Python only where its name has a Python extension. Beneath a handler that serves files, any name that contained .py was taken for a Python file, so summary.pypi.csv and happy.pyramid.png got a 404. A file is now kept back where its name has .py, .py and one more letter, such as .pyc, or .pyzw, with no letter after it: handler.py~, handler.py.bak, and handler.py2 are kept back as before. A file whose name has .py with two or more letters straight after it, other than .pyzw, is now sent where a handler serves its directory. If you keep a copy of source under such a name, as handler.pybak is, move it out of the directories that are served. See What is never served.

Documentation in 0.8.0

  • The hook that redirects a stray slash could send a visitor to another site. The hook in the guide put request.path into the Location of its redirect as it was. That path has the client’s percent-encoding undone, so /%09/evil.example/ was sent on to //evil.example, which a browser reads as another site, and /a%3Fb/ to /a?b. The hook now encodes the path again with urllib.parse.quote(). If you copied the hook from the guide, copy it again. Security has a new section on where a redirect may go.

  • The token check in Protecting a section compares bytes. hmac.compare_digest() raises an error for a str that is not ASCII, so a client that sent such a token got a 500 where it should get a 401. If you copied that hook, add the two .encode() calls.

  • Handlers says why only a page handler reads the request body: a request is let in before anything is done with its body, and code that reads the body by mistake fails at once. It shows how a hook that needs the body, as a CSRF check on a form field does, opts in after its other checks.

  • The skill file for AI assistants named hooks as they were named before 0.7.0 in its list of filenames, so an assistant could write a hook that is now an error. It names them as they are.

  • The title of every page said that the documentation was for version 0.4. It now gives the version in the code.

  • The contributing guide gives the Python that its tools need, 3.12, and the command that enters a virtual environment outside Windows. It also says that the workflow which turns on auto-merge is started only because an Actions policy in the settings of the repository allows its event.

  • The releases before 0.5.0 have moved to a page of their own, because this page had reached the length that every page is kept under.

0.7.0

Changed in 0.7.0

  • A hook is named .hook.early or .hook.late, and no longer for a method. A hook was named for a method, as a page handler is: admin.early.get.py ran for GET, and admin.early.default.py for every method that had no hook of its own at that path. So a check in a hook could miss a method, in three ways. A hook named .get did not run for a POST. A hook for one method, put beside a .default hook, ran in its place: adding admin.early.post.py took the login check in admin.early.default.py away from every POST. And a method that no file can be named for ran only the .default hooks. A hook now runs for every request beneath its path, whatever the method, and is named for what it is: admin.hook.early.py, admin.hook.late.py. One that treats a method differently checks request.method. The word hook in the middle keeps every filename to one reading: book.page.early.py is the page that answers a method called EARLY, and cannot be taken for a hook. Rename every hook file when you upgrade. A .default hook is renamed as it is. A hook that was named for a method now runs for every method, so give it a check on request.method first, and remember that a .get hook ran for HEAD too. Where a path had both, put the two into one file. A file that keeps its old name is an error, and is not passed over: every request that looks in its directory gets a 500, and the log says what to name the file. This script renames the .default hooks beneath the directory it is run in, and lists the others for you to do by hand:

    # rename_hooks.py: run it once, in the directory that holds your webapps
    import pathlib
    import re
    
    for path in sorted(pathlib.Path(".").rglob("*.py")):
        old = re.fullmatch(r"(.+)\.(early|late)\.([a-z]+)\.py", path.name)
        if old and old[3] == "default":
            path.rename(path.with_name(f"{old[1]}.hook.{old[2]}.py"))
        elif old:
            print(f"by hand: {path} was for {old[3].upper()} only")
    

    See Hooks and HTTP methods.

  • __name__ in a handler file can have a number after the path. It was always the path of the file. It still is, except while another request is running the top-level code of the same file: for that long it is the path with a number after it, such as users.page.get.py#2. Each request runs a handler file as a module of its own, and the fix below needs each of those modules to have a name that no other has. The second request is given another name, and does not wait for the first. If a handler file uses __name__ as its path, use __file__ there. See What belongs at the top of a handler file.

Fixed in 0.7.0

  • A dataclass in a handler file can have annotations that are strings. A handler file that defined a @dataclass under from __future__ import annotations, or with any annotation written as a string, answered every request with a 500. The traceback ended inside dataclasses, with AttributeError: 'NoneType' object has no attribute '__dict__'. To read an annotation that is a string, dataclasses looks up the module of the class in sys.modules, and Cylinder ran a handler file as a module that was not there. A handler file is now in sys.modules under its __name__ while its top-level code runs, as a module that is being imported is, so any other library that looks up the module of a class as the class is built finds it too. It is taken out again once that code has run, so that nothing is kept from one request to the next. Code in main() that looks up the module of a class, as pickle does, therefore still fails: define such a class in a module that the file imports.

Improved in 0.7.0

  • Requests are faster. Three things that Cylinder did for every request took longer than they had to. It resolved the directory that holds the webapps through pathlib, which takes half as long again as asking the operating system. It read the parameters of app_map() and of every main() with inspect.signature(), where a plain function can be asked itself. And it made the import spec of each handler file anew, which it now keeps with the compiled code of the file. In a benchmark of small pages, a request took 35% to 37% less time on Linux and 23% less on Windows. How a request is answered has not changed, and a handler file still runs for every request.

Older releases

Releases before 0.7.0 are on a page of their own.