Open
Description
A darkerd
daemon should import and call Black in-process.
In the comment below from #23, this approach is compared to a darkerd
-> blackd
solution:
Let's consider a darkerd
daemon which makes HTTP API calls to a separate blackd
daemon. That would mean
- two processes running,
- added code complexity in
darkerd
, and - probably no performance benefits (compared to calling the
black
Python API directly in thedarkerd
process).
So the performance benefit would be achieved by just
- creating a
darkerd
, - making it call the
darker
Python API, and - letting
darker
in turn call theblack
and (and optionallyisort
) Python APIs internally.
Compared to blackd
, it's important to consider that it's not possible to pass only source code in the HTTP request. darker
needs to have access to the unmodified version of each file in Git HEAD
. Do do this,
- the HTTP request to
darkerd
must point to actual files on disk (either Git root dir + set of relative paths, or just a set of absolute paths) - the
darkerd
process must have access to the filesystem, so in practice run in the same machine as the caller (i.e. the IDE)
If we were to implement darkerd
, I would
- mirror the implementation of
blackd
(it's under 200 lines of code) - use the same libraries (
aiohttp
,aiohttp-cors
and maybeclick
)
Originally posted by @akaihola in #23 (comment)
Metadata
Metadata
Assignees
Projects
Status
No status