Giter Site home page Giter Site logo

epsilon's Introduction

Twisted

gitter_ rtd_ pypi_ ci_

For information on changes in this release, see the NEWS file.

What is this?

Twisted is an event-based framework for internet applications, supporting Python 3.6+. It includes modules for many different purposes, including the following:

  • twisted.web: HTTP clients and servers, HTML templating, and a WSGI server
  • twisted.conch: SSHv2 and Telnet clients and servers and terminal emulators
  • twisted.words: Clients and servers for IRC, XMPP, and other IM protocols
  • twisted.mail: IMAPv4, POP3, SMTP clients and servers
  • twisted.positioning: Tools for communicating with NMEA-compatible GPS receivers
  • twisted.names: DNS client and tools for making your own DNS servers
  • twisted.trial: A unit testing framework that integrates well with Twisted-based code.

Twisted supports all major system event loops -- select (all platforms), poll (most POSIX platforms), epoll (Linux), kqueue (FreeBSD, macOS), IOCP (Windows), and various GUI event loops (GTK+2/3, Qt, wxWidgets). Third-party reactors can plug into Twisted, and provide support for additional event loops.

Installing

To install the latest version of Twisted using pip:

$ pip install twisted

Additional instructions for installing this software are in the installation instructions.

Documentation and Support

Twisted's documentation is available from the Twisted Matrix website. This documentation contains how-tos, code examples, and an API reference.

Help is also available on the Twisted mailing list.

There is also an IRC channel, #twisted, on the Libera.Chat network. A web client is available at web.libera.chat.

Unit Tests

Twisted has a comprehensive test suite, which can be run by tox:

$ tox -l                       # to view all test environments
$ tox -e nocov                 # to run all the tests without coverage
$ tox -e withcov               # to run all the tests with coverage
$ tox -e alldeps-withcov-posix # install all dependencies, run tests with coverage on POSIX platform

You can test running the test suite under the different reactors with the TWISTED_REACTOR environment variable:

$ env TWISTED_REACTOR=epoll tox -e alldeps-withcov-posix

Some of these tests may fail if you:

  • don't have the dependencies required for a particular subsystem installed,
  • have a firewall blocking some ports (or things like Multicast, which Linux NAT has shown itself to do), or
  • run them as root.

Static Code Checkers

You can ensure that code complies to Twisted coding standards:

$ tox -e lint   # run pre-commit to check coding stanards
$ tox -e mypy   # run MyPy static type checker to check for type errors

Or, for speed, use pre-commit directly:

$ pipx run pre-commit run

All of the code in this distribution is Copyright (c) 2001-2024 Twisted Matrix Laboratories.

Twisted is made available under the MIT license. The included LICENSE file describes this in detail.

Warranty

THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE USE OF THIS SOFTWARE IS WITH YOU.

IN NO EVENT WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY, BE LIABLE TO YOU FOR ANY DAMAGES, EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

Again, see the included LICENSE file for specific legal details.

epsilon's People

Contributors

exarkun avatar glyph avatar graingert avatar ldanielburr avatar lvh avatar mithrandi avatar palfrey avatar zooko avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

epsilon's Issues

Incorrect extension of PYTHONPATH

If the PYTHONPATH environment variable is already empty, doing something like:

PYTHONPATH="/path/to/dir:$PYTHONPATH" python [...]

results in a PYTHONPATH of "/path/to/dir:". As the empty segment at the end is interpreted as . (the current directory), this is undesireable. The easiest way to avoid this is to do:

PYTHONPATH="/path/to/dir${PYTHONPATH:+:$PYTHONPATH}" python [...]

This defect is present in axiom.test.test_xatop in Axiom, as well as in epsilon.release in Epsilon.


Imported from Launchpad using lp2gh.

certcreate doesn't work on python3

Traceback (most recent call last):
  File "epsilon/bin/certcreate", line 7, in <module>
    exec(compile(f.read(), __file__, 'exec'))
  File ".../bin/certcreate", line 5, in <module>
    certcreate.main()
  File ".../epsilon/scripts/certcreate.py", line 62, in main
    return createSSLCertificate(o)
  File ".../epsilon/scripts/certcreate.py", line 41, in createSSLCertificate
    file(opts['filename'], 'w').write(ssc.dumpPEM())
NameError: name 'file' is not defined. Did you mean: 'filter'?

/etc/mtab is unreliable, use /proc/self/mounts

[ERROR]
Traceback (most recent call last):
  File "/tmp/buildd/epsilon-0.7.0/epsilon/test/test_benchmark.py", line 291, in setUp
    spawnProcess)
  File "/tmp/buildd/epsilon-0.7.0/epsilon/scripts/benchmark.py", line 180, in spawn
    proto = cls(d, filepath.FilePath(path))
  File "/tmp/buildd/epsilon-0.7.0/epsilon/scripts/benchmark.py", line 238, in __init__
    self.partition = discoverCurrentWorkingDevice().split('/')[-1]
  File "/tmp/buildd/epsilon-0.7.0/epsilon/scripts/benchmark.py", line 431, in discoverCurrentWorkingDevice
    return possibilities[-1][-1]
exceptions.IndexError: list index out of range

epsilon.test.test_benchmark.BenchmarkProcessTestCase.testProcessStartTimingCommand
epsilon.test.test_benchmark.BenchmarkProcessTestCase.testProcessStopTimingCommand

Test suite fails with Twisted 18.4.0

Happens five times due to the same error.

======================================================================
ERROR: testFormatterWithoutPartitionStats (epsilon.test.test_benchmark.ReporterTestCase)
testFormatterWithoutPartitionStats
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py", line 150, in maybeDeferred
    result = f(*args, **kw)
  File "/usr/lib64/python2.7/site-packages/twisted/internet/utils.py", line 201, in runWithWarningsSuppressed
    reraise(exc_info[1], exc_info[2])
  File "/usr/lib64/python2.7/site-packages/twisted/internet/utils.py", line 197, in runWithWarningsSuppressed
    result = f(*a, **kw)
  File "/home/abuild/rpmbuild/BUILD/Epsilon-0.7.1/epsilon/test/test_benchmark.py", line 215, in testFormatterWithoutPartitionStats
    56), False, False))
  File "/home/abuild/rpmbuild/BUILD/Epsilon-0.7.1/epsilon/scripts/benchmark.py", line 380, in formatResults
    twisted_version = twisted.version._getSVNVersion()
AttributeError: 'Version' object has no attribute '_getSVNVersion'

epsilon appears to be homeless (no revision control, no bug tracker, no continuous integration server)

Epsilon used to live at http://divmod.org/trac/wiki/EpsilonProject but that site is gone. I guess the project should be officially deprecated by its maintainers so that we all know to migrate away from using it, or else someone should set up a new revision control repository, issue tracker, and continuous integratioin server. I would be happy to use launchpad for that.

At the moment the only way to get Epsilon source code is probably from PyPI:

http://pypi.python.org/pypi/Epsilon/0.6.0


Imported from Launchpad using lp2gh.

epsilon.test.test_extime.TestTime.test_cmp fails when local time is UTC

The test failure looks like:

[FAIL]
Traceback (most recent call last):
File "/home/mithrandi/code/Divmod/trunk/Epsilon/epsilon/test/test_extime.py", line 74, in test_cmp
self.assertNotEquals(extime.Time.fromStructTime(now), extime.Time.fromStructTime(time.localtime()))
File "/home/mithrandi/code/Twisted/trunk/twisted/trial/_synctest.py", line 399, in assertNotEqual
raise self.failureException(msg or '%r == %r' % (first, second))
twisted.trial.unittest.FailTest: extime.Time.fromDatetime(datetime.datetime(2013, 8, 9, 1, 58, 7)) == extime.Time.fromDatetime(datetime.datetime(2013, 8, 9, 1, 58, 7))

epsilon.test.test_extime.TestTime.test_cmp

I think this assertion is basically just completely bogus; it is equivalent to asserting that local timezone is not UTC, which is an irrelevant local system configuration detail.


Imported from Launchpad using lp2gh.

PyPy test failures

===============================================================================
[FAIL]
Traceback (most recent call last):
  File "/home/mithrandi/code/Epsilon/epsilon/test/test_caseless.py", line 264, in test_findindex
    assertNotFound(a, u'foo')
  File "/home/mithrandi/code/Epsilon/epsilon/test/test_caseless.py", line 261, in assertNotFound
    self.assertEquals(str(err), 'substring not found')
  File "/home/mithrandi/deployment/virtualenvs/pypy-epsilon/site-packages/twisted/trial/_synctest.py", line 356, in assertEqual
    % (msg, pformat(first), pformat(second)))
twisted.trial.unittest.FailTest: not equal:
a = 'substring not found in string.index'
b = 'substring not found'


epsilon.test.test_caseless.CaselessTestCase.test_findindex
===============================================================================
[FAIL]
Traceback (most recent call last):
  File "/home/mithrandi/code/Epsilon/epsilon/test/test_caseless.py", line 284, in test_rfindindex
    assertNotFound(a, u'foo')
  File "/home/mithrandi/code/Epsilon/epsilon/test/test_caseless.py", line 281, in assertNotFound
    self.assertEquals(str(err), 'substring not found')
  File "/home/mithrandi/deployment/virtualenvs/pypy-epsilon/site-packages/twisted/trial/_synctest.py", line 356, in assertEqual
    % (msg, pformat(first), pformat(second)))
twisted.trial.unittest.FailTest: not equal:
a = 'substring not found in string.rindex'
b = 'substring not found'


epsilon.test.test_caseless.CaselessTestCase.test_rfindindex

This is basically just due to index/rindex having a different error message on PyPy; the test should probably be more lenient about checking the error.

Add extime.Time.asRFC1123()

When using extime.Time as part of a codebase that deals with setting HTTP cookies, it is useful to be able to format the Time object according to RFC1123, as that format is required when setting the cookie's "expires" value.

extime.Time.asRFC2822 produces similar output, with the exception of the timezone, which must be "GMT" in order to satisfy the requirements for a cookie's "expires" value.

Tests still fail even with 0.7.2 on openSUSE (with python 2.7)

Thank you for fixing #25, but unfortunately we are still not there yet:

[    4s] ======================================================================
[    4s] ERROR: testProcessStartTimingCommand (epsilon.test.test_benchmark.BenchmarkProcessTestCase)
[    4s] testProcessStartTimingCommand
[    4s] ----------------------------------------------------------------------
[    4s] Traceback (most recent call last):
[    4s]   File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py", line 150, in maybeDeferred
[    4s]     result = f(*args, **kw)
[    4s]   File "/usr/lib64/python2.7/site-packages/twisted/internet/utils.py", line 201, in runWithWarningsSuppressed
[    4s]     reraise(exc_info[1], exc_info[2])
[    4s]   File "/usr/lib64/python2.7/site-packages/twisted/internet/utils.py", line 197, in runWithWarningsSuppressed
[    4s]     result = f(*a, **kw)
[    4s]   File "/home/abuild/rpmbuild/BUILD/Epsilon-0.7.2/epsilon/test/test_benchmark.py", line 305, in setUp
[    4s]     spawnProcess)
[    4s]   File "/home/abuild/rpmbuild/BUILD/Epsilon-0.7.2/epsilon/scripts/benchmark.py", line 180, in spawn
[    4s]     proto = cls(d, filepath.FilePath(path))
[    4s]   File "/home/abuild/rpmbuild/BUILD/Epsilon-0.7.2/epsilon/scripts/benchmark.py", line 238, in __init__
[    4s]     self.partition = discoverCurrentWorkingDevice().split('/')[-1]
[    4s]   File "/home/abuild/rpmbuild/BUILD/Epsilon-0.7.2/epsilon/scripts/benchmark.py", line 427, in discoverCurrentWorkingDevice
[    4s]     return possibilities[-1][-1]
[    4s] IndexError: list index out of range
[    4s] 
[    4s] ======================================================================
[    4s] ERROR: testProcessStopTimingCommand (epsilon.test.test_benchmark.BenchmarkProcessTestCase)
[    4s] testProcessStopTimingCommand
[    4s] ----------------------------------------------------------------------
[    4s] Traceback (most recent call last):
[    4s]   File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py", line 150, in maybeDeferred
[    4s]     result = f(*args, **kw)
[    4s]   File "/usr/lib64/python2.7/site-packages/twisted/internet/utils.py", line 201, in runWithWarningsSuppressed
[    4s]     reraise(exc_info[1], exc_info[2])
[    4s]   File "/usr/lib64/python2.7/site-packages/twisted/internet/utils.py", line 197, in runWithWarningsSuppressed
[    4s]     result = f(*a, **kw)
[    4s]   File "/home/abuild/rpmbuild/BUILD/Epsilon-0.7.2/epsilon/test/test_benchmark.py", line 305, in setUp
[    4s]     spawnProcess)
[    4s]   File "/home/abuild/rpmbuild/BUILD/Epsilon-0.7.2/epsilon/scripts/benchmark.py", line 180, in spawn
[    4s]     proto = cls(d, filepath.FilePath(path))
[    4s]   File "/home/abuild/rpmbuild/BUILD/Epsilon-0.7.2/epsilon/scripts/benchmark.py", line 238, in __init__
[    4s]     self.partition = discoverCurrentWorkingDevice().split('/')[-1]
[    4s]   File "/home/abuild/rpmbuild/BUILD/Epsilon-0.7.2/epsilon/scripts/benchmark.py", line 427, in discoverCurrentWorkingDevice
[    4s]     return possibilities[-1][-1]
[    4s] IndexError: list index out of range
[    4s] 
[    4s] ----------------------------------------------------------------------
[    4s] Ran 248 tests in 0.235s

What's wrong?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.