Skip to content

No darkerd HTTP API server similar to blackd #59

Open
@akaihola

Description

@akaihola

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 the darkerd 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 the black and (and optionally isort) 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 maybe click)

Originally posted by @akaihola in #23 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestperformanceSpeed or memory usage improvement

    Projects

    Status

    No status

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions