Skip to content
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

Add attrs namespace #887

Merged
merged 14 commits into from Dec 25, 2021
1 change: 1 addition & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Expand Up @@ -19,6 +19,7 @@ If your pull request is a documentation fix or a trivial typo, feel free to dele
- [ ] New features have been added to our [Hypothesis testing strategy](https://github.com/python-attrs/attrs/blob/main/tests/strategies.py).
- [ ] Changes or additions to public APIs are reflected in our type stubs (files ending in ``.pyi``).
- [ ] ...and used in the stub test file `tests/typing_example.py`.
- [ ] If they've been added to `attr/__init__.pyi`, they've *also* been re-imported in `attrs/__init__.pyi`.
- [ ] Updated **documentation** for changed code.
- [ ] New functions/classes have to be added to `docs/api.rst` by hand.
- [ ] Changes to the signature of `@attr.s()` have to be added by hand too.
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.rst
Expand Up @@ -12,7 +12,7 @@ Whenever there is a need to break compatibility, it is announced here in the cha

.. warning::

The structure of the `attr.Attribute` class is exempt from this rule.
The structure of the `attrs.Attribute` class is exempt from this rule.
It *will* change in the future, but since it should be considered read-only, that shouldn't matter.

However if you intend to build extensions on top of ``attrs`` you have to anticipate that.
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Expand Up @@ -2,8 +2,8 @@ include LICENSE *.rst *.toml *.yml *.yaml *.ini
graft .github

# Stubs
include src/attr/py.typed
recursive-include src *.pyi
recursive-include src py.typed

# Tests
include tox.ini conftest.py
Expand Down
5 changes: 2 additions & 3 deletions README.rst
Expand Up @@ -32,13 +32,12 @@ For that, it gives you a class decorator and a way to declaratively define the a

.. code-block:: pycon

>>> from typing import List
>>> from attr import asdict, define, make_class, Factory
>>> from attrs import asdict, define, make_class, Factory

>>> @define
... class SomeClass:
... a_number: int = 42
... list_of_numbers: List[int] = Factory(list)
... list_of_numbers: list[int] = Factory(list)
...
... def hard_math(self, another_number):
... return self.a_number + sum(self.list_of_numbers) * another_number
Expand Down
14 changes: 14 additions & 0 deletions changelog.d/887.breaking.rst
@@ -0,0 +1,14 @@
``import attrs`` has finally landed!
As of this release, you can finally import ``attrs`` using its proper name.

Not all names from the ``attr`` namespace have been transferred; most notably ``attr.s`` and ``attr.ib`` are missing.
See ``attrs.define`` and ``attrs.field`` if you haven't seen our next-generation APIs yet.
A more elaborate explanation can be found `On The Core API Names <https://www.attrs.org/en/latest/names.html>`_

This feature is at least for one release **provisional**.
We don't *plan* on changing anything, but such a big change is unlikely to go perfectly on the first strike.

The API docs have been mostly updated, but it will be an ongoing effort to change everything to the new APIs.
Please note that we have **not** moved -- or even removed -- anything from ``attr``!

Please do report any bugs or documentation inconsistencies!
6 changes: 2 additions & 4 deletions conftest.py
@@ -1,10 +1,8 @@
from __future__ import absolute_import, division, print_function

import sys

from hypothesis import HealthCheck, settings

from attr._compat import PY310
from attr._compat import PY36, PY310


def pytest_configure(config):
Expand All @@ -16,7 +14,7 @@ def pytest_configure(config):


collect_ignore = []
if sys.version_info[:2] < (3, 6):
if not PY36:
collect_ignore.extend(
[
"tests/test_annotations.py",
Expand Down