I'm pretty experienced with Python for geoprocessing (arcpy) and Enterprise/Online (ArcGIS API for Python), but new to creating GP services. I like to code Python in my IDE for debugging, code hints, etc. As I get started with geoprocessing services, I'm spending my time in Pro and the Idle editor, which is not where I want to develop complex code. Then, we have to share this to a service from our GP history, rather than the actual source code, which seems odd. Esri's docs say we can develop our code by shuttling it back and forth to our IDE via copy/paste, which seems inefficient.
I have some specific questions below, but mostly I'm just looking for best practices and workflows. What's the best way to go from a full dev experience in a good Python IDE (Eclipse/PyDev, VS Code, PyCharm, etc.) to a working GP Service? Tips and tricks, please!!!
Deployment: Esri has a Python sample to publish a GP service. It's not even using the latest .atbx format and publishes to AGS (not Portal), so it seems quite outdated, but might work. Is something like this how to deploy with Python?
Toolbox format: There's the .tbx, .atbx, and .pyt formats. The .pyt format seems the most straightforward to edit, but I just get a 999999 error trying to share to Enterprise (version 10.81). What format do you use?
Code structure: One thing I thought was to make my GP service just a basic shell and then deploy my main application logic separately. I should be able to add my own modules to the PYTHONPATH. I was even able to just drop Python modules into the same folder as my .atbx file on ArcGIS Server and it imported them ok.
Anyhow, these are the ideas bouncing around in my head, and I'm sure there are other issues I haven't run into yet... I'd like to hear from others how they take complex Python code from their IDE to a GP service. Thanks!