Manage multiple virtual environments with pew

IMO pew is better than virtualenvwrapper because it doesn’t depend on the activate/deactivate scripts inside each virtual environment. When activating a virtualenv with pew, instead of sourcing it into the existing shell process, it launches a sub-shell, thus providing better isolation. https://github.com/berdario/pew Prefer Subshells for context

November 3, 2022 · Fernando Costa Bertoldi

Pytest flags for shorter output

TIL: pytest –tb=short –disable-warnings –no-cov

September 14, 2022 · Fernando Costa Bertoldi

Django custom constructor/factory

TIL: to add a custom constructor to a Django model, use a custom manager method: https://docs.djangoproject.com/en/3.2/ref/models/instances/#django.db.models.Model class BookManager(models.Manager): def create_book(self, title): book = self.create(title=title) # do something with the book return book class Book(models.Model): title = models.CharField(max_length=100) objects = BookManager() book = Book.objects.create_book("Pride and Prejudice")

June 3, 2022 · Fernando Costa Bertoldi