|
3 | 3 | `ducktools-classbuilder` is both an alternate implementation of the dataclasses concept |
4 | 4 | along with a toolkit for creating your own customised implementation. |
5 | 5 |
|
| 6 | +Available from PyPI as [ducktools-classbuilder](https://pypi.org/project/ducktools-classbuilder/). |
| 7 | + |
| 8 | +Installation[^1]: |
| 9 | + * With [uv](https://docs.astral.sh/uv/) |
| 10 | + * `uv add ducktools-classbuilder` to add to an existing project |
| 11 | + * `uv add ducktools-classbuilder --script scriptname.py` to add to |
| 12 | + [script dependencies](https://packaging.python.org/en/latest/specifications/inline-script-metadata/#inline-script-metadata) |
| 13 | + * `uv run --with ducktools-classbuilder python` to try in the Python repl |
| 14 | + * With [poetry](https://python-poetry.org) |
| 15 | + * `poetry add ducktools-classbuilder` to add to an existing project |
| 16 | + |
6 | 17 | Create classes using type annotations: |
7 | 18 |
|
8 | 19 | ```python |
@@ -327,7 +338,7 @@ There are also some intentionally missing features: |
327 | 338 | If you want to use `__slots__` in order to save memory you have to declare |
328 | 339 | them when the class is originally created as you can't add them later. |
329 | 340 |
|
330 | | -When you use `@dataclass(slots=True)`[^1] with `dataclasses`, the function |
| 341 | +When you use `@dataclass(slots=True)`[^2] with `dataclasses`, the function |
331 | 342 | has to make a new class and attempt to copy over everything from the original. |
332 | 343 |
|
333 | 344 | This is because decorators operate on classes *after they have been created* |
@@ -470,4 +481,7 @@ with a specific feature, you can create or add it yourself. |
470 | 481 |
|
471 | 482 | Heavily inspired by [David Beazley's Cluegen](https://github.com/dabeaz/cluegen) |
472 | 483 |
|
473 | | -[^1]: or `@attrs.define`. |
| 484 | +[^1]: I'd like to discourage people from directly using `pip install ducktools-classbuilder`. |
| 485 | + I feel like it encourages the bad practice of installing packages into the main runtime folder instead of a virtualenv. |
| 486 | + |
| 487 | +[^2]: or `@attrs.define`. |
0 commit comments