amplpy icon indicating copy to clipboard operation
amplpy copied to clipboard

Amplpy have type hint suport? (Types Stub)

Open davi-lucciola opened this issue 7 months ago • 3 comments

Hi, I am a beginner with AMPL and I decided to learn amplpy because I have more experience with Python.
I installed the amplpy library following the official guide (https://amplpy.ampl.com/en/latest/getting-started.html) with the "highs" solver and implemented a simple example:

Image

It is working, but I noticed that VS Code (Pylance) is not recognizing the amplpy types correctly. I suppose this is because the "ampl" submodule in "amplpy" is built in C++/Cython. Am I missing something? I am using Python 3.12.

Image

I am not sure if I am doing something wrong, but if not, does amplpy provide an official type stub library for type hints? Or is there another way to get type information from the documentation, etc.?

I know this is not really an issue, but thanks in advance!

davi-lucciola avatar Sep 11 '25 14:09 davi-lucciola

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Oct 12 '25 02:10 github-actions[bot]

Thank you for bringing it up! I am working on adding typehints to amplpy.

jurgen-lentz avatar Oct 13 '25 12:10 jurgen-lentz

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Nov 13 '25 02:11 github-actions[bot]

@davi-lucciola We’ve just released amplpy 0.16.0, which adds full type hints. We would appreciate your feedback and any suggestions you may have.

jurgen-lentz avatar Dec 08 '25 19:12 jurgen-lentz

Thank you @jurgen-lentz! I will take a look

davi-lucciola avatar Dec 08 '25 19:12 davi-lucciola

I will close this issue now. If you have any feedback or encounter any problems with the type hints, please open a new issue @davi-lucciola .

jurgen-lentz avatar Dec 10 '25 13:12 jurgen-lentz