Create animation using Python

I have a circle animated to rotate and a cube that I want to move 1 unit for every degree of circles rotation.
The animation of the circle will change a lot, so I can’t animate the cube by hand every time.

Is it possible to add keyframes for an object using Python ?
And do it for the whole animation by running the code once ?

You could use drivers to accomplish this - drive the location of the cube from the circle’s rotation. Downside is driver’s lag 1 frame behind (unless this has been improved recently), but no one will notice it in an animation.

Or, you could use the transformation constraint. It basically works the same as a driver, but it’s a constraint and doesn’t have the 1 frame lag, but can be confusing to set up. Basically, you add the constraint to the cube, set it’s source to be the circle’s rotation, and the destination is the cube’s location.

If the above mentioned addon will do this easily, then use it.