Some people have made Li-ion 3.7 V chargers with MCP73831 and LM358n.
The first link mentions that charging such a battery is sensitive to voltage and current:
Li-ion batteries need to be charged following a carefully controlled constant current/constant voltage (CV-CC) pattern that is unique to this cell chemistry. Overcharging and careless handling of a Li-ion cell can cause permanent damage, or instability and potential danger!
Is it possible to charge such a battery with a programmable circuit (Arduino, Adafruit Circuit Playground, Raspberry Pi, etc.) with a voltage divider on the 5 V output, and the current charge controlled by software?
If so, I would like to try it: can you add pointers for circuits, code repositories, or tutorials?