Package: pyftpdlib
Quick linksHomeDocumentationDownloadBlogMailing listWhat’s newAboutPython FTP server library provides a high-level portable interface to easily
write very efficient, scalable and asynchronous FTP servers with Python. It is
the most completeRFC-959FTP server
implementation available forPythonprogramming
language.FeaturesExtremelylightweight,fastandscalable(seewhyandbenchmarks).Usessendfile(2)(seepysendfile)
system call for uploads.Uses epoll() / kqueue() / select() to handle concurrency asynchronously.…But can optionally skip to amultiple thread / processmodel (as in: you’ll be free to block or use slow filesystems).Portable: entirely written in pure Python; works with Python2.7and3.Xusing a single code base.SupportsFTPS(RFC-4217),IPv6(RFC-2428),Unicodefile names (RFC-2640),MLSD/MLSTcommands (RFC-3659).Support for virtual users and virtual filesystem.Flexible system of “authorizers” able to manage both “virtual” and
“real” users on on bothUNIXandWindows.PerformancesDespite being written in an interpreted language, pyftpdlib has transfer rates
comparable or superior to common UNIX FTP servers written in C. It usually tends
to scale better (seebenchmarks)
because whereas vsftpd and proftpd use multiple processes to
achieve concurrency, pyftpdlib only uses one (seethe C10K problem).pyftpdlib vs. proftpd 1.3.4benchmark typepyftpdlibproftpdspeedupSTOR (client -> server)585.90 MB/sec600.49 MB/sec-0.02xRETR (server -> client)1652.72 MB/sec1524.05 MB/sec+0.08300 concurrent clients (connect, login)0.19 secs9.98 secs+51xSTOR (1 file with 300 idle clients)585.59 MB/sec518.55 MB/sec+0.1xRETR (1 file with 300 idle clients)1497.58 MB/sec1478.19 MB/sec0x300 concurrent clients (RETR 10M file)3.41 secs3.60 secs+0.05x300 concurrent clients (STOR 10M file)8.60 secs11.56 secs+0.3x300 concurrent clients (QUIT)0.03 secs0.39 secs+12xpyftpdlib vs. vsftpd 2.3.5benchmark typepyftpdlibvsftpdspeedupSTOR (client -> server)585.90 MB/sec611.73 MB/sec-0.04xRETR (server -> client)1652.72 MB/sec1512.92 MB/sec+0.09300 concurrent clients (connect, login)0.19 secs20.39 secs+106xSTOR (1 file with 300 idle clients)585.59 MB/sec610.23 MB/sec-0.04xRETR (1 file with 300 idle clients)1497.58 MB/sec1493.01 MB/sec0x300 concurrent clients (RETR 10M file)3.41 secs3.67 secs+0.07x300 concurrent clients (STOR 10M file)8.60 secs9.82 secs+0.07x300 concurrent clients (QUIT)0.03 secs0.01 secs+0.14xFor more benchmarks seehere.Quick start>>>frompyftpdlib.authorizersimportDummyAuthorizer>>>frompyftpdlib.handlersimportFTPHandler>>>frompyftpdlib.serversimportFTPServer>>>>>>authorizer=DummyAuthorizer()>>>authorizer.add_user("user","12345","/home/giampaolo",perm="elradfmwMT")>>>authorizer.add_anonymous("/home/nobody")>>>>>>handler=FTPHandler>>>handler.authorizer=authorizer>>>>>>server=FTPServer(("127.0.0.1",21),handler)>>>server.serve_forever()[I13-02-1910:55:42]>>>startingFTPserveron127.0.0.1:21<<<[I13-02-1910:55:42]poller:<class'pyftpdlib.ioloop.Epoll'>[I13-02-1910:55:42]masquerade(NAT)address:None[I13-02-1910:55:42]passiveports:None[I13-02-1910:55:42]usesendfile(2):True[I13-02-1910:55:45]127.0.0.1:34178-[]FTPsessionopened(connect)[I13-02-1910:55:48]127.0.0.1:34178-[user]USER'user'loggedin.[I13-02-1910:56:27]127.0.0.1:34179-[user]RETR/home/giampaolo/.vimrccompleted=1bytes=1700seconds=0.001[I13-02-1910:56:39]127.0.0.1:34179-[user]FTPsessionclosed(disconnect).other code samplesDonateA lot of time and effort went into making pyftpdlib as it is right now.
If you feel pyftpdlib is useful to you or your business and want to support its
future development please considerdonatingme some money.