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 astror a path andextrasis a dictionary orNone. A fourth value was dropped without a word. A path returned alone, or theNoneof a lookup that found no webapp, failed further on, in an error that did not nameapp_map(), and astrof two letters was taken for asite_dirand asite_name. Anything but the two forms is now a500whose line in the log says whatapp_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_filecalls 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 replacingcylinder.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’scaploghas one, socaplog.textis 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 namedloggerorabort, it took the place of Cylinder’s own for every handler. One namede,remainder, orresponsewas dropped without a word, and one namedrequestmade every request a500. Each is now a500whose log names the extra, as a placeholder with such a name already was.site_nameis the name of one webapp, and not a path. The second value thatapp_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 outsidesite_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 ofsite_dir, as every other name is looked up in a listing, so a path names nothing there, which is a500, as below. Webapps in different directories differ insite_dir: see Several sites from one process.A Python file beneath a file server is sent, and a handler file is not.
static_filesent 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 asadmin.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()andapp_map()are read withinspect.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.pywas an error, and every request that looked in its directory got a500. That check is gone, with the rest of what was there only for someone who comes from an older release.An app has no
abortand noglobal_proxyattribute. The app thatget_app()returns had four attributes, and the reference listed two of them:test_client()andlogger. Of the other two,app.global_proxywas there for Cylinder’s own tests, which no longer read it, andapp.abortwas how the app kept theabortthat 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 sopip, said0.8.0. It is now"1.0.0". The tag of a release keeps itsv.A redirect needs a URL to send the client to.
abort(302)sent the client to/, and so did a location that wasNone. An empty location was sent as it was, and one inbyteswas sent asb'/login'. A browser keeps a301as the new address of a page, so such a mistake in a handler could not be taken back. Each is now a500whose 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 aTypeError, 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 forrequest_id, the ID that the log records of the request carry. A500handler 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 namedrequest_idis 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 was302 HTTPRedirect: /login, and is now302 Found: /login, ase.nameisFound.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 a404was sent the site’s404page. 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 givenNone, anddef main(*, response)was a500. Parameters are matched by name, so such a parameter is now given the value of its name, as any other is.A
site_dirthat is not a directory, or asite_namethat names nothing in it, is a500. Either found nothing, so every URL was a404, 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 *importsget_appandstatic_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
405and416took it as something else. A405took it for the methods of itsAllowheader, soabort(405, "Only POST")sentAllow: O, n, l, y, ...and kept its own description, and a416took it for the length of a file, and sent it in aContent-Rangeheader.abort()now passes the argument to the class of any status but a redirect by name, as the reference said, and a class registered withabort_extrais given it in the same way. Anything else that a class takes is passed by name too, such asabort(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
500handler raised, calledabort(500), or could not be run, Cylinder sent a new500that had nothing of the response before it. The headers that hooks had set were gone, no late hook ran, and what was registered withresponse.call_on_close()never ran, so a site that closes its database connection that way left one open for each such request. The500now takes the place of the response as any error does, and what the500handler 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
Locationas 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 withresponse.call_on_close()never ran. A redirect to thenextof a login form could be made to do it by whoever wrote the link. Such a response is now a plain500, 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 whereabort()is called: the500handler 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 new500that 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 said200, and for a header that the server refused, what was registered withresponse.call_on_close()never ran. The test client took both, so the tests of an app passed. Each is now a plain500, logged, with its cleanup, as a response that cannot be sent is: see Cylinder always answers.A file that
static_filecannot open is answered by Cylinder. The file was opened when its first byte was sent, after the server had been given the headers of a200. 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, the500handler did not run, and Cylinder’s log said200with nothing of why. The file is now opened beforestatic_filereturns, so such a file is a500that the500handler answers, with its traceback in the log. AHEADrequest for it is the same500, as aHEADrequest answers as itsGETdoes.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. The500handler and the late hooks for the path of the directory, and for every path above it, now run for it.static_fileanswersIf-MatchandIf-Unmodified-Sinceitself. Werkzeug sent the whole file with the412of a tag that was not the file’s, tookIf-Match: *for such a tag, and did not look at the header for aRangethat it could serve, so a download in parts went on with a file that had changed. It did nothing withIf-Unmodified-Since. A request whoseIf-Matchfails is now aborted with a412, before any other header is looked at, and so is one with noIf-Matchand anIf-Unmodified-Sincethat the file is newer than.A
Hostheader cannot send an exception to the server. Cylinder readrequest.urlfor its log before anything could catch what that raises, and Werkzeug raises for aHostthat 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 throughlogging.getLogger("cylinder.billing"), had norequest_idand notimestamp, 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_fileheld back a file whose name had the whole suffix of a handler file in it, asadmin.hook.early.py~has. A copy that is named before the.pydid not: a file server sent the source ofadmin.hook.early - Copy.py, which is what Windows names a copy, and ofadmin.404.old.py. A name is now held back if it has the part that says what a handler file is, with.pyanywhere after it.An error is not saved as the download that it took the place of. A
Content-Dispositionheader that was set before a request was aborted stayed on the error response, and on a redirect and on the500for 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-Dispositionis 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 againstContent-Digest,Repr-Digest, andDigest. AndX-Accel-RedirectandX-Sendfiletell 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
Rangerequest reads the part of a file that it is sent.static_fileread 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 themain()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 a401got a500, no late hook ran on that500, so a header set in one was missing from it, and an error handler file that failed got a plain500without the500handler. Each file is now run from its first line when it is about to answer, and one that fails outsidemain()is answered as one whosemain()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 theDEBUGlines 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 anapp_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 a500for 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 anapp_map()that is a partial or an object that can be called, the message could not be built, and anAttributeErrortook its place. The message now starts with the path of the handler file, or withapp_map(), and asks the function for nothing.static_filetakes theContent-Typefrom 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.mjstext/plain. A browser does not run a module script that is sent astext/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.typesis now sent asapplication/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(), andResponse.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 theETagof 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 theLast-Modifiedof a file that a late hook refused.static_filestill callsResponse.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.pycan change in any release. Therequestandresponseare 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
500for a response that cannot be sent among the statuses that Cylinder produces, and says thatapp_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 withabort_extra. It said that Werkzeug knows the standard HTTP errors. It also says that such a class can be raised where noabort()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.
storewas 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, aswaitress.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
500that 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
%2Fbefore 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
SystemExitofsys.exit(), reaches the WSGI server. It said that no exception does.Static files says that
script.js.brisapplication/javascriptbefore Python 3.12. It gavetext/javascriptalone.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
remainderholds every segment of the path where no page handler serves the URL, as a hook or an error handler then sees it. It said thatremainderis[]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 a415.Errors and redirects says that
abort()is the one that Cylinder passes in, with the redirects and the codes inabort_extra, and notwerkzeug.exceptions.abort(), which raises aLookupErrorfor 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 theOPTIONSrequest 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 --fixdeletes 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 a500, unless the code setsrequest.shallow = Falsefirst. 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(), andrequest.get_data()return what they returned to the page handler. If an error handler or a late hook reads the request body, putrequest.shallow = Falsebefore the line that reads it. See Only a page handler reads the request body.An uncaught exception is logged whether or not a
500handler answers for it. Cylinder logged the traceback only where a site had no500error handler, and left it to the handler where it had one. A500handler 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 the500handler is looked for. The same goes for an exception in another error handler or in a late hook, and forabort(500). If your500handler 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
.pywas taken for a Python file, sosummary.pypi.csvandhappy.pyramid.pnggot a404. A file is now kept back where its name has.py,.pyand one more letter, such as.pyc, or.pyzw, with no letter after it:handler.py~,handler.py.bak, andhandler.py2are kept back as before. A file whose name has.pywith 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, ashandler.pybakis, 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.pathinto theLocationof 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 withurllib.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 astrthat is not ASCII, so a client that sent such a token got a500where it should get a401. 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.earlyor.hook.late, and no longer for a method. A hook was named for a method, as a page handler is:admin.early.get.pyran forGET, andadmin.early.default.pyfor 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.getdid not run for aPOST. A hook for one method, put beside a.defaulthook, ran in its place: addingadmin.early.post.pytook the login check inadmin.early.default.pyaway from everyPOST. And a method that no file can be named for ran only the.defaulthooks. 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 checksrequest.method. The wordhookin the middle keeps every filename to one reading:book.page.early.pyis the page that answers a method calledEARLY, and cannot be taken for a hook. Rename every hook file when you upgrade. A.defaulthook is renamed as it is. A hook that was named for a method now runs for every method, so give it a check onrequest.methodfirst, and remember that a.gethook ran forHEADtoo. 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 a500, and the log says what to name the file. This script renames the.defaulthooks 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")
__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 asusers.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
@dataclassunderfrom __future__ import annotations, or with any annotation written as a string, answered every request with a500. The traceback ended insidedataclasses, withAttributeError: 'NoneType' object has no attribute '__dict__'. To read an annotation that is a string,dataclasseslooks up the module of the class insys.modules, and Cylinder ran a handler file as a module that was not there. A handler file is now insys.modulesunder 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 inmain()that looks up the module of a class, aspickledoes, 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 ofapp_map()and of everymain()withinspect.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.