Bug 243971 - [NEW PORT] www/py-gdown: Download files from google drive
Summary: [NEW PORT] www/py-gdown: Download files from google drive
Status: Closed Overcome By Events
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Daniel Engberg
URL:
Keywords: feature
Depends on:
Blocks:
 
Reported: 2020-02-08 02:52 UTC by Shane
Modified: 2021-10-05 00:59 UTC (History)
3 users (show)

See Also:


Attachments
new port www/py-gdown (1.78 KB, text/plain)
2020-02-08 02:52 UTC, Shane
no flags Details
new port www/py-gdown (2.60 KB, text/plain)
2020-02-09 09:17 UTC, Shane
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Shane 2020-02-08 02:52:11 UTC
Created attachment 211464 [details]
new port www/py-gdown

New port www/py-gdown
python module and cli cmd to download files from google drive.
This handles the "unable to scan" warning on larger files that cause wget/curl to fail.
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2020-02-08 03:14:36 UTC
gdown depends on "requests[socks]" , the "requests" packages extras_require=socks[...] dependency list [1].

When declaring dependencies for packages that declare dependencies on package[extras] form, the port must depend on those dependencies directly [2]

requests[socks] is currently defined in requests setup.py [3] as:

  extras_require { 'socks': ['PySocks>=1.5.6, !=1.5.7'], }

If, in fact, "socks" functionality in gdown is *not* compulsory, but instead OPTIONAL, then gdown should list and declare the socks dependency in extras_require (optional dependencies), not install_requires (compulsory dependencies)

gdown, could for example do:

  install_requires = requests (compulsory base requests functionality)
  extras_require = requests[socks], or directly on pysocks (optional socks support)


[1] gdown:setup.py: install_requires=['filelock', 'requests[socks]', 'six', 'tqdm'],
[2] https://wiki.freebsd.org/Python/PortsPolicy#Transitive_Dependencies
[3] requests:setup.py:extras_requite = { ... , 'socks': ['PySocks>=1.5.6, !=1.5.7'], ... }
Comment 2 Shane 2020-02-09 02:58:19 UTC
I just thought requests[socks] was part of www/py-requests.

py-requests depends on py-urllib3 which optionally depends on py-pysocks, and is on by default.

gdown passes any proxy options to requests through `sess.proxies = {...}` then the call to `sess.get()` is in a try block which catches proxy errors. That should leave a nice failed message if trying to use a proxy with SOCKS disabled/unavailable in py-urllib3.

https://github.com/wkentaro/gdown/blob/master/gdown/download.py#L66

So as gdown doesn't directly rely on or call py-pysocks, does that count as needing to be listed as an optional port dependency? It does mean the projects setup.py could use some adjustment.
Comment 3 Kubilay Kocak freebsd_committer freebsd_triage 2020-02-09 08:44:27 UTC
What other transitive dependencies are is not related in the sense that whatever is declared and configured as dependencies in a setup.py *must be* satisfied, otherwise run time errors will occur (prior to even using/importing that functionality)

If a package fails gracefully if a dependency is not available, whether as an error message ("foo functionality requires installing package: foo"), just continues in the absence of a module, or otherwise fallback to an alternative method, then yes, it is effectively optional (more precisely; not *compulsory*), and should be declared elsewhere (not in install_requires)
Comment 4 Shane 2020-02-09 09:17:09 UTC
Created attachment 211494 [details]
new port www/py-gdown

add patch to move socks from install_requires to extras_require
Comment 5 Daniel Engberg freebsd_committer freebsd_triage 2021-10-04 23:54:06 UTC
Added to repo in bfd638fbb3b3bacc4cc9548ffe8cffbc51d13c27 not using this PR as base

Sorry for the wait

Best regards,
Daniel
Comment 6 Kubilay Kocak freebsd_committer freebsd_triage 2021-10-05 00:59:45 UTC
^Triage: Assign to committer that resolved (OBE)