New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
attr.Factory is a little wordy #178
Comments
Don't really have a strong opinion here, but I've been finding myself really needing factories that take If we're changing the design it'd be nice for the new design to elegantly accommodate these kinds of callables too. |
I think it should at least be Sadly, that ship has sailed long ago so keeping it up doesn’t make a lot of sense anymore. I guess passing a half-initialized self into the factory would make a lot of people happy… |
I also think that attr could make it easier to set default mutable attribute values. IMHO having to explicitly create a Factory object is too wordy and not very discoverable. Thus I like this proposal. In fact I proposed something similar to Hynek via email, although I suggested "factory" rather than "new" for the keyword argument. I think using "factory" rather than "new" would make it more clear than a factory is introduced automatically. That being said, I think that while this would be nice it would only be a partial solution. It would not make it easy enough to set an attribute default value to a non empty list. To do that currently you need to use a Factory and a lambda: @attr.s
class Player(object):
position = attr.ib(default=attr.Factory(lambda: [0, 0, 0])) IMHO that is way too verbose, complex and obscure for such as common use case. With this new proposal you would do: @attr.s
class Player(object):
position = attr.ib(factory=lambda: [0, 0, 0]) which is better, but still a bit obscure. Instead, or perhaps in addition to the "factory" parameter there should be a simple way to set an attribute default value to a mutable, non empty value. For example there could be a new "mdefault" attribute (or perhaps "new", if we use "factory" for the previous use case) which would both add the Factory and the lambda for you: @attr.s
class Player(object):
position = attr.ib(new=[0, 0, 0]) Ideally attr may be smart enough to detect when the value is immutable and skip the lambda when not needed. |
Hm, I see @hynek 's point. I don't actually need First of all, I like
A small problem with this is runtime errors:
This should be an error. But we kinda already do this by throwing errors if attributes with default aren't listed last. |
On the one hand, I love this because it is incredibly precise and doesn't carry the structural risk of "here's half a On the other hand, wow, what terrifying magic. Where did Finally though - there's no problem with putting |
Have you guys lost your minds? |
You're right, if brevity is the goal, a kwarg is probably not sufficiently terse to be worthwhile. How about this: @attr.s
class X:
a = attr.ib() | None # -> `default=`
b = attr.ib() ^ list # -> `default=Factory(list)`
c = attr.ib() & [] # -> `default=Factory(lambda shared_list=[]: copy.deepcopy(shared_list)) Thoughts? |
Oh wait, perhaps I missed the obvious here: |
@attr.s
class X:
a = attr.ib() + None # -> `default=None`
b = attr.ib() * list # -> `default=Factory(list)`
c = attr.ib() ** [] # -> `default=Factory(lambda shared_list=[]: copy.deepcopy(shared_list)) |
Silliness aside, if we’d want to pass optionally a half-initialized self, we’d have to distinguish between methods whose only argument happens to be Seems fragile and implicit though… |
Did we kind of agree on |
(if you need |
A lot of people really dislike the word "factory"; it has some baggage. How do you feel about something even briefer, like |
I appreciate the marketing angle but we really want to add a second name for the same concept -- a name that doesn't really make a lot of sense? :-/ Don't get me wrong: I'd love to call it |
Factory is a pattern for an object with methods that produces other objects with methods. But the more general concept of making a new thing, or creating something, is far more general than a factory. For me it makes sense that |
glyph has a far tighter definition of "factory" than I've ever heard. I think that name is fine, FWIW. Though oddly, I associate "new" with other languages (Java) and totally think of that as a thing that produces an object with methods. But then… isn't everything an object with methods in Python? |
There's some debate; it's certainly used in other ways too. I didn't mean to say that my definition was precisely technically correct, just that the term has more of a technical connotation due to the design-patterns literature. |
What I’m thinking about right now is that someone who isn’t intimate with attrs comes to a code base and Would it kill y’all to have:
? To me, this seems like a sweet spot for consistency, brevity, and clarity. Comments? |
For the middle one, what about |
At this point I feel like the easiest way of solving this is just changing the docs to:
|
@Tinche… uh… dammit that's too easy! |
This is actually what I do in my own code :). |
So um after typing |
give in to your anger |
OK but I just can’t get over the inconsistency of new/factory. That would bother me until my death. Would you consider |
@Tinche's example is pretty concise, even if you type |
Well, we could go as far as adding a factory for Factory called |
I do own factoryfactoryfactory.com |
|
for "correctness" sake |
Wanted to also confirm this. I've run into this very often, e.g. setting one attr with other attr as a default value. Writing out y = attr.ib(default=attr.Factory(lambda self: self.x, takes_self=True)) is a bit too heavy though. Wondering if y = attr.ib(factory=lambda self: self.x) |
As a working proof of concept: from inspect import Signature, Parameter, signature
class Factory(attr.Factory):
def __init__(self, func, takes_self=None):
if takes_self is None:
takes_self = signature(func) == Signature(
[Parameter('self', Parameter.POSITIONAL_OR_KEYWORD)]
)
super().__init__(func, takes_self=takes_self)
def attrib(*args, factory=None, **kwargs):
if factory is not None:
kwargs['default'] = Factory(factory)
return attr.ib(*args, **kwargs)
@attr.s
class Bar:
x = attrib()
y = attrib(factory=lambda self: self.x) >>> Bar(42)
Bar(x=42, y=42) |
@glyph: The current state of things is pretty good, yo: @attr.s(auto_attribs=True)
class Cache(object):
_stored: list = Factory(list)
_by_name: dict = Factory(dict)
_by_id: dict = Factory(dict) |
makes me wonder if a |
What would Anyway, I'd assert that the above syntax addresses this ticket. |
Oops didn't mean to close |
Since this thread has already fans on Twitter and I got annoyed by the wordiness a few times myself, here’s my final offer:
No magic, no nothing. If you need more power: there’s two other ways for it. |
Sounds cool! |
185: Scheduled weekly dependency update for week 18 r=mithrandi a=pyup-bot ### Update [attrs](https://pypi.org/project/attrs) from **17.4.0** to **18.1.0**. <details> <summary>Changelog</summary> ### 18.1.0 ``` ------------------- Changes ^^^^^^^ - ``x=X(); x.cycle = x; repr(x)`` will no longer raise a ``RecursionError``, and will instead show as ``X(x=...)``. `95 <https://github.com/python-attrs/attrs/issues/95>`_ - ``attr.ib(factory=f)`` is now syntactic sugar for the common case of ``attr.ib(default=attr.Factory(f))``. `178 <https://github.com/python-attrs/attrs/issues/178>`_, `356 <https://github.com/python-attrs/attrs/issues/356>`_ - Added ``attr.field_dict()`` to return an ordered dictionary of ``attrs`` attributes for a class, whose keys are the attribute names. `290 <https://github.com/python-attrs/attrs/issues/290>`_, `349 <https://github.com/python-attrs/attrs/issues/349>`_ - The order of attributes that are passed into ``attr.make_class()`` or the ``these`` argument of ``attr.s()`` is now retained if the dictionary is ordered (i.e. ``dict`` on Python 3.6 and later, ``collections.OrderedDict`` otherwise). Before, the order was always determined by the order in which the attributes have been defined which may not be desirable when creating classes programatically. `300 <https://github.com/python-attrs/attrs/issues/300>`_, `339 <https://github.com/python-attrs/attrs/issues/339>`_, `343 <https://github.com/python-attrs/attrs/issues/343>`_ - In slotted classes, ``__getstate__`` and ``__setstate__`` now ignore the ``__weakref__`` attribute. `311 <https://github.com/python-attrs/attrs/issues/311>`_, `326 <https://github.com/python-attrs/attrs/issues/326>`_ - Setting the cell type is now completely best effort. This fixes ``attrs`` on Jython. We cannot make any guarantees regarding Jython though, because our test suite cannot run due to dependency incompatabilities. `321 <https://github.com/python-attrs/attrs/issues/321>`_, `334 <https://github.com/python-attrs/attrs/issues/334>`_ - If ``attr.s`` is passed a *these* argument, it will not attempt to remove attributes with the same name from the class body anymore. `322 <https://github.com/python-attrs/attrs/issues/322>`_, `323 <https://github.com/python-attrs/attrs/issues/323>`_ - The hash of ``attr.NOTHING`` is now vegan and faster on 32bit Python builds. `331 <https://github.com/python-attrs/attrs/issues/331>`_, `332 <https://github.com/python-attrs/attrs/issues/332>`_ - The overhead of instantiating frozen dict classes is virtually eliminated. `336 <https://github.com/python-attrs/attrs/issues/336>`_ - Generated ``__init__`` methods now have an ``__annotations__`` attribute derived from the types of the fields. `363 <https://github.com/python-attrs/attrs/issues/363>`_ - We have restructured the documentation a bit to account for ``attrs``' growth in scope. Instead of putting everything into the `examples <http://www.attrs.org/en/stable/examples.html>`_ page, we have started to extract narrative chapters. So far, we've added chapters on `initialization <http://www.attrs.org/en/stable/init.html>`_ and `hashing <http://www.attrs.org/en/stable/hashing.html>`_. Expect more to come! `369 <https://github.com/python-attrs/attrs/issues/369>`_, `370 <https://github.com/python-attrs/attrs/issues/370>`_ ---- ``` </details> <details> <summary>Links</summary> - PyPI: https://pypi.org/project/attrs - Changelog: https://pyup.io/changelogs/attrs/ - Homepage: http://www.attrs.org/ </details> ### Update [cffi](https://pypi.org/project/cffi) from **1.11.2** to **1.11.5**. <details> <summary>Changelog</summary> ### 1.11.5 ``` ======= * `Issue 357`_: fix ``ffi.emit_python_code()`` which generated a buggy Python file if you are using a ``struct`` with an anonymous ``union`` field or vice-versa. * Windows: ``ffi.dlopen()`` should now handle unicode filenames. * ABI mode: implemented ``ffi.dlclose()`` for the in-line case (it used to be present only in the out-of-line case). * Fixed a corner case for ``setup.py install --record=xx --root=yy`` with an out-of-line ABI module. Also fixed `Issue 345`_. * More hacks on Windows for running CFFI's own ``setup.py``. * `Issue 358`_: in embedding, to protect against (the rare case of) Python initialization from several threads in parallel, we have to use a spin-lock. On CPython 3 it is worse because it might spin-lock for a long time (execution of ``Py_InitializeEx()``). Sadly, recent changes to CPython make that solution needed on CPython 2 too. * CPython 3 on Windows: we no longer compile with ``Py_LIMITED_API`` by default because such modules cannot be used with virtualenv. `Issue 350`_ mentions a workaround if you still want that and are not concerned about virtualenv: pass a ``define_macros=[("Py_LIMITED_API", None)]`` to the ``ffibuilder.set_source()`` call. .. _`Issue 345`: https://bitbucket.org/cffi/cffi/issues/345/ .. _`Issue 350`: https://bitbucket.org/cffi/cffi/issues/350/ .. _`Issue 358`: https://bitbucket.org/cffi/cffi/issues/358/ .. _`Issue 357`: https://bitbucket.org/cffi/cffi/issues/357/ ``` ### 1.11.4 ``` ======= * Windows: reverted linking with ``python3.dll``, because virtualenv does not make this DLL available to virtual environments for now. See `Issue 355`_. On Windows only, the C extension modules created by cffi follow for now the standard naming scheme ``foo.cp36-win32.pyd``, to make it clear that they are regular CPython modules depending on ``python36.dll``. .. _`Issue 355`: https://bitbucket.org/cffi/cffi/issues/355/ ``` ### 1.11.3 ``` ======= * Fix on CPython 3.x: reading the attributes ``__loader__`` or ``__spec__`` from the cffi-generated lib modules gave a buggy SystemError. (These attributes are always None, and provided only to help compatibility with tools that expect them in all modules.) * More Windows fixes: workaround for MSVC not supporting large literal strings in C code (from ``ffi.embedding_init_code(large_string)``); and an issue with ``Py_LIMITED_API`` linking with ``python35.dll/python36.dll`` instead of ``python3.dll``. * Small documentation improvements. ``` </details> <details> <summary>Links</summary> - PyPI: https://pypi.org/project/cffi - Changelog: https://pyup.io/changelogs/cffi/ - Docs: http://cffi.readthedocs.org </details> ### Update [cryptography](https://pypi.org/project/cryptography) from **2.1.4** to **2.2.2**. <details> <summary>Changelog</summary> ### 2.2.1 ``` ~~~~~~~~~~~~~~~~~~ * Reverted a change to ``GeneralNames`` which prohibited having zero elements, due to breakages. * Fixed a bug in :func:`~cryptography.hazmat.primitives.keywrap.aes_key_unwrap_with_padding` that caused it to raise ``InvalidUnwrap`` when key length modulo 8 was zero. .. _v2-2: ``` ### 2.2 ``` ~~~~~~~~~~~~~~~~ * **BACKWARDS INCOMPATIBLE:** Support for Python 2.6 has been dropped. * Resolved a bug in ``HKDF`` that incorrectly constrained output size. * Added :class:`~cryptography.hazmat.primitives.asymmetric.ec.BrainpoolP256R1`, :class:`~cryptography.hazmat.primitives.asymmetric.ec.BrainpoolP384R1`, and :class:`~cryptography.hazmat.primitives.asymmetric.ec.BrainpoolP512R1` to support inter-operating with systems like German smart meters. * Added token rotation support to :doc:`Fernet </fernet>` with :meth:`~cryptography.fernet.MultiFernet.rotate`. * Fixed a memory leak in :func:`~cryptography.hazmat.primitives.asymmetric.ec.derive_private_key`. * Added support for AES key wrapping with padding via :func:`~cryptography.hazmat.primitives.keywrap.aes_key_wrap_with_padding` and :func:`~cryptography.hazmat.primitives.keywrap.aes_key_unwrap_with_padding` . * Allow loading DSA keys with 224 bit ``q``. .. _v2-1-4: ``` </details> <details> <summary>Links</summary> - PyPI: https://pypi.org/project/cryptography - Changelog: https://pyup.io/changelogs/cryptography/ - Repo: https://github.com/pyca/cryptography </details> ### Update [hyperlink](https://pypi.org/project/hyperlink) from **17.3.1** to **18.0.0**. *The bot wasn't able to find a changelog for this release. [Got an idea?](https://github.com/pyupio/changelogs/issues/new)* <details> <summary>Links</summary> - PyPI: https://pypi.org/project/hyperlink - Changelog: https://pyup.io/changelogs/hyperlink/ - Repo: https://github.com/python-hyper/hyperlink </details> ### Update [ipaddress](https://pypi.org/project/ipaddress) from **1.0.19** to **1.0.21**. *The bot wasn't able to find a changelog for this release. [Got an idea?](https://github.com/pyupio/changelogs/issues/new)* <details> <summary>Links</summary> - PyPI: https://pypi.org/project/ipaddress - Repo: https://github.com/phihag/ipaddress </details> ### Update [lxml](https://pypi.org/project/lxml) from **4.1.1** to **4.2.1**. <details> <summary>Changelog</summary> ### 4.2.1 ``` ================== Bugs fixed ---------- * LP1755825: ``iterwalk()`` failed to return the 'start' event for the initial element if a tag selector is used. * LP1756314: Failure to import 4.2.0 into PyPy due to a missing library symbol. * LP1727864, GH258: Add "-isysroot" linker option on MacOS as needed by XCode 9. ``` ### 4.2.0 ``` ================== Features added -------------- * GH255: ``SelectElement.value`` returns more standard-compliant and browser-like defaults for non-multi-selects. If no option is selected, the value of the first option is returned (instead of None). If multiple options are selected, the value of the last one is returned (instead of that of the first one). If no options are present (not standard-compliant) ``SelectElement.value`` still returns ``None``. * GH261: The ``HTMLParser()`` now supports the ``huge_tree`` option. Patch by stranac. Bugs fixed ---------- * LP1551797: Some XSLT messages were not captured by the transform error log. * LP1737825: Crash at shutdown after an interrupted iterparse run with XMLSchema validation. Other changes ------------- ``` </details> <details> <summary>Links</summary> - PyPI: https://pypi.org/project/lxml - Changelog: https://pyup.io/changelogs/lxml/ - Homepage: http://lxml.de/ - Bugtracker: https://bugs.launchpad.net/lxml </details> ### Update [olefile](https://pypi.org/project/olefile) from **0.44** to **0.45.1**. *The bot wasn't able to find a changelog for this release. [Got an idea?](https://github.com/pyupio/changelogs/issues/new)* <details> <summary>Links</summary> - PyPI: https://pypi.org/project/olefile - Changelog: https://pyup.io/changelogs/olefile/ - Repo: https://github.com/decalage2/olefile/tarball/master - Homepage: https://www.decalage.info/python/olefileio </details> ### Update [pillow](https://pypi.org/project/pillow) from **4.3.0** to **5.1.0**. <details> <summary>Changelog</summary> ### 5.1.0 ``` ------------------ - Close fp before return in ImagingSavePPM 3061 [kathryndavies] - Added documentation for ICNS append_images 3051 [radarhere] - Docs: Move intro text below its header 3021 [hugovk] - CI: Rename appveyor.yml as .appveyor.yml 2978 [hugovk] - Fix TypeError for JPEG2000 parser feed 3042 [hugovk] - Certain corrupted jpegs can result in no data read 3023 [kkopachev] - Add support for BLP file format 3007 [jleclanche] - Simplify version checks 2998 [hugovk] - Fix "invalid escape sequence" warning on Python 3.6+ 2996 [timgraham] - Allow append_images to set .icns scaled images 3005 [radarhere] - Support appending to existing PDFs 2965 [vashek] - Fix and improve efficient saving of ICNS on macOS 3004 [radarhere] - Build: Enable pip cache in AppVeyor build 3009 [thijstriemstra] - Trim trailing whitespace 2985 [Metallicow] - Docs: Correct reference to Image.new method 3000 [radarhere] - Rearrange ImageFilter classes into alphabetical order 2990 [radarhere] - Test: Remove duplicate line 2983 [radarhere] - Build: Update AppVeyor PyPy version 3003 [radarhere] - Tiff: Open 8 bit Tiffs with 5 or 6 channels, discarding extra channels 2938 [homm] - Readme: Added Twitter badge 2930 [hugovk] - Removed __main__ code from ImageCms 2942 [radarhere] - Test: Changed assert statements to unittest calls 2961 [radarhere] - Depends: Update libimagequant to 2.11.10, raqm to 0.5.0, freetype to 2.9 3036, 3017, 2957 [radarhere] - Remove _imaging.crc32 in favor of builtin Python crc32 implementation 2935 [wiredfool] - Move Tk directory to src directory 2928 [hugovk] - Enable pip cache in Travis CI 2933 [jdufresne] - Remove unused and duplicate imports 2927 [radarhere] - Docs: Changed documentation references to 2.x to 2.7 2921 [radarhere] - Fix memory leak when opening webp files 2974 [wiredfool] - Setup: Fix "TypeError: 'NoneType' object is not iterable" for PPC and CRUX 2951 [hugovk] - Setup: Add libdirs for ppc64le and armv7l 2968 [nehaljwani] ``` ### 5.0.0 ``` ------------------ - Docs: Added docstrings from documentation 2914 [radarhere] - Test: Switch from nose to pytest 2815 [hugovk] - Rework Source directory layout, preventing accidental import of PIL. 2911 [wiredfool] - Dynamically link libraqm 2753 [wiredfool] - Removed scripts directory 2901 [wiredfool] - TIFF: Run all compressed tiffs through libtiff decoder 2899 [wiredfool] - GIF: Add disposal option when saving GIFs 2902 [linnil1, wiredfool] - EPS: Allow for an empty line in EPS header data 2903 [radarhere] - PNG: Add support for sRGB and cHRM chunks, permit sRGB when no iCCP chunk present 2898 [wiredfool] - Dependencies: Update Tk Tcl to 8.6.8 2905 [radarhere] - Decompression bomb error now raised for images 2x larger than a decompression bomb warning 2583 [wiredfool] - Test: avoid random failure in test_effect_noise 2894 [hugovk] - Increased epsilon for test_file_eps.py:test_showpage due to Arch update. 2896 [wiredfool] - Removed check parameter from _save in BmpImagePlugin, PngImagePlugin, ImImagePlugin, PalmImagePlugin, and PcxImagePlugin. 2873 [radarhere] - Make PngImagePlugin.add_text() zip argument type bool 2890 [jdufresne] - Depends: Updated libwebp to 0.6.1 2880 [radarhere] - Remove unnecessary bool() calls in Image.registered_extensions and skipKnownBadTests 2891 [jdufresne] - Fix count of BITSPERSAMPLE items in broken TIFF files 2883 [homm] - Fillcolor parameter for Image.Transform 2852 [wiredfool] - Test: Display differences for test failures 2862 [wiredfool] - Added executable flag to file with shebang line 2884 [radarhere] - Setup: Specify compatible Python versions for pip 2877 [hugovk] - Dependencies: Updated libimagequant to 2.11.4 2878 [radarhere] - Setup: Warn if trying to install for Py3.7 on Windows 2855 [hugovk] - Doc: Fonts can be loaded from a file-like object, not just filename 2861 [robin-norwood] - Add eog support for Ubuntu Image Viewer 2864 [NafisFaysal] - Test: Test on 3.7-dev on Travis.ci 2870 [hugovk] - Dependencies: Update libtiff to 4.0.9 2871 [radarhere] - Setup: Replace deprecated platform.dist with file existence check 2869 [wiredfool] - Build: Fix setup.py on Debian 2853 [wiredfool] - Docs: Correct error in ImageDraw documentation 2858 [meribold] - Test: Drop Ubuntu Precise, Fedora 24, Fedora 25, add Fedora 27, Centos 7, Amazon v2 CI Support 2854, 2843, 2895, 2897 [wiredfool] - Dependencies: Updated libimagequant to 2.11.3 2849 [radarhere] - Test: Fix test_image.py to use tempfile 2841 [radarhere] - Replace PIL.OleFileIO deprecation warning with descriptive ImportError 2833 [hugovk] - WebP: Add support for animated WebP files 2761 [jd20] - PDF: Set encoderinfo for images when saving multi-page PDF. Fixes 2804. 2805 [ixio] - Allow the olefile dependency to be optional 2789 [jdufresne] - GIF: Permit LZW code lengths up to 12 bits in GIF decode 2813 [wiredfool] - Fix unterminated string and unchecked exception in _font_text_asBytes. 2825 [wiredfool] - PPM: Use fixed list of whitespace, rather relying on locale, fixes 272. 2831 [markmiscavage] - Added support for generators when using append_images 2829, 2835 [radarhere] - Doc: Correct PixelAccess.rst 2824 [hasahmed] - Depends: Update raqm to 0.3.0 2822 [radarhere] - Docs: Link to maintained version of aggdraw 2809 [hugovk] - Include license file in the generated wheel packages 2801 [jdufresne] - Depends: Update openjpeg to 2.3.0 2791 [radarhere] - Add option to Makefile to build and install with C coverage 2781 [hugovk] - Add context manager support to ImageFile.Parser and PngImagePlugin.ChunkStream 2793 [radarhere] - ImageDraw.textsize: fix zero length error 2788 [wiredfool, hugovk] ``` </details> <details> <summary>Links</summary> - PyPI: https://pypi.org/project/pillow - Changelog: https://pyup.io/changelogs/pillow/ - Homepage: https://python-pillow.org </details> ### Update [python-dateutil](https://pypi.org/project/python-dateutil) from **2.6.1** to **2.7.2**. <details> <summary>Changelog</summary> ### 2.7.2 ``` ========================== Bugfixes -------- - Fixed an issue with the setup script running in non-UTF-8 environment. Reported and fixed by gergondet (gh pr 651) Misc ---- - GH 655 ``` ### 2.7.1 ``` =========================== Data updates ------------ - Updated tzdata version to 2018d. Bugfixes -------- - Fixed issue where parser.parse would occasionally raise decimal.Decimal-specific error types rather than ValueError. Reported by amureki (gh issue 632). Fixed by pganssle (gh pr 636). - Improve error message when rrule's dtstart and until are not both naive or both aware. Reported and fixed by ryanpetrello (gh issue 633, gh pr 634) Misc ---- - GH 644, GH 648 ``` ### 2.7.0 ``` ============= - Dropped support for Python 2.6 (gh pr 362 by jdufresne) - Dropped support for Python 3.2 (gh pr 626) - Updated zoneinfo file to 2018c (gh pr 616) - Changed licensing scheme so all new contributions are dual licensed under Apache 2.0 and BSD. (gh pr 542, issue 496) - Added __all__ variable to the root package. Reported by tebriel (gh issue 406), fixed by mariocj89 (gh pr 494) - Added python_requires to setup.py so that pip will distribute the right version of dateutil. Fixed by jakec-github (gh issue 537, pr 552) - Added the utils submodule, for miscellaneous utilities. - Added within_delta function to utils - added by justanr (gh issue 432, gh pr 437) - Added today function to utils (gh pr 474) - Added default_tzinfo function to utils (gh pr 475), solving an issue reported by nealmcb (gh issue 94) - Added dedicated ISO 8601 parsing function isoparse (gh issue 424). Initial implementation by pganssle in gh pr 489 and 622, with a pre-release fix by kirit93 (gh issue 546, gh pr 573). - Moved parser module into parser/_parser.py and officially deprecated the use of several private functions and classes from that module. (gh pr 501, 515) - Tweaked parser error message to include rejected string format, added by pbiering (gh pr 300) - Add support for parsing bytesarray, reported by uckelman (gh issue 417) and fixed by uckelman and pganssle (gh pr 514) - Started raising a warning when the parser finds a timezone string that it cannot construct a tzinfo instance for (rather than succeeding with no indication of an error). Reported and fixed by jbrockmendel (gh pr 540) - Dropped the use of assert in the parser. Fixed by jbrockmendel (gh pr 502) - Fixed to assertion logic in parser to support dates like '2015-15-May', reported and fixed by jbrockmendel (gh pr 409) - Fixed IndexError in parser on dates with trailing colons, reported and fixed by jbrockmendel (gh pr 420) - Fixed bug where hours were not validated, leading to improper parse. Reported by heappro (gh pr 353), fixed by jbrockmendel (gh pr 482) - Fixed problem parsing strings in %b-%Y-%d format. Reported and fixed by jbrockmendel (gh pr 481) - Fixed problem parsing strings in the %d%B%y format. Reported by asishm (gh issue 360), fixed by jbrockmendel (gh pr 483) - Fixed problem parsing certain unambiguous strings when year <99 (gh pr 510). Reported by alexwlchan (gh issue 293). - Fixed issue with parsing an unambiguous string representation of an ambiguous datetime such that if possible the correct value for fold is set. Fixes issue reported by JordonPhillips and pganssle (gh issue 318, 320, gh pr 517) - Fixed issue with improper rounding of fractional components. Reported by dddmello (gh issue 427), fixed by m-dz (gh pr 570) - Performance improvement to parser from removing certain min() calls. Reported and fixed by jbrockmendel (gh pr 589) - Significantly refactored parser code by jbrockmendel (gh prs 419, 436, 490, 498, 539) and pganssle (gh prs 435, 468) - Implementated of __hash__ for relativedelta and weekday, reported and fixed by mrigor (gh pr 389) - Implemented __abs__ for relativedelta. Reported by binnisb and pferreir (gh issue 350, pr 472) - Fixed relativedelta.weeks property getter and setter to work for both negative and positive values. Reported and fixed by souliane (gh issue 459, pr 460) - Fixed issue where passing whole number floats to the months or years arguments of the relativedelta constructor would lead to errors during addition. Reported by arouanet (gh pr 411), fixed by lkollar (gh pr 553) - Added a pre-built tz.UTC object representing UTC (gh pr 497) - Added a cache to tz.gettz so that by default it will return the same object for identical inputs. This will change the semantics of certain operations between datetimes constructed with tzinfo=tz.gettz(...). (gh pr 628) - Changed the behavior of tz.tzutc to return a singleton (gh pr 497, 504) - Changed the behavior of tz.tzoffset to return the same object when passed the same inputs, with a corresponding performance improvement (gh pr 504) - Changed the behavior of tz.tzstr to return the same object when passed the same inputs. (gh pr 628) - Added .instance alternate constructors for tz.tzoffset and tz.tzstr, to allow the construction of a new instance if desired. (gh pr 628) - Added the tz.gettz.nocache function to allow explicit retrieval of a new instance of the relevant tzinfo. (gh pr 628) - Expand definition of tz.tzlocal equality so that the local zone is allow equality with tzoffset and tzutc. (gh pr 598) - Deprecated the idiosyncratic tzstr format mentioned in several examples but evidently designed exclusively for dateutil, and very likely not used by any current users. (gh issue 595, gh pr 606) - Added the tz.resolve_imaginary function, which generates a real date from an imaginary one, if necessary. Implemented by Cheukting (gh issue 339, gh pr 607) - Fixed issue where the tz.tzstr constructor would erroneously succeed if passed an invalid value for tzstr. Fixed by pablogsal (gh issue 259, gh pr 581) - Fixed issue with tz.gettz for TZ variables that start with a colon. Reported and fixed by lapointexavier (gh pr 601) - Added a lock to tz.tzical's cache. Reported and fixed by Unrud (gh pr 430) - Fixed an issue with fold support on certain Python 3 implementations that used the pre-3.6 pure Python implementation of datetime.replace, most notably pypy3 (gh pr 446). - Added support for VALUE=DATE-TIME for DTSTART in rrulestr. Reported by potuz (gh issue 401) and fixed by Unrud (gh pr 429) - Started enforcing that within VTIMEZONE, the VALUE parameter can only be omitted or DATE-TIME, per RFC 5545. Reported by Unrud (gh pr 439) - Added support for TZID parameter for DTSTART in rrulestr. Reported and fixed by ryanpetrello (gh issue 614, gh pr 624) - Added 'RRULE:' prefix to rrule strings generated by rrule.__str__, in compliance with the RFC. Reported by AndrewPashkin (gh issue 86), fixed by jarondl and mlorant (gh pr 450) - Switched to setuptools_scm for version management, automatically calculating a version number from the git metadata. Reported by jreback (gh issue 511), implemented by Sulley38 (gh pr 564) - Switched setup.py to use find_packages, and started testing against pip installed versions of dateutil in CI. Fixed issue with parser import discovered by jreback in pandas-dev/pandas18141. (gh issue 507, pr 509) - Switched test suite to using pytest (gh pr 495) - Switched CI over to use tox. Fixed by gaborbernat (gh pr 549) - Added a test-only dependency on freezegun. (gh pr 474) - Reduced number of CI builds on Appveyor. Fixed by kirit93 (gh issue 529, gh pr 579) - Made xfails strict by default, so that an xpass is a failure. (gh pr 567) - Added a documentation generation stage to tox and CI. (gh pr 568) - Added an explicit warning when running python setup.py explaining how to run the test suites with pytest. Fixed by lkollar. (gh issue 544, gh pr 548) - Added requirements-dev.txt for test dependency management (gh pr 499, 516) - Fixed code coverage metrics to account for Windows builds (gh pr 526) - Fixed code coverage metrics to NOT count xfails. Fixed by gaborbernat (gh issue 519, gh pr 563) - Style improvement to zoneinfo.tzfile that was confusing to static type checkers. Reported and fixed by quodlibetor (gh pr 485) - Several unused imports were removed by jdufresne. (gh pr 486) - Switched isinstance(*, collections.Callable) to callable, which is available on all supported Python versions. Implemented by jdufresne (gh pr 612) - Added CONTRIBUTING.md (gh pr 533) - Added AUTHORS.md (gh pr 542) - Corrected setup.py metadata to reflect author vs. maintainer, (gh issue 477, gh pr 538) - Corrected README to reflect that tests are now run in pytest. Reported and fixed by m-dz (gh issue 556, gh pr 557) - Updated all references to RFC 2445 (iCalendar) to point to RFC 5545. Fixed by mariocj89 (gh issue 543, gh pr 555) - Corrected parse documentation to reflect proper integer offset units, reported and fixed by abrugh (gh pr 458) - Fixed dangling parenthesis in tzoffset documentation (gh pr 461) - Started including the license file in wheels. Reported and fixed by jdufresne (gh pr 476) - Indendation fixes to parser docstring by jbrockmendel (gh pr 492) - Moved many examples from the "examples" documentation into their appropriate module documentation pages. Fixed by Tomasz-Kluczkowski and jakec-github (gh pr 558, 561) - Fixed documentation so that the parser.isoparse documentation displays. Fixed by alexchamberlain (gh issue 545, gh pr 560) - Refactored build and release sections and added setup instructions to CONTRIBUTING. Reported and fixed by kynan (gh pr 562) - Cleaned up various dead links in the documentation. (gh pr 602, 608, 618) ``` </details> <details> <summary>Links</summary> - PyPI: https://pypi.org/project/python-dateutil - Changelog: https://pyup.io/changelogs/python-dateutil/ - Docs: https://dateutil.readthedocs.io </details> ### Update [pytz](https://pypi.org/project/pytz) from **2017.3** to **2018.4**. *The bot wasn't able to find a changelog for this release. [Got an idea?](https://github.com/pyupio/changelogs/issues/new)* <details> <summary>Links</summary> - PyPI: https://pypi.org/project/pytz - Homepage: http://pythonhosted.org/pytz - Docs: https://pythonhosted.org/pytz/ </details> ### Update [twisted[tls,conch]](https://pypi.org/project/twisted) from **17.9.0** to **18.4.0**. <details> <summary>Changelog</summary> ### 18.4.0 ``` =========================== Features -------- - The --port/--https arguments to web plugin are now deprecated, in favor of --listen. The --listen argument can be given multiple times to listen on multiple ports. (6670) - Twisted now requires zope.interface 4.4.2 or higher across all platforms and Python versions. (8149) - The osx_platform setuptools extra has been renamed to macos_platform, with the former name being a compatibility alias. (8848) - Zsh completions are now provided for the twist command. (9338) - twisted.internet.endpoints.HostnameEndpoint now has a __repr__ method which includes the host and port to which the endpoint connects. (9341) Bugfixes -------- - twistd now uses the UID's default GID to initialize groups when --uid is given but --gid is not. This prevents an unhandled TypeError from being raised when os.initgroups() is called. (4442) - twisted.protocols.basic.LineReceiver checks received lines' lengths against its MAX_LENGTH only after receiving a complete delimiter. A line ending in a multi-byte delimiter like '\r\n' might be split by the network, with the first part arriving before the rest; previously, LineReceiver erroneously disconnected if the first part, e.g. 'zzzz....\r' exceeded MAX_LENGTH. LineReceiver now checks received data against MAX_LENGTH plus the delimiter's length, allowing short reads to complete a line. (6556) - twisted.protocols.basic.LineOnlyReceiver disconnects the transport after receiving a line that exceeds MAX_LENGTH, like LineReceiver. (6557) - twisted.web.http.Request.getClientIP now returns the host part of the client's address when connected over IPv6. (7704) - twisted.application.service.IService is now documented as requiring the 'running', 'name' and 'parent' attributes (the documentation previously implied they were required, but was unclear). (7922) - twisted.web.wsgi.WSGIResource no longer raises an exception when a client connects over IPv6. (8241) - When using TLS enable automatic ECDH curve selection on OpenSSL 1.0.2+ instead of only supporting P-256 (9210) - twisted.trial._dist.worker and twisted.trial._dist.workertrial consistently pass bytes, not unicode to AMP. This fixes "trial -j" on Python 3. (9264) - twisted.trial.runner now uses the 'importlib' module instead of the 'imp' module on Python 3+. This eliminates DeprecationWarnings caused by importing 'imp' on Python 3. (9275) - twisted.web.client.HTTP11ClientProtocol now closes the connection when the server is sending a header line which is longer than he line limit of twisted.protocols.basic.LineReceiver.MAX_LENGTH. (9295) - twisted.python.failure now handles long stacktraces better; in particular it will log tracebacks for stack overflow errors. (9301) - The "--_shell-completion" argument to twistd now works on Python 3. (9303) - twisted.python.failure.Failure now raises the wrapped exception in Python3, and self (Failure) n Python2 when trap() is called without a matching exception (9307) - Writing large amounts of data no longer implies repeated, expensive copying under Python 3. Python 3's write speeds are now as fast as Python 2's. (9324) - twisted.protocols.postfix now properly encodes errors which are unicode strings to bytes. (9335) - twisted.protocols.policies.ProtocolWrapper and twisted.protocols.tls.TLSMemoryBIOProtocol no longer create circular references that keep protocol instances in memory after connection is closed. (9374) - twisted.conch.ssh.transport.SSHTransportBase no longer strips trailing spaces from the SSH version string of the connected peer. (9377) - `trial -j` no longer crashes on Python 2 on test failure messages containing non-ASCII bytes. (9378) - RSA keys replaced with 2048bit ones in twisted.conch.test.keydata in order to be compatible with OpenSSH 7.6. (9388) - AsyncioSelectorReactor uses the global policy's event loop. asyncio libraries that retrieve the running event loop with get_event_loop() will now receive the one used by AsyncioSelectorReactor. (9390) Improved Documentation ---------------------- - public attributes of `twisted.logger.Logger` are now documented as attributes. (8157) - List indentation formatting errors have been corrected throughout the documentation. (9256) Deprecations and Removals ------------------------- - twisted.protocols.basic.LineOnlyReceiver.lineLengthExceeded no longer returns twisted.internet.error.ConnectionLost. It instead directly disconnects the transport and returns None. (6557) - twisted.python.win32.getProgramsMenuPath and twisted.python.win32.getProgramFilesPath were deprecated in Twisted 15.3.0 and have now been removed. (9312) - Python 3.3 is no longer supported. (9352) Misc ---- - 7033, 8887, 9204, 9289, 9291, 9292, 9293, 9302, 9336, 9355, 9356, 9364, 9375, 9381, 9382, 9389, 9391, 9393, 9394, 9396 Conch ----- Bugfixes ~~~~~~~~ - twisted.plugins.cred_unix now properly converts a username and password from bytes to str on Python 3. In addition, passwords which are encrypted with SHA512 and SH256 are properly verified. This fixes running a conch server with: "twistd -n conch -d /etc/ssh/ --auth=unix". (9130) - In twisted.conch.scripts.conch, on Python 3 do not write bytes directly to sys.stderr. On Python 3, this fixes remote SSH execution of a command which fails. (9344) Deprecations and Removals ~~~~~~~~~~~~~~~~~~~~~~~~~ - twisted.conch.ssh.filetransfer.FileTransferClient.wasAFile attribute has been removed as it serves no purpose. (9362) - Removed deprecated support for PyCrypto key objects in conch (9368) Web --- Features ~~~~~~~~ - The new twisted.iweb.IRequest.getClientAddress returns the IAddress provider representing the client's address. Callers should check the type of the returned value before using it. (7707) - Eliminate use of twisted.python.log in twisted.web modules. (9280) Bugfixes ~~~~~~~~ - Scripts ending with .rpy, .epy, and .cgi now execute properly in Twisted Web on Python 3. (9271) - twisted.web.http.Request and twisted.web.server.Request are once again hashable on Python 2, fixing a regression introduced in Twisted 17.5.0. (9314) Improved Documentation ~~~~~~~~~~~~~~~~~~~~~~ - Correct reactor docstrings for twisted.web.client.Agent and twisted.web.client._StandardEndpointFactory to communicate interface requirements since 17.1. (9274) - The examples for the "Twisted Web in 60 Seconds" tutorial have been fixed to work on Python 3. (9285) Deprecations and Removals ~~~~~~~~~~~~~~~~~~~~~~~~~ - twisted.iweb.IRequest.getClientIP is deprecated. Use twisted.iweb.IRequest.getClientAddress instead (see 7707). (7705) - twisted.web.iweb.IRequest.getClient and its implementations (deprecated in 2552) have been removed. (9395) Mail ---- Bugfixes ~~~~~~~~ - twistd.mail.scripts.mailmail has been ported to Python 3. (8487) - twisted.mail.bounce now works on Python 3. (9260) - twisted.mail.pop3 and twisted.mail.pop3client now work on Python 3. (9269) - SMTP authentication in twisted.mail.smtp now works better on Python 3, due to improved improved bytes vs unicode handling. (9299) Misc ~~~~ - 9310 Words ----- No significant changes. Names ----- No significant changes. ``` </details> <details> <summary>Links</summary> - PyPI: https://pypi.org/project/twisted - Changelog: https://pyup.io/changelogs/twisted/ - Homepage: http://twistedmatrix.com/ - Bugtracker: https://twistedmatrix.com/trac/ </details> ### Update [zope.interface](https://pypi.org/project/zope.interface) from **4.4.3** to **4.5.0**. <details> <summary>Changelog</summary> ### 4.5.0 ``` ------------------ - Drop support for 3.3, avoid accidental dependence breakage via setup.py. See `PR 110 <https://github.com/zopefoundation/zope.interface/pull/110>`_. - Allow registering and unregistering instance methods as listeners. See `issue 12 <https://github.com/zopefoundation/zope.interface/issues/12>`_ and `PR 102 <https://github.com/zopefoundation/zope.interface/pull/102>`_. - Synchronize and simplify zope/__init__.py. See `issue 114 <https://github.com/zopefoundation/zope.interface/issues/114>`_ ``` </details> <details> <summary>Links</summary> - PyPI: https://pypi.org/project/zope.interface - Changelog: https://pyup.io/changelogs/zope.interface/ - Repo: https://github.com/zopefoundation/zope.interface </details>
133: Scheduled weekly dependency update for week 18 r=mithrandi a=pyup-bot ### Update [attrs](https://pypi.org/project/attrs) from **17.4.0** to **18.1.0**. <details> <summary>Changelog</summary> ### 18.1.0 ``` ------------------- Changes ^^^^^^^ - ``x=X(); x.cycle = x; repr(x)`` will no longer raise a ``RecursionError``, and will instead show as ``X(x=...)``. `95 <https://github.com/python-attrs/attrs/issues/95>`_ - ``attr.ib(factory=f)`` is now syntactic sugar for the common case of ``attr.ib(default=attr.Factory(f))``. `178 <https://github.com/python-attrs/attrs/issues/178>`_, `356 <https://github.com/python-attrs/attrs/issues/356>`_ - Added ``attr.field_dict()`` to return an ordered dictionary of ``attrs`` attributes for a class, whose keys are the attribute names. `290 <https://github.com/python-attrs/attrs/issues/290>`_, `349 <https://github.com/python-attrs/attrs/issues/349>`_ - The order of attributes that are passed into ``attr.make_class()`` or the ``these`` argument of ``attr.s()`` is now retained if the dictionary is ordered (i.e. ``dict`` on Python 3.6 and later, ``collections.OrderedDict`` otherwise). Before, the order was always determined by the order in which the attributes have been defined which may not be desirable when creating classes programatically. `300 <https://github.com/python-attrs/attrs/issues/300>`_, `339 <https://github.com/python-attrs/attrs/issues/339>`_, `343 <https://github.com/python-attrs/attrs/issues/343>`_ - In slotted classes, ``__getstate__`` and ``__setstate__`` now ignore the ``__weakref__`` attribute. `311 <https://github.com/python-attrs/attrs/issues/311>`_, `326 <https://github.com/python-attrs/attrs/issues/326>`_ - Setting the cell type is now completely best effort. This fixes ``attrs`` on Jython. We cannot make any guarantees regarding Jython though, because our test suite cannot run due to dependency incompatabilities. `321 <https://github.com/python-attrs/attrs/issues/321>`_, `334 <https://github.com/python-attrs/attrs/issues/334>`_ - If ``attr.s`` is passed a *these* argument, it will not attempt to remove attributes with the same name from the class body anymore. `322 <https://github.com/python-attrs/attrs/issues/322>`_, `323 <https://github.com/python-attrs/attrs/issues/323>`_ - The hash of ``attr.NOTHING`` is now vegan and faster on 32bit Python builds. `331 <https://github.com/python-attrs/attrs/issues/331>`_, `332 <https://github.com/python-attrs/attrs/issues/332>`_ - The overhead of instantiating frozen dict classes is virtually eliminated. `336 <https://github.com/python-attrs/attrs/issues/336>`_ - Generated ``__init__`` methods now have an ``__annotations__`` attribute derived from the types of the fields. `363 <https://github.com/python-attrs/attrs/issues/363>`_ - We have restructured the documentation a bit to account for ``attrs``' growth in scope. Instead of putting everything into the `examples <http://www.attrs.org/en/stable/examples.html>`_ page, we have started to extract narrative chapters. So far, we've added chapters on `initialization <http://www.attrs.org/en/stable/init.html>`_ and `hashing <http://www.attrs.org/en/stable/hashing.html>`_. Expect more to come! `369 <https://github.com/python-attrs/attrs/issues/369>`_, `370 <https://github.com/python-attrs/attrs/issues/370>`_ ---- ``` </details> <details> <summary>Links</summary> - PyPI: https://pypi.org/project/attrs - Changelog: https://pyup.io/changelogs/attrs/ - Homepage: http://www.attrs.org/ </details> ### Update [twisted[tls]](https://pypi.org/project/twisted) from **17.9.0** to **18.4.0**. <details> <summary>Changelog</summary> ### 18.4.0 ``` =========================== Features -------- - The --port/--https arguments to web plugin are now deprecated, in favor of --listen. The --listen argument can be given multiple times to listen on multiple ports. (6670) - Twisted now requires zope.interface 4.4.2 or higher across all platforms and Python versions. (8149) - The osx_platform setuptools extra has been renamed to macos_platform, with the former name being a compatibility alias. (8848) - Zsh completions are now provided for the twist command. (9338) - twisted.internet.endpoints.HostnameEndpoint now has a __repr__ method which includes the host and port to which the endpoint connects. (9341) Bugfixes -------- - twistd now uses the UID's default GID to initialize groups when --uid is given but --gid is not. This prevents an unhandled TypeError from being raised when os.initgroups() is called. (4442) - twisted.protocols.basic.LineReceiver checks received lines' lengths against its MAX_LENGTH only after receiving a complete delimiter. A line ending in a multi-byte delimiter like '\r\n' might be split by the network, with the first part arriving before the rest; previously, LineReceiver erroneously disconnected if the first part, e.g. 'zzzz....\r' exceeded MAX_LENGTH. LineReceiver now checks received data against MAX_LENGTH plus the delimiter's length, allowing short reads to complete a line. (6556) - twisted.protocols.basic.LineOnlyReceiver disconnects the transport after receiving a line that exceeds MAX_LENGTH, like LineReceiver. (6557) - twisted.web.http.Request.getClientIP now returns the host part of the client's address when connected over IPv6. (7704) - twisted.application.service.IService is now documented as requiring the 'running', 'name' and 'parent' attributes (the documentation previously implied they were required, but was unclear). (7922) - twisted.web.wsgi.WSGIResource no longer raises an exception when a client connects over IPv6. (8241) - When using TLS enable automatic ECDH curve selection on OpenSSL 1.0.2+ instead of only supporting P-256 (9210) - twisted.trial._dist.worker and twisted.trial._dist.workertrial consistently pass bytes, not unicode to AMP. This fixes "trial -j" on Python 3. (9264) - twisted.trial.runner now uses the 'importlib' module instead of the 'imp' module on Python 3+. This eliminates DeprecationWarnings caused by importing 'imp' on Python 3. (9275) - twisted.web.client.HTTP11ClientProtocol now closes the connection when the server is sending a header line which is longer than he line limit of twisted.protocols.basic.LineReceiver.MAX_LENGTH. (9295) - twisted.python.failure now handles long stacktraces better; in particular it will log tracebacks for stack overflow errors. (9301) - The "--_shell-completion" argument to twistd now works on Python 3. (9303) - twisted.python.failure.Failure now raises the wrapped exception in Python3, and self (Failure) n Python2 when trap() is called without a matching exception (9307) - Writing large amounts of data no longer implies repeated, expensive copying under Python 3. Python 3's write speeds are now as fast as Python 2's. (9324) - twisted.protocols.postfix now properly encodes errors which are unicode strings to bytes. (9335) - twisted.protocols.policies.ProtocolWrapper and twisted.protocols.tls.TLSMemoryBIOProtocol no longer create circular references that keep protocol instances in memory after connection is closed. (9374) - twisted.conch.ssh.transport.SSHTransportBase no longer strips trailing spaces from the SSH version string of the connected peer. (9377) - `trial -j` no longer crashes on Python 2 on test failure messages containing non-ASCII bytes. (9378) - RSA keys replaced with 2048bit ones in twisted.conch.test.keydata in order to be compatible with OpenSSH 7.6. (9388) - AsyncioSelectorReactor uses the global policy's event loop. asyncio libraries that retrieve the running event loop with get_event_loop() will now receive the one used by AsyncioSelectorReactor. (9390) Improved Documentation ---------------------- - public attributes of `twisted.logger.Logger` are now documented as attributes. (8157) - List indentation formatting errors have been corrected throughout the documentation. (9256) Deprecations and Removals ------------------------- - twisted.protocols.basic.LineOnlyReceiver.lineLengthExceeded no longer returns twisted.internet.error.ConnectionLost. It instead directly disconnects the transport and returns None. (6557) - twisted.python.win32.getProgramsMenuPath and twisted.python.win32.getProgramFilesPath were deprecated in Twisted 15.3.0 and have now been removed. (9312) - Python 3.3 is no longer supported. (9352) Misc ---- - 7033, 8887, 9204, 9289, 9291, 9292, 9293, 9302, 9336, 9355, 9356, 9364, 9375, 9381, 9382, 9389, 9391, 9393, 9394, 9396 Conch ----- Bugfixes ~~~~~~~~ - twisted.plugins.cred_unix now properly converts a username and password from bytes to str on Python 3. In addition, passwords which are encrypted with SHA512 and SH256 are properly verified. This fixes running a conch server with: "twistd -n conch -d /etc/ssh/ --auth=unix". (9130) - In twisted.conch.scripts.conch, on Python 3 do not write bytes directly to sys.stderr. On Python 3, this fixes remote SSH execution of a command which fails. (9344) Deprecations and Removals ~~~~~~~~~~~~~~~~~~~~~~~~~ - twisted.conch.ssh.filetransfer.FileTransferClient.wasAFile attribute has been removed as it serves no purpose. (9362) - Removed deprecated support for PyCrypto key objects in conch (9368) Web --- Features ~~~~~~~~ - The new twisted.iweb.IRequest.getClientAddress returns the IAddress provider representing the client's address. Callers should check the type of the returned value before using it. (7707) - Eliminate use of twisted.python.log in twisted.web modules. (9280) Bugfixes ~~~~~~~~ - Scripts ending with .rpy, .epy, and .cgi now execute properly in Twisted Web on Python 3. (9271) - twisted.web.http.Request and twisted.web.server.Request are once again hashable on Python 2, fixing a regression introduced in Twisted 17.5.0. (9314) Improved Documentation ~~~~~~~~~~~~~~~~~~~~~~ - Correct reactor docstrings for twisted.web.client.Agent and twisted.web.client._StandardEndpointFactory to communicate interface requirements since 17.1. (9274) - The examples for the "Twisted Web in 60 Seconds" tutorial have been fixed to work on Python 3. (9285) Deprecations and Removals ~~~~~~~~~~~~~~~~~~~~~~~~~ - twisted.iweb.IRequest.getClientIP is deprecated. Use twisted.iweb.IRequest.getClientAddress instead (see 7707). (7705) - twisted.web.iweb.IRequest.getClient and its implementations (deprecated in 2552) have been removed. (9395) Mail ---- Bugfixes ~~~~~~~~ - twistd.mail.scripts.mailmail has been ported to Python 3. (8487) - twisted.mail.bounce now works on Python 3. (9260) - twisted.mail.pop3 and twisted.mail.pop3client now work on Python 3. (9269) - SMTP authentication in twisted.mail.smtp now works better on Python 3, due to improved improved bytes vs unicode handling. (9299) Misc ~~~~ - 9310 Words ----- No significant changes. Names ----- No significant changes. ``` </details> <details> <summary>Links</summary> - PyPI: https://pypi.org/project/twisted - Changelog: https://pyup.io/changelogs/twisted/ - Homepage: http://twistedmatrix.com/ - Bugtracker: https://twistedmatrix.com/trac/ </details> ### Update [zope.interface](https://pypi.org/project/zope.interface) from **4.4.3** to **4.5.0**. <details> <summary>Changelog</summary> ### 4.5.0 ``` ------------------ - Drop support for 3.3, avoid accidental dependence breakage via setup.py. See `PR 110 <https://github.com/zopefoundation/zope.interface/pull/110>`_. - Allow registering and unregistering instance methods as listeners. See `issue 12 <https://github.com/zopefoundation/zope.interface/issues/12>`_ and `PR 102 <https://github.com/zopefoundation/zope.interface/pull/102>`_. - Synchronize and simplify zope/__init__.py. See `issue 114 <https://github.com/zopefoundation/zope.interface/issues/114>`_ ``` </details> <details> <summary>Links</summary> - PyPI: https://pypi.org/project/zope.interface - Changelog: https://pyup.io/changelogs/zope.interface/ - Repo: https://github.com/zopefoundation/zope.interface </details>
193: Scheduled weekly dependency update for week 18 r=mithrandi a=pyup-bot ### Update [attrs](https://pypi.org/project/attrs) from **17.4.0** to **18.1.0**. <details> <summary>Changelog</summary> ### 18.1.0 ``` ------------------- Changes ^^^^^^^ - ``x=X(); x.cycle = x; repr(x)`` will no longer raise a ``RecursionError``, and will instead show as ``X(x=...)``. `95 <https://github.com/python-attrs/attrs/issues/95>`_ - ``attr.ib(factory=f)`` is now syntactic sugar for the common case of ``attr.ib(default=attr.Factory(f))``. `178 <https://github.com/python-attrs/attrs/issues/178>`_, `356 <https://github.com/python-attrs/attrs/issues/356>`_ - Added ``attr.field_dict()`` to return an ordered dictionary of ``attrs`` attributes for a class, whose keys are the attribute names. `290 <https://github.com/python-attrs/attrs/issues/290>`_, `349 <https://github.com/python-attrs/attrs/issues/349>`_ - The order of attributes that are passed into ``attr.make_class()`` or the ``these`` argument of ``attr.s()`` is now retained if the dictionary is ordered (i.e. ``dict`` on Python 3.6 and later, ``collections.OrderedDict`` otherwise). Before, the order was always determined by the order in which the attributes have been defined which may not be desirable when creating classes programatically. `300 <https://github.com/python-attrs/attrs/issues/300>`_, `339 <https://github.com/python-attrs/attrs/issues/339>`_, `343 <https://github.com/python-attrs/attrs/issues/343>`_ - In slotted classes, ``__getstate__`` and ``__setstate__`` now ignore the ``__weakref__`` attribute. `311 <https://github.com/python-attrs/attrs/issues/311>`_, `326 <https://github.com/python-attrs/attrs/issues/326>`_ - Setting the cell type is now completely best effort. This fixes ``attrs`` on Jython. We cannot make any guarantees regarding Jython though, because our test suite cannot run due to dependency incompatabilities. `321 <https://github.com/python-attrs/attrs/issues/321>`_, `334 <https://github.com/python-attrs/attrs/issues/334>`_ - If ``attr.s`` is passed a *these* argument, it will not attempt to remove attributes with the same name from the class body anymore. `322 <https://github.com/python-attrs/attrs/issues/322>`_, `323 <https://github.com/python-attrs/attrs/issues/323>`_ - The hash of ``attr.NOTHING`` is now vegan and faster on 32bit Python builds. `331 <https://github.com/python-attrs/attrs/issues/331>`_, `332 <https://github.com/python-attrs/attrs/issues/332>`_ - The overhead of instantiating frozen dict classes is virtually eliminated. `336 <https://github.com/python-attrs/attrs/issues/336>`_ - Generated ``__init__`` methods now have an ``__annotations__`` attribute derived from the types of the fields. `363 <https://github.com/python-attrs/attrs/issues/363>`_ - We have restructured the documentation a bit to account for ``attrs``' growth in scope. Instead of putting everything into the `examples <http://www.attrs.org/en/stable/examples.html>`_ page, we have started to extract narrative chapters. So far, we've added chapters on `initialization <http://www.attrs.org/en/stable/init.html>`_ and `hashing <http://www.attrs.org/en/stable/hashing.html>`_. Expect more to come! `369 <https://github.com/python-attrs/attrs/issues/369>`_, `370 <https://github.com/python-attrs/attrs/issues/370>`_ ---- ``` </details> <details> <summary>Links</summary> - PyPI: https://pypi.org/project/attrs - Changelog: https://pyup.io/changelogs/attrs/ - Homepage: http://www.attrs.org/ </details> ### Update [hypothesis](https://pypi.org/project/hypothesis) from **3.53.0** to **3.56.5**. *The bot wasn't able to find a changelog for this release. [Got an idea?](https://github.com/pyupio/changelogs/issues/new)* <details> <summary>Links</summary> - PyPI: https://pypi.org/project/hypothesis - Repo: https://github.com/HypothesisWorks/hypothesis/issues </details> ### Update [ipaddress](https://pypi.org/project/ipaddress) from **1.0.19** to **1.0.21**. *The bot wasn't able to find a changelog for this release. [Got an idea?](https://github.com/pyupio/changelogs/issues/new)* <details> <summary>Links</summary> - PyPI: https://pypi.org/project/ipaddress - Repo: https://github.com/phihag/ipaddress </details> ### Update [pbr](https://pypi.org/project/pbr) from **4.0.0** to **4.0.2**. *The bot wasn't able to find a changelog for this release. [Got an idea?](https://github.com/pyupio/changelogs/issues/new)* <details> <summary>Links</summary> - PyPI: https://pypi.org/project/pbr - Homepage: https://docs.openstack.org/pbr/latest/ </details> ### Update [twisted[tls]](https://pypi.org/project/twisted) from **17.9.0** to **18.4.0**. <details> <summary>Changelog</summary> ### 18.4.0 ``` =========================== Features -------- - The --port/--https arguments to web plugin are now deprecated, in favor of --listen. The --listen argument can be given multiple times to listen on multiple ports. (6670) - Twisted now requires zope.interface 4.4.2 or higher across all platforms and Python versions. (8149) - The osx_platform setuptools extra has been renamed to macos_platform, with the former name being a compatibility alias. (8848) - Zsh completions are now provided for the twist command. (9338) - twisted.internet.endpoints.HostnameEndpoint now has a __repr__ method which includes the host and port to which the endpoint connects. (9341) Bugfixes -------- - twistd now uses the UID's default GID to initialize groups when --uid is given but --gid is not. This prevents an unhandled TypeError from being raised when os.initgroups() is called. (4442) - twisted.protocols.basic.LineReceiver checks received lines' lengths against its MAX_LENGTH only after receiving a complete delimiter. A line ending in a multi-byte delimiter like '\r\n' might be split by the network, with the first part arriving before the rest; previously, LineReceiver erroneously disconnected if the first part, e.g. 'zzzz....\r' exceeded MAX_LENGTH. LineReceiver now checks received data against MAX_LENGTH plus the delimiter's length, allowing short reads to complete a line. (6556) - twisted.protocols.basic.LineOnlyReceiver disconnects the transport after receiving a line that exceeds MAX_LENGTH, like LineReceiver. (6557) - twisted.web.http.Request.getClientIP now returns the host part of the client's address when connected over IPv6. (7704) - twisted.application.service.IService is now documented as requiring the 'running', 'name' and 'parent' attributes (the documentation previously implied they were required, but was unclear). (7922) - twisted.web.wsgi.WSGIResource no longer raises an exception when a client connects over IPv6. (8241) - When using TLS enable automatic ECDH curve selection on OpenSSL 1.0.2+ instead of only supporting P-256 (9210) - twisted.trial._dist.worker and twisted.trial._dist.workertrial consistently pass bytes, not unicode to AMP. This fixes "trial -j" on Python 3. (9264) - twisted.trial.runner now uses the 'importlib' module instead of the 'imp' module on Python 3+. This eliminates DeprecationWarnings caused by importing 'imp' on Python 3. (9275) - twisted.web.client.HTTP11ClientProtocol now closes the connection when the server is sending a header line which is longer than he line limit of twisted.protocols.basic.LineReceiver.MAX_LENGTH. (9295) - twisted.python.failure now handles long stacktraces better; in particular it will log tracebacks for stack overflow errors. (9301) - The "--_shell-completion" argument to twistd now works on Python 3. (9303) - twisted.python.failure.Failure now raises the wrapped exception in Python3, and self (Failure) n Python2 when trap() is called without a matching exception (9307) - Writing large amounts of data no longer implies repeated, expensive copying under Python 3. Python 3's write speeds are now as fast as Python 2's. (9324) - twisted.protocols.postfix now properly encodes errors which are unicode strings to bytes. (9335) - twisted.protocols.policies.ProtocolWrapper and twisted.protocols.tls.TLSMemoryBIOProtocol no longer create circular references that keep protocol instances in memory after connection is closed. (9374) - twisted.conch.ssh.transport.SSHTransportBase no longer strips trailing spaces from the SSH version string of the connected peer. (9377) - `trial -j` no longer crashes on Python 2 on test failure messages containing non-ASCII bytes. (9378) - RSA keys replaced with 2048bit ones in twisted.conch.test.keydata in order to be compatible with OpenSSH 7.6. (9388) - AsyncioSelectorReactor uses the global policy's event loop. asyncio libraries that retrieve the running event loop with get_event_loop() will now receive the one used by AsyncioSelectorReactor. (9390) Improved Documentation ---------------------- - public attributes of `twisted.logger.Logger` are now documented as attributes. (8157) - List indentation formatting errors have been corrected throughout the documentation. (9256) Deprecations and Removals ------------------------- - twisted.protocols.basic.LineOnlyReceiver.lineLengthExceeded no longer returns twisted.internet.error.ConnectionLost. It instead directly disconnects the transport and returns None. (6557) - twisted.python.win32.getProgramsMenuPath and twisted.python.win32.getProgramFilesPath were deprecated in Twisted 15.3.0 and have now been removed. (9312) - Python 3.3 is no longer supported. (9352) Misc ---- - 7033, 8887, 9204, 9289, 9291, 9292, 9293, 9302, 9336, 9355, 9356, 9364, 9375, 9381, 9382, 9389, 9391, 9393, 9394, 9396 Conch ----- Bugfixes ~~~~~~~~ - twisted.plugins.cred_unix now properly converts a username and password from bytes to str on Python 3. In addition, passwords which are encrypted with SHA512 and SH256 are properly verified. This fixes running a conch server with: "twistd -n conch -d /etc/ssh/ --auth=unix". (9130) - In twisted.conch.scripts.conch, on Python 3 do not write bytes directly to sys.stderr. On Python 3, this fixes remote SSH execution of a command which fails. (9344) Deprecations and Removals ~~~~~~~~~~~~~~~~~~~~~~~~~ - twisted.conch.ssh.filetransfer.FileTransferClient.wasAFile attribute has been removed as it serves no purpose. (9362) - Removed deprecated support for PyCrypto key objects in conch (9368) Web --- Features ~~~~~~~~ - The new twisted.iweb.IRequest.getClientAddress returns the IAddress provider representing the client's address. Callers should check the type of the returned value before using it. (7707) - Eliminate use of twisted.python.log in twisted.web modules. (9280) Bugfixes ~~~~~~~~ - Scripts ending with .rpy, .epy, and .cgi now execute properly in Twisted Web on Python 3. (9271) - twisted.web.http.Request and twisted.web.server.Request are once again hashable on Python 2, fixing a regression introduced in Twisted 17.5.0. (9314) Improved Documentation ~~~~~~~~~~~~~~~~~~~~~~ - Correct reactor docstrings for twisted.web.client.Agent and twisted.web.client._StandardEndpointFactory to communicate interface requirements since 17.1. (9274) - The examples for the "Twisted Web in 60 Seconds" tutorial have been fixed to work on Python 3. (9285) Deprecations and Removals ~~~~~~~~~~~~~~~~~~~~~~~~~ - twisted.iweb.IRequest.getClientIP is deprecated. Use twisted.iweb.IRequest.getClientAddress instead (see 7707). (7705) - twisted.web.iweb.IRequest.getClient and its implementations (deprecated in 2552) have been removed. (9395) Mail ---- Bugfixes ~~~~~~~~ - twistd.mail.scripts.mailmail has been ported to Python 3. (8487) - twisted.mail.bounce now works on Python 3. (9260) - twisted.mail.pop3 and twisted.mail.pop3client now work on Python 3. (9269) - SMTP authentication in twisted.mail.smtp now works better on Python 3, due to improved improved bytes vs unicode handling. (9299) Misc ~~~~ - 9310 Words ----- No significant changes. Names ----- No significant changes. ``` </details> <details> <summary>Links</summary> - PyPI: https://pypi.org/project/twisted - Changelog: https://pyup.io/changelogs/twisted/ - Homepage: http://twistedmatrix.com/ - Bugtracker: https://twistedmatrix.com/trac/ </details> ### Update [zope.interface](https://pypi.org/project/zope.interface) from **4.4.3** to **4.5.0**. <details> <summary>Changelog</summary> ### 4.5.0 ``` ------------------ - Drop support for 3.3, avoid accidental dependence breakage via setup.py. See `PR 110 <https://github.com/zopefoundation/zope.interface/pull/110>`_. - Allow registering and unregistering instance methods as listeners. See `issue 12 <https://github.com/zopefoundation/zope.interface/issues/12>`_ and `PR 102 <https://github.com/zopefoundation/zope.interface/pull/102>`_. - Synchronize and simplify zope/__init__.py. See `issue 114 <https://github.com/zopefoundation/zope.interface/issues/114>`_ ``` </details> <details> <summary>Links</summary> - PyPI: https://pypi.org/project/zope.interface - Changelog: https://pyup.io/changelogs/zope.interface/ - Repo: https://github.com/zopefoundation/zope.interface </details>
attrs is a huge net win on an object like this:
but it's a lot less clear when you have something like this:
which becomes
I think an alias for this behavior, like:
could make initializing these types of mutable objects a lot less verbose.
The text was updated successfully, but these errors were encountered: