Inject custom cost function for linear regression
I suspect there is no a readily available module that suits your needs.
If I were you I would:

partition the features into 2 groups: one for simple linear regression and another one for regularized regression. Train two models on two different (maybe overlapping?) sets of features. When you cross-validate your models, to prevent information leakage between folds, I'd suggest fixing folds and training both models on the same fixed set of folds.
On top, stack and train any other regression model.
I want to run a lasso or ridge regression, but where the L1 or L2 constraint on the coefficients is on some of the coefficients, not all.
Another way to say it: I would like to use my own custom cost function inside the lasso or ridge algorithm.
I would like to avoid having to rewrite the whole algorithm. Is there a module in python that allows this? I looked into scipy and sckit-learn so far, but could not find that.