Science Score: 46.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
✓Academic publication links
Links to: zenodo.org -
✓Committers with academic emails
5 of 176 committers (2.8%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (9.9%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
Python Classes Without Boilerplate
Basic Info
- Host: GitHub
- Owner: python-attrs
- License: mit
- Language: Python
- Default Branch: main
- Homepage: https://www.attrs.org/
- Size: 4.08 MB
Statistics
- Stars: 5,598
- Watchers: 60
- Forks: 394
- Open Issues: 137
- Releases: 25
Topics
Metadata Files
README.md
attrs is the Python package that will bring back the joy of writing classes by relieving you from the drudgery of implementing object protocols (aka dunder methods). Trusted by NASA for Mars missions since 2020!
Its main goal is to help you to write concise and correct software without slowing down your code.
Sponsors
attrs would not be possible without our amazing sponsors. Especially those generously supporting us at the The Organization tier and higher:
Please consider joining them to help make attrs’s maintenance more sustainable!
Example
attrs gives you a class decorator and a way to declaratively define the attributes on that class:
```pycon
from attrs import asdict, define, make_class, Factory
@define ... class SomeClass: ... anumber: int = 42 ... listofnumbers: list[int] = Factory(list) ... ... def hardmath(self, anothernumber): ... return self.anumber + sum(self.listofnumbers) * another_number
sc = SomeClass(1, [1, 2, 3]) sc SomeClass(anumber=1, listof_numbers=[1, 2, 3])
sc.hard_math(3) 19 sc == SomeClass(1, [1, 2, 3]) True sc != SomeClass(2, [3, 2, 1]) True
asdict(sc) {'anumber': 1, 'listof_numbers': [1, 2, 3]}
SomeClass() SomeClass(anumber=42, listof_numbers=[])
C = make_class("C", ["a", "b"]) C("foo", "bar") C(a='foo', b='bar') ```
After declaring your attributes, attrs gives you:
- a concise and explicit overview of the class's attributes,
- a nice human-readable
__repr__, - equality-checking methods,
- an initializer,
- and much more,
without writing dull boilerplate code again and again and without runtime performance penalties.
This example uses attrs's modern APIs that have been introduced in version 20.1.0, and the attrs package import name that has been added in version 21.3.0.
The classic APIs (@attr.s, attr.ib, plus their serious-business aliases) and the attr package import name will remain indefinitely.
Check out On The Core API Names for an in-depth explanation!
Hate Type Annotations!?
No problem!
Types are entirely optional with attrs.
Simply assign attrs.field() to the attributes instead of annotating them with types:
```python from attrs import define, field
@define class SomeClass: anumber = field(default=42) listof_numbers = field(factory=list) ```
Data Classes
On the tin, attrs might remind you of dataclasses (and indeed, dataclasses are a descendant of attrs).
In practice it does a lot more and is more flexible.
For instance, it allows you to define special handling of NumPy arrays for equality checks, allows more ways to plug into the initialization process, has a replacement for __init_subclass__, and allows for stepping through the generated methods using a debugger.
For more details, please refer to our comparison page, but generally speaking, we are more likely to commit crimes against nature to make things work that one would expect to work, but that are quite complicated in practice.
Project Information
- Changelog
- Documentation
- PyPI
- Source Code
- Contributing
- Third-party Extensions
- Get Help: use the
python-attrstag on Stack Overflow
attrs for Enterprise
Available as part of the Tidelift Subscription.
The maintainers of attrs and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use.
Owner
- Name: The attrs Cabal
- Login: python-attrs
- Kind: organization
- Website: https://www.attrs.org/
- Repositories: 2
- Profile: https://github.com/python-attrs
Dedicated to empower Python developers to write better code with less effort.
GitHub Events
Total
- Fork event: 31
- Create event: 66
- Commit comment event: 3
- Release event: 4
- Issues event: 68
- Watch event: 325
- Delete event: 59
- Issue comment event: 225
- Push event: 210
- Gollum event: 3
- Pull request review comment event: 39
- Pull request review event: 86
- Pull request event: 113
Last Year
- Fork event: 31
- Create event: 66
- Commit comment event: 3
- Release event: 4
- Issues event: 68
- Watch event: 325
- Delete event: 59
- Issue comment event: 225
- Push event: 210
- Gollum event: 3
- Pull request review comment event: 39
- Pull request review event: 86
- Pull request event: 113
Committers
Last synced: 7 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Hynek Schlawack | hs@o****x | 1,274 |
| Tin Tvrtković | t****r@g****m | 51 |
| pre-commit-ci[bot] | 6****] | 31 |
| David Euresti | d****d@e****m | 18 |
| Sviatoslav Sydorenko | wk@s****a | 14 |
| dependabot[bot] | 4****] | 10 |
| Christopher Armstrong | r****x@t****m | 9 |
| Kyle Altendorf | s****a@f****t | 8 |
| wouter bolsterlee | w****r@b****e | 7 |
| Stefan Scherfke | s****n@s****g | 7 |
| David Cournapeau | c****e@g****m | 7 |
| chrysle | i****t@p****e | 5 |
| Filipe Brandenburger | f****e@h****m | 5 |
| Thomas Grainger | t****n@g****m | 4 |
| Alex Ford | a****d@a****m | 4 |
| Samuel A. Falvo II | s****o@r****m | 4 |
| Ryan Gabbard | g****d@i****u | 4 |
| Glyph | g****h@t****m | 3 |
| John Belmonte | j****n@n****t | 3 |
| Joshua Oreman | o****j@g****m | 3 |
| Tim Gates | t****s@i****m | 3 |
| Denis Laxalde | d****s@l****g | 3 |
| Antonio Botelho | m****t@g****m | 3 |
| Aaron Stephens | a****t | 3 |
| paul fisher | p****r@t****m | 3 |
| Paul Ganssle | p****l@g****o | 3 |
| mikejturner | m****r@a****u | 2 |
| Łukasz Langa | l****z@l****l | 2 |
| Nick Pope | n****k@n****k | 2 |
| Oliver Bestwalter | o****r@b****e | 2 |
| and 146 more... | ||
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 214
- Total pull requests: 322
- Average time to close issues: 6 months
- Average time to close pull requests: 24 days
- Total issue authors: 158
- Total pull request authors: 66
- Average comments per issue: 3.46
- Average comments per pull request: 2.06
- Merged pull requests: 261
- Bot issues: 0
- Bot pull requests: 44
Past Year
- Issues: 39
- Pull requests: 111
- Average time to close issues: 22 days
- Average time to close pull requests: 11 days
- Issue authors: 32
- Pull request authors: 31
- Average comments per issue: 1.85
- Average comments per pull request: 1.1
- Merged pull requests: 77
- Bot issues: 0
- Bot pull requests: 20
Top Authors
Issue Authors
- hynek (14)
- AdrianSosic (11)
- glyph (4)
- redruin1 (4)
- euresti (3)
- Darkdragon84 (3)
- Tinche (3)
- raphCode (2)
- webknjaz (2)
- txemi (2)
- rklasen (2)
- befeleme (2)
- serge-sans-paille (2)
- my1e5 (2)
- ikonst (2)
Pull Request Authors
- hynek (132)
- pre-commit-ci[bot] (31)
- Tinche (16)
- dependabot[bot] (15)
- webknjaz (14)
- filbranden (12)
- dlax (9)
- chrysle (5)
- diabolo-dan (4)
- geofft (4)
- esteevens (4)
- frenzymadness (4)
- sscherfke (4)
- redruin1 (4)
- koenigdavidmj (3)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 3
-
Total downloads:
- pypi 392,796,576 last-month
- Total docker downloads: 7,038,711,185
-
Total dependent packages: 3,093
(may contain duplicates) -
Total dependent repositories: 229,719
(may contain duplicates) - Total versions: 67
- Total maintainers: 1
pypi.org: attrs
Classes Without Boilerplate
- Documentation: https://www.attrs.org/
- License: mit
-
Latest release: 25.3.0
published 12 months ago
Rankings
Maintainers (1)
Funding
- https://github.com/sponsors/hynek
conda-forge.org: attrs
attrs is the Python package that will bring back the joy of writing classes by relieving you from the drudgery of implementing object protocols (aka dunder methods). Its main goal is to help you to write concise and correct software without slowing down your code. For that, it gives you a class decorator and a way to declaratively define the attributes on that class:
- Homepage: https://attrs.readthedocs.io/en/stable/
- License: MIT
-
Latest release: 22.1.0
published over 3 years ago
Rankings
anaconda.org: attrs
attrs is the Python package that will bring back the joy of writing classes by relieving you from the drudgery of implementing object protocols (aka dunder methods). Its main goal is to help you to write concise and correct software without slowing down your code. For that, it gives you a class decorator and a way to declaratively define the attributes on that class:
- Homepage: https://www.attrs.org/
- License: MIT
-
Latest release: 24.3.0
published about 1 year ago
Rankings
Dependencies
- actions/checkout v3 composite
- actions/setup-python v4 composite
- actions/upload-artifact v3 composite
- step-security/harden-runner v2 composite
- actions/checkout v3 composite
- actions/download-artifact v3 composite
- actions/setup-python v4 composite
- actions/upload-artifact v3 composite
- hynek/build-and-inspect-python-package v1 composite
- re-actors/alls-green release/v1 composite
- step-security/harden-runner v2 composite
- actions/checkout v3 composite
- github/codeql-action/analyze v2 composite
- github/codeql-action/init v2 composite
- step-security/harden-runner v2 composite
- actions/checkout v3 composite
- pypa/gh-action-pypi-publish release/v1 composite
- step-security/harden-runner v2 composite
- importlib_metadata python_version<'3.8'