To download wheel dependencies for various offline machines using a machine that has a dicey flakey Internet connection, how can the --python-version, --platform, and --abi be determined?

These docs say:

 * For the Python version, use sysconfig.get_python_version().
 * For the platform, use packaging.tags.platform_tags().

That’s for programmers and it misses abi. What about for end users of python apps? I ran this on an online machine (not the target):

$ pipx install --pip-args='--dry-run' argostranslate

and pretty printed this JSON from the log file:

(run_subprocess:186): stdout:
{  
   "environment"                       : {  
      "implementation_name"            : "cpython",  
      "implementation_version"         : "3.11.2",  
      "os_name"                        : "posix",  
      "platform_machine"               : "x86_64",  
      "platform_python_implementation" : "CPython",  
      "platform_release"               : "6.xx.x-yy-amd64",  
      "platform_system"                : "Linux",  
      "platform_version"               : "#1 SMP Debian …",  
      "python_full_version"            : "3.11.2",  
      "python_version"                 : "3.11",  
      "sys_platform"                   : "linux"  
   },  
   "python_version"                    : "3.11.2",  
   "sys_path"                          : [  
      "/usr/lib/python311.zip",  
      "/usr/lib/python3.11",  
      "/usr/lib/python3.11/lib-dynload",  
      "/root/.local/pipx/venvs/argostranslate/lib/python3.11/site-packages",  
      "/root/.local/pipx/shared/lib/python3.11/site-packages"  
   ]  
}  

A usage example shows --platform linux_x86_64, which suggests I could use this concatination for platform: sys_platform_platform_machine. But examples of python versions from that page are like “27” and “33”, not “3.11.2”. Is it a matter of dropping the dots?

Is there a better way to get this information?

  • IceFoxX@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    3 days ago

    I use pyenv to install/activate different versions. However, I always do this on the target and connected to the internet. I can’t tell you whether and how this works in a local network. Nor can I say whether this is really the case, you’ll just have to see for yourself. Regarding pip, maybe take a look at uv? (I’m still using pip myself, but I’ve only read good things about uv).