Skip to content
This repository was archived by the owner on Aug 25, 2024. It is now read-only.

Commit f27dc41

Browse files
John Andersenpdxjohnny
authored andcommitted
service: dev: install: Speed up install of plugins
Signed-off-by: John Andersen <[email protected]>
1 parent 6f924c3 commit f27dc41

File tree

2 files changed

+26
-11
lines changed

2 files changed

+26
-11
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616
for each class based off of the CONFIG property of that class. The CONFIG
1717
property is a class which has been decorated with dffml.base.config to make it
1818
a dataclass.
19+
- Speed up development service install of all plugins in development mode
1920
### Fixed
2021
- DataFlows with multiple possibilities for a source for an input, now correctly
2122
look through all possible sources instead of just the first one.

dffml/service/dev.py

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -427,25 +427,39 @@ class Install(CMD):
427427
Uninstall production packages and install dffml in development mode.
428428
"""
429429

430+
arg_user = Arg(
431+
"-user", "Preform user install", default=True, action="store_false"
432+
)
433+
430434
async def run(self):
431435
main_package = is_develop("dffml")
432436
if not main_package:
433437
raise NotImplementedError(
434438
"Currenty you need to have at least the main package already installed in development mode."
435439
)
436440
# Packages fail to install if we run pip processes in parallel
437-
for package in CORE_PLUGINS:
438-
package = Path(*main_package.parts, *package)
439-
self.logger.info("Installing %s in development mode", package)
440-
proc = await asyncio.create_subprocess_exec(
441-
sys.executable,
442-
"-m",
443-
"pip",
444-
"install",
445-
"-e",
446-
str(package.absolute()),
441+
packages = list(
442+
map(
443+
lambda package: Path(*main_package.parts, *package),
444+
CORE_PLUGINS,
447445
)
448-
await proc.wait()
446+
)
447+
self.logger.info("Installing %r in development mode", packages)
448+
cmd = [
449+
sys.executable,
450+
"-m",
451+
"pip",
452+
"install",
453+
]
454+
if self.user:
455+
# --user sometimes fails
456+
local_path = Path("~", ".local").expanduser().absolute()
457+
cmd.append(f"--prefix={local_path}")
458+
for package in packages:
459+
cmd += ["-e", str(package.absolute())]
460+
self.logger.debug("Running: %s", " ".join(cmd))
461+
proc = await asyncio.create_subprocess_exec(*cmd)
462+
await proc.wait()
449463

450464

451465
class Develop(CMD):

0 commit comments

Comments
 (0)