I am looking for some Python library similar to Java's Lombok. I found puffadder 0.1, from 2016, but now that I tried to install it with pip, it does not work.
Links:
Shell output:
$ pip3 install puffadder
Collecting puffadder
Could not find a version that satisfies the requirement puffadder (from versions: )
No matching distribution found for puffadder
$ pip --version
pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 2.7)
$ pip3 --version
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)
$ pip3 install puffadder==0.1
Collecting puffadder==0.1
Could not find a version that satisfies the requirement puffadder==0.1 (from versions: )
No matching distribution found for puffadder==0.1
$ pip install puffadder==0.1
Collecting puffadder==0.1
Could not find a version that satisfies the requirement puffadder==0.1 (from versions: )
No matching distribution found for puffadder==0.1
$ sudo lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.3 LTS
Release: 18.04
Codename: bionic
So, is it not compatible anymore with modern versions of Python? Why is not in pip anymore, was it discontinued, or just lack of integration in pip (so, I could maybe clone it from GitHub).
Also, does someone know some supported alternative, apart from using @property?
Python 3.7 added dataclasses Which reminds me of the Lombok in Java. It generates _init_, _repr_ and some more.
from dataclasses import dataclass
@dataclass()
class Name:
first_name: str
last_name: str
yoni = Name("Yoni", "Alaluf")
yoni2 = Name("Jony", "Alaluf")
print(yoni) # Name(first_name='Yoni', last_name='Alaluf')
print(yoni2) # Name(first_name='Jony', last_name='Alaluf')
print(yoni == yoni2) # False