Metadata-Version: 2.4
Name: miarec_ftpfs
Version: 2025.5.27
Summary: FTP filesystem for PyFilesystem2
Home-page: https://github.com/miarec/miarec_ftpfs
Author: MiaRec
Author-email: support@miarec.com
License: MIT
Project-URL: Bug Tracker, https://github.com/miarec/miarec_ftpfs/issues
Project-URL: Builds, https://github.com/miarec/miarec_ftpfs/actions
Keywords: filesystem,Pyfilesystem2,ftp,ftps
Platform: any
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: System :: Filesystems
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: fs~=2.4
Requires-Dist: setuptools>=38.3.0
Provides-Extra: test
Requires-Dist: pytest~=7.4; extra == "test"
Requires-Dist: pytest-cov~=4.1; extra == "test"
Requires-Dist: pyftpdlib~=1.5; extra == "test"
Requires-Dist: psutil~=6.0; extra == "test"
Requires-Dist: PyOpenSSL~=23.3; extra == "test"
Requires-Dist: cryptography~=41.0; extra == "test"
Dynamic: license-file

# miarec_ftpfs

[![Actions](https://img.shields.io/github/actions/workflow/status/miarec/miarec_ftpfs/test_and_release.yml?branch=master&logo=github&style=flat-square&maxAge=300)](https://github.com/miarec/miarec_ftpfs/actions)

MiaRec FTPFS is a [PyFilesystem](https://www.pyfilesystem.org/) interface to
FTP/FTPS storage.

This a fork of the builtin FTPFS class from [PyFileSystem2](https://github.com/PyFilesystem/pyfilesystem2) project, written by Will McGugan (email willmcgugan@gmail.com). 

The code was modified by MiaRec team to fullfill our needs.

## Notable differences between miarec_ftpfs.FTPFS and fs.FTPFS

1. Requires Python 3.6+. A support of Python 2.7 is removed.

2. Opener protocol prefixes are `mftp://` and `mftps://` for FTP and FTP-over-TLS respectively (instead of the original `ftp://` and `ftps://`)

3. Add Implicit TLS support

4. Fix bugs in Explicit TLS implementation

5. Automatically try to re-open FTP connection on the next operation in case of network issues.
  Previously, the `FTPFS` object was stuck in error state, and any operations on the file system instance, like `openbin()`, `listdir()`, etc, were failing infinitely.

6. Better error handling. All FTP protocol-specific and SSL errors are converted into corresponding `FSError` exception


## Installing

You can install FTPFS from pip as follows:

```
pip install miarec_ftpfs
```

This will install the most recent stable version.

Alternatively, if you want the cutting edge code, you can check out
the GitHub repos at https://github.com/miarec/miarec_ftpfs

## Opening a FTPFS

Open an FTPFS by explicitly using the constructor:

```python
from fs.ftpfs import FTPFS
FTPFS("demo.wftpserver.com")
```

Or via an FS URL:

```python
ftp_fs = fs.open_fs('mftp://test.rebex.net')
```

Or via an FS URL, using TLS:

```python
ftp_fs = fs.open_fs('mftps://demo.wftpserver.com')
```

You can also use a non-anonymous username, and optionally a
password, even within a FS URL:

```python
ftp_fs = FTPFS("test.rebex.net", user="demo", passwd="password")
ftp_fs = fs.open_fs('mftp://demo:password@test.rebex.net')
```

Connecting via a proxy is supported. If using a FS URL, the proxy
URL will need to be added as a URL parameter:

```python
ftp_fs = FTPFS("ftp.ebi.ac.uk", proxy="test.rebex.net")
ftp_fs = fs.open_fs('mftp://ftp.ebi.ac.uk/?proxy=test.rebex.net')
```

## Testing

Automated unit tests are run on [GitHub Actions](https://github.com/miarec/miarec_ftpfs/actions)

To run the tests locally, do the following.

Create activate python virtual environment:

    python -m vevn venv
    source venv\bin\activate

Install the project and test dependencies:

    pip install -e ".[test]"

Run tests:

    pytest

## Documentation

- [PyFilesystem Wiki](https://www.pyfilesystem.org)
- [PyFilesystem Reference](https://docs.pyfilesystem.org/en/latest/reference/base.html)
