I am developing a commerical clock application ("JJClock
"), which is written in Python. What I will deliver to my customers will either be a .pyc
file or a .so
file ("compiled") with Cython -- the fact that a .pyc
is reversible doesn't matter, just that I am not giving my customers the source code.
My clock application has a dedicated "backend" that allows me to use two, alternative "get time" libraries: gplclock
(GPL licensed) and mitclock
(MIT licensed). The core code of JJClock
is completely agnostic to which time library is being used (this is controlled via an environment variable).
For example, here is something that looks like my main
application:
# jjclock.py
import sys
import clock_api
if __name__ == "__main__":
clock = clock_api.get_clock()
time_now = clock.time()
#
# do something propetary with time_now
#
print time_now
# EOF
and here is the implementation of clock_api
:
# clock_api.py
import os
import importlib
class MITClock(object):
def __init__(self):
self.mit_clock = importlib.import_module("mitclock")
def time(self):
return self.mit_clock.getTheTime()
class GPLClock(object):
def __init__(self):
self.gpl_clock = importlib.import_module("gplclock")
def time(self):
#
# IMPORTANT: this API call is different!
# API calls were found via `dir` and the man pages
#
return self.gpl_clock.get_time()
def get_clock():
if os.environ.get("CLOCK", "mit") == "mit":
return MITClock()
elif os.environ["CLOCK"] == "gpl":
return GPLClock()
# EOF
To develop my clock_api
file, I utilised the shared objects for gplclock.so
and mitclock.so
can be obtained via apt-get
with Ubuntu. Furthermore, both gplclock
and mitclock
have publicsed Python API examples, which allowed me to develop both of my clock classes without seeing any of the internal code of either gplclock
or mitclock
.
If we consider developing an application in C, then we need to #include
a header for given library, and therefore it is clear that my commercial object code contains GPL object code (via the #include
), then therefore the GPL applies. However, in the above, there is no "code" from gplclock
in my application -- only the use of its dynamic API, which could be discoverable by interrogating gplclock
via dir
in Python.
Furthermore, my application is 100% functional without gplclock
. It is completely at the discression of the end user to a) obtain gplclock.so
and b) explicitly set the non-default environment variable CLOCK
to be gpl
.
How JJClock
works and runs is completely abstracted from the selected clock -- all of this logic exists inside of the clock_api
(e.g., we might want to implement an add
method between two clocks, and therefore GPLClock
and MITClock
would implement the logic to do this operation). Again, this would be developed by not looking or obtaining the source for either: it can all be done via (e.g.,) dir
in Python, or maybe even the man
pages for both libraries.
It is my understanding that, at the shared object level, there isn't even dynamic linking between JJClock
and gplclock
. There is just a Python call with the string gplclock
and then method invocations are made via getattr
, with string of the method name.
So, my questions are:
Even if
JJClock
's dependancy ongplclock
is optional (and no GPL code exists in my code, beyond API calls found via documentation), does this mean thatgplclock
must be licensed as GPL?There exists an alternative clock API (
pyclock
), which is Apache licensed (???) and supports bothgplclock
andmitclock
-- how does this work? CanJJClock
use this library and remain commercial (without usingclock_api
)? What does it mean forpyclock
to "wrap" the GPL librarygplclock
and provide it under an Apache license?If
JJClock
can usepyclock
, could I releaseclock_api
under MIT, and keepJJClock
as commercial?What would the implications be here if I distributed
JJClock
alongside withgplclock.so
? Does this change anything?
JJClock
"dynamically linking" against "gplclock" (stackoverflow.com/questions/40492518/…)? Doesdlopen
count as "dynamic linking" (stackoverflow.com/questions/21214902/…)?gplclock
's "API" is GPL, what does that mean forpyclock
being Apache licensed? Ispyclock
"licensed incorrectly"?