Timeline



Mar 18, 2021:

5:16 PM Documentation edited by schwa
(diff)
5:14 PM Milestone 5.0.1 completed
5:13 PM Changeset [2068:2503abd0b568]default by Stefan Schwarzer <sschwarzer@…>
Added tag release5_0_1 for changeset d51581372627
5:13 PM ftputil-5.0.1.tar.gz attached to Download by schwa
5:05 PM Ticket #143 (Encoding-related failure with Python 3.9) closed by schwa
fixed
5:04 PM Download edited by schwa
(diff)
4:55 PM Changeset [2067:d51581372627] by Stefan Schwarzer <sschwarzer@…>
Patch for new version
4:54 PM Changeset [2066:e2921988fbe1] by Stefan Schwarzer <sschwarzer@…>
Update version
4:52 PM Changeset [2065:fe3a2eb67840] by Stefan Schwarzer <sschwarzer@…>
Update `README.txt` and `announcements.txt`
4:50 PM Ticket #145 (ftputil 5.0.0: kwargs not being passed through to ftplib.FTP) closed by schwa
fixed: Fixed as of [b5f89833bc4d].

Mar 17, 2021:

10:58 PM Changeset [2064:b5f89833bc4d] by Stefan Schwarzer <sschwarzer@…>
Use `super` for base class constructor call I don't know why this didn't work before. Maybe I had mocked `ftplib.FTP` instead of `ftplib.FTP.__init__`? ticket: 145
9:42 PM Changeset [2063:c876a8dc49cc] by Stefan Schwarzer <sschwarzer@…>
Fix regression for custom session factory arguments The ftputil version 5.0.0 accidentally made it impossible to pass `args` and `kwargs` from the `FTPHost` constructor to the default session factory. The problem was that the new default factory was created with `session.session_factory` and the thus generated factories don't accept additional arguments. This change uses `ftplib.FTP` as the default session factory when running under Python 3.8 and below. (This is the same behavior as in ftputil versions before 4.0.0.) When running under Python 3.9 and above, use a `default_session_factory` that inherits from `ftplib.FTP`, but sets the encoding to `path_encoding.DEFAULT_ENCODING` if no encoding is specified in the call of the default session factory. I decided against extending the classes returned from `session_factory` so that they would accept arbitrary `args` and `kwargs`. Such an approach would raise questions like: What should happen if client code passes a custom `encoding` argument to `session_factory` and also a (possibly even different) `encoding` argument to the session factory returned from `session_factory`? I didn't want to open this can of worms. Although the actual code change wasn't that difficult, the tests were. - Testing in `test_real_ftp.py` isn't possible because the test server deliberately uses a port above 1024 and the port can't be specified in the `ftplib.FTP` constructor. - The usual mock approach of passing in a mock session factory would defeat the purpose of testing the _default_ session factory. - Mocking parts of the default session factory to use it in `FTPHost` tests would be complicated because `FTPHost` uses a lot of the session factory API and therefore mocking while at the same time satisfying `FTPHost` requirements would be very difficult. I made the compromise of testing the default session factory itself, and only for Python 3.9 and above. After all, the default session factory for Python 3.8 and below is just `ftplib.FTP` and it doesn't seem worthwhile to adapt the new mock tests so that they also test the `ftplib.FTP` case. The current implementation of `default_session_factory` for Python 3.9 and above uses `ftplib.FTP.__init__` instead of `super().__init__`. The reason is that creating the class derived from `ftplib.FTP` stores the original class in `default_session_factory.__bases__`, and this base class isn't affected by mocking `ftplib.FTP`. We would need to either temporarily modify `__bases__` for the tests or mock `super`. Maybe I'll try the latter. ticket: 145
2:39 PM Ticket #145 (ftputil 5.0.0: kwargs not being passed through to ftplib.FTP) created by ftputiluser
We specify timeout as a kwarg to the ftputil.FTPHost constructor for …

Feb 17, 2021:

8:34 PM Milestone 5.0.0 completed
8:32 PM Changeset [2062:1a71a77c4f89] by Stefan Schwarzer <sschwarzer@…>
Fix tar.gz directory I guess I made the letter uppercase accidentally.
8:21 PM Changeset [2061:6eb8285406e0] by Stefan Schwarzer <sschwarzer@…>
Use Fedora 33 as image
8:14 PM Changeset [2060:77f3111483f1] by Stefan Schwarzer <sschwarzer@…>
Added tag release_5_0_0 for changeset 9062908e1c7d
8:13 PM ftputil-5.0.0.tar.gz attached to Download by schwa
7:56 PM Changeset [2059:9062908e1c7d] by Stefan Schwarzer <sschwarzer@…>
Add XXX on list announcement and spam
7:53 PM Documentation edited by schwa
(diff)
7:51 PM Download edited by schwa
(diff)
7:43 PM Changeset [2058:84c0806ec734] by Stefan Schwarzer <sschwarzer@…>
Update version and release date
7:42 PM Changeset [2057:a33bbab202fb] by Stefan Schwarzer <sschwarzer@…>
Change version to 5.0.0 (from 5.0.0-alpha)
7:41 PM Changeset [2056:e5ca1e941312] by Stefan Schwarzer <sschwarzer@…>
Remove `-alpha` suffix The alpha version is the new final version. The previous version was only "alpha" in case I needed to change the API again. The code quality should be production level.

Feb 7, 2021:

10:13 PM Changeset [2055:6dacebd7afde] by Stefan Schwarzer <sschwarzer@…>
Increase year in copyright line

Feb 1, 2021:

7:37 PM Changeset [2054:1d80db315313] by Stefan Schwarzer <sschwarzer@…>
Change old version number to 4.0.0
7:19 PM Download edited by schwa
(diff)
7:18 PM Changeset [2053:90572dc48ead] by Stefan Schwarzer <sschwarzer@…>
Adapt release tag format for Semver
7:18 PM Changeset [2052:44fd9795c26f] by Stefan Schwarzer <sschwarzer@…>
Added tag release_5_0_0_alpha for changeset ac94bc654731
7:16 PM Changeset [2051:ac94bc654731] by Stefan Schwarzer <sschwarzer@…>
Remove unused `sys` import
7:14 PM PreReleaseDocumentation edited by schwa
(diff)
7:01 PM Changeset [2050:f2974f53005e] by Stefan Schwarzer <sschwarzer@…>
Patch version info for release
7:00 PM Changeset [2049:b5fb0d2b25c1] by Stefan Schwarzer <sschwarzer@…>
Update version for release 5.0.0-alpha
6:58 PM Changeset [2048:0de064144674] by Stefan Schwarzer <sschwarzer@…>
Update README/announcements for version 5.0.0-alpha The `-alpha` suffix is only there in case I want to change any APIs. The software quality should already be production-level, as usual.
5:57 PM Changeset [2047:0a801e8f639c] by Stefan Schwarzer <sschwarzer@…>
Describe new behavior for missing encoding Raise `NoEncodingError` instead of falling back to latin-1. ticket: 143
5:47 PM Changeset [2046:e59335e8b934] by Stefan Schwarzer <sschwarzer@…>
Raise `NoEncodingError` for absent encoding If an FTP session instance doesn't have an `encoding` attribute, let `FTPHost` raise a `NoEncodingError`. This is a new exception. Before, the code would fall back to the ftputil default encoding, latin-1. This could be surprising behavior for some ftputil users. So rather fail explicitly and early if no `encoding` attribute exists. Otherwise, it the fallback encoding had been wrong, we might get exceptions only much later in production. ticket: 143
5:10 PM Changeset [2045:76ad27c72125] by Stefan Schwarzer <sschwarzer@…>
Sort exceptions in `__all__` alphabetically
3:24 PM Changeset [2044:8fc721629792] by Stefan Schwarzer <sschwarzer@…>
Move paths section after session factory section ticket: 143
3:19 PM Changeset [2043:d268915b0b9f] by Stefan Schwarzer <sschwarzer@…>
Rewrite section of directory/file paths ticket: 143

Jan 28, 2021:

6:05 PM Changeset [2042:ddaa0b9bbaee] by Stefan Schwarzer <sschwarzer@…>
Allow `encoding` argument only for `FTP` subclasses If an explicit encoding, i. e. a `str` is passed to `session_factory`, the `base_class` argument must be `ftplib.FTP` or a subclass of it. The reason is that we already use a heuristic for Python 3.8 and earlier vs. Python 3.9 and earlier. This heuristic may work or fail - possibly silently - for classes that aren't a subclass of `ftplib.FTP` (including `ftplib.FTP` itself). With this check in place, the heuristic may look safe, but it actually isn't if, for example, a class inherits from `ftplib.FTP` in Python 3.9, but overrides the constructor so that it doesn't support the `encoding` argument anymore. ticket: 143
1:10 PM Changeset [2041:66da304cf6ab] by Stefan Schwarzer <sschwarzer@…>
Restore tests under Python 3.9 ticket: 143
12:58 PM Changeset [2040:2f7ddf3d1112] by Stefan Schwarzer <sschwarzer@…>
Add `requirements.txt` file This is just a snapshot from my environment, so different versions may work fine as well.
12:56 PM Changeset [2039:13a2942e3285] by Stefan Schwarzer <sschwarzer@…>
Fix tests for Python 3.9 ticket: 143
12:56 PM Changeset [2038:6022e65454eb] by Stefan Schwarzer <sschwarzer@…>
Add `__all__` ticket: 143
12:28 PM Changeset [2037:25cd7d1417f9] by Stefan Schwarzer <sschwarzer@…>
Fix encoding in comparison The `MockSession` uses the `ftplib` default encoding and the semantics of `session_factory` is to use the default encoding of the base class if no `encoding` argument is specified for `session_factory`. ticket: 143
12:25 PM Changeset [2036:5a655d4cf373] by Stefan Schwarzer <sschwarzer@…>
Fix `test_path.py` for Python 3.9 Use the same approach as in the fix for `test_host.py` (see previous commit). ticket: 143
12:14 PM Changeset [2035:d1192e577ef2] by Stefan Schwarzer <sschwarzer@…>
Fix `test_host.py` for Python 3.9 Add an optional argument `encoding` argument to the `as_bytes` helper function and use this argument in `TestAcceptEitherUnicodeOrBytes`. The code in `scripted_session` uses the path encoding of the `ftplib` module in the standard library, whereas the `as_bytes` helper function in `test_host.py` by default uses the ftputil path encoding default. Therefore, the tests worked for Python 3.8 and before, but not for Python 3.9 with the changed path encoding default. ticket: 143
11:52 AM Changeset [2034:4b81570af0f3] by Stefan Schwarzer <sschwarzer@…>
Use new module `path_encoding` Replace hardcoded uses of "latin-1", "utf-8" and Python version checks with constants from `ftputil.path_encoding`. ticket: 143

Jan 27, 2021:

7:22 PM Changeset [2033:99fb8a5f1ab6] by Stefan Schwarzer <sschwarzer@…>
Make path encoding configurable Some changes: - Add `default_session_factory` in `host.py` and use the new session factory as the default factory instead of `ftplib.FTP`. This makes sure that we keep the old behavior of ftputil under Python 3.8 and below, that is, using latin-1 path encoding. - When creating an instance from the session factory, store the encoding of the instance in the `FTPHost` instance in the `_encoding` attribute. In case the created session has no `encoding` attribute, fall back to the default, i. e. "latin-1". - Add an `encoding` argument to the string conversion tools in `tool.py`. - When calling into `tool.py`, pass the `_encoding` from the `FTPHost` instance as the `encoding` argument. There are a few places that call into `tool.py` without the session encoding being available. This applies to `error.py`. In this case use the default encoding, latin-1. - Adapt tests. For example, make sure that some mock FTP sessions have an `encoding` attribute set. With these changes, the tests run successfully under Python 3.6 to 3.8. There are still a few tests failing under Python 3.9. ticket: 143
5:50 PM Changeset [2032:d36882f78aae] by Stefan Schwarzer <sschwarzer@…>
Add encoding attribute Otherwise, the `encoding` access goes through `__getattr__`. We want to avoid this because we would have to add `encoding` accesses to all session scripts. Let's treat `encoding` as a regular attribute instead, without tracking it with the session logic for expected attribute accesses. ticket: 143
5:49 PM Changeset [2031:aa15029facb4] by Stefan Schwarzer <sschwarzer@…>
Print next `Call` in scripted session
5:49 PM Changeset [2030:3fd92baa7cb0] by Stefan Schwarzer <sschwarzer@…>
Remove brackets from some scripted session output
4:29 PM Changeset [2029:6140fb27fe6e] by Stefan Schwarzer <sschwarzer@…>
Use base class default if `encoding` isn't given Make the `encoding` argument of `session_factory` default to `None`. If `None`, use the default encoding of the base class. This follows the same logic as for the default handling of the `use_passive_mode` argument. Note that the default encoding of `ftplib.FTP` changed from "latin-1" in Python <= 3.8 to "utf-8" in Python >= 3.9. Therefore, if you want the same encoding regardless of the Python version, pass your own base class (compatible with `ftplib.FTP`) which uses a fixed encoding or pass the `encoding` explicitly to `session_factory`. ticket: 143
3:47 PM Changeset [2028:72a34b226c8d] by Stefan Schwarzer <sschwarzer@…>
Add `encoding` argument for `session_factory` ticket: 143

Jan 6, 2021:

10:33 PM Changeset [2027:b0f43547abc7] by Stefan Schwarzer <sschwarzer@…>
Make new image the version 0.3 (see recent image changes)
8:36 PM Changeset [2026:806db56bceaf] by Stefan Schwarzer <sschwarzer@…>
Update README (port mapping)
6:33 PM Changeset [2025:d9aae7324166] by Stefan Schwarzer <sschwarzer@…>
Don't run tests for Python 3.9 The integration tests currently fail for Python 3.9 because of the changed default path encoding (see ticket #143).
5:54 PM Changeset [2024:5b5ac0e7f191] by Stefan Schwarzer <sschwarzer@…>
Run in privileged mode for Podman to work
5:18 PM Changeset [2023:bd164503fe57] by Stefan Schwarzer <sschwarzer@…>
Rework test server container - Switch to configuration via configuration file. As I understand the Pure-FTPd documentation, configuration happens either by command line switches or by specifying just the path of a configuration file. Before, I didn't notice that the configuration file wasn't used because it seems the command line contained all the necessary switches for my server configuration. Curiously, when using a configuration file, the FTP server no longer runs in the foreground, but is moved to the background. This leads the container to exit as soon as the server is started. To work around this, add `&& sleep infinity` to the `CMD`. The `infinity` argument may not be supported in all versions of `sleep`, but for the Debian base image of the Pure FTPd image, the argument _is_ supported. A obscure workaround would be `&& tail -f /dev/null`. - Let the server in the container listen on port 2121 instead of port 21. This should avoid network capability problems when starting the server. Strangely, I hadn't noticed this problem before. Since it happens now (for port 21) with both Docker and Podman on my machine, the trigger may be in a common component, say, runc.
5:16 PM Changeset [2022:d8fc41786c69] by Stefan Schwarzer <sschwarzer@…>
Don't use color output when running under tox In the Sourcehut build system, Pytest color output leads to a messy log with ANSI color codes.
5:11 PM Changeset [2021:2b9889bc49d0] by Stefan Schwarzer <sschwarzer@…>
Prepend image name with `localhost/` This is supposed to avoid registry lookups for an actually local image. I saw such lookups in the Sourcehut build system.

Jan 5, 2021:

7:33 PM Changeset [2020:cc5bcc816605] by Stefan Schwarzer <sschwarzer@…>
Comment out tests under Python 3.9
Note: See TracTimeline for information about the timeline view.