Is there a way to load "ac" library to have autocomplete in an IDE (e.g. PyCharm)?

Discussion in 'Apps' started by FitbyBit, Mar 18, 2023.

  1. FitbyBit

    FitbyBit New Member

    Joined:
    Jan 10, 2022
    Messages:
    10
    Likes Received:
    4
    I would like to have autocomplete in PyCharm python IDE.
    Now I have following:
    upload_2023-3-18_19-23-27.png

    Is it possible to load AC Python libs or stub libs?
     
  2. fughettaboutit

    fughettaboutit aka leBluem

    Joined:
    Jul 21, 2014
    Messages:
    1,117
    Likes Received:
    379
    nobody has done a dummy ac.py from the docs yet :(

    and pythons "inspect" module cant read stuff from c functions
     
  3. FitbyBit

    FitbyBit New Member

    Joined:
    Jan 10, 2022
    Messages:
    10
    Likes Received:
    4
    Thanks for your answer, mate.
    Yeah, that's a shame =)
    Probably it is worth to start a GitHub repo for this. :)
    But who is the owner of this document?
    It would be easier to fetch some raw text if he has it yet.

    ...nevermind. =)
    I figured out the PDF contains the update from you + original document :)
     
    Last edited: Mar 20, 2023
  4. FitbyBit

    FitbyBit New Member

    Joined:
    Jan 10, 2022
    Messages:
    10
    Likes Received:
    4
    DEPRECATED. See ac-stubs package below.


    Added the package...
    https://pypi.org/project/AcDummyLib/

    Code:
    ✓ $ /d/prog/python37/python -m virtualenv venv
    created virtual environment CPython3.7.9.final.0-64
    [...]
    ✓ $ python --version
    Python 3.7.9
    ✓ $ venv/Scripts/pip install AcDummyLib
    Collecting AcDummyLib
      Downloading AcDummyLib-0.1.0-py3-none-any.whl (9.4 kB)
    Installing collected packages: AcDummyLib
    Successfully installed AcDummyLib-0.1.0
    
    In the code for proper autocomplete we need add

    Code:
    from AcDummyLib import ac
    and comment:
    Code:
    # import ac
    On code test/publish, this change must be reverted.

    If someone knows how to avoid this, please mention it.
     
    Last edited: Mar 21, 2023
    fughettaboutit likes this.
  5. fughettaboutit

    fughettaboutit aka leBluem

    Joined:
    Jul 21, 2014
    Messages:
    1,117
    Likes Received:
    379
    Ah nice! This should do the trick without doing manual labor for switching
    # put this in your app:
    Code:
    if __name__ == '__main__':
        ### with python installed, run this on console:
        # pip install ac-stubs
        ### ---in editor use the stub
        from AcDummyLib import ac
    else:
        ### ---in ac just use this
        import ac
    
     
    Last edited: Apr 26, 2023
    FitbyBit likes this.
  6. fughettaboutit

    fughettaboutit aka leBluem

    Joined:
    Jul 21, 2014
    Messages:
    1,117
    Likes Received:
    379
    you missed this in the pdf :)
    upload_2023-3-20_12-4-7.png
     
    FitbyBit likes this.
  7. FitbyBit

    FitbyBit New Member

    Joined:
    Jan 10, 2022
    Messages:
    10
    Likes Received:
    4
    Yes, good point, thanks. I grabbed all functions, just programmatically. Pushed ChatGPT to make the script :D

    Do you mean I need to paste the trick into this file?
     
  8. fughettaboutit

    fughettaboutit aka leBluem

    Joined:
    Jul 21, 2014
    Messages:
    1,117
    Likes Received:
    379
    no that goes into your app, autocomplete will work then
     
    Last edited: Mar 21, 2023
  9. FitbyBit

    FitbyBit New Member

    Joined:
    Jan 10, 2022
    Messages:
    10
    Likes Received:
    4
    Now it is possible to have normal autocomplete for `import ac`.
    There is a new package: ac-stubs

    Installation:
    pip install ac-stubs

    In action:
    upload_2023-3-21_1-33-20.png

    Git repo: https://github.com/rikby/ac-stubs/
     

    Attached Files:

    luchian and fughettaboutit like this.
: mod, python, libs
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice