How to share code without making visible

How to share code for others to use without making it visible to them (encapsulate?)? That is, those who use the code can’t see how the code is written at all.

Sharing code without seeing code sounds contradictory. You could build an application or web service if you want users to use your model without understanding what’s under the hood.

Anyone knows how to encapsulate into a .pyd, which seems to do the job?