pimutils / pimutils/vdirsyncer
Use vdirsyncer as a Python module (from Python code)
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.9k
- Forks
- 185
- Avg merge
- 11h 49m
- Merged PRs (30d)
- 1
Description
Environment
- vdirsyncer==0.10.0
- Python 3.5, 3.6, 3.7
- OS: any
Current Behavior
We're currently running vdirsyncer from Python code via a subshell, e.g.
subprocess.run("yes | vdirsyncer -c vdirsyncer.config discover")
subprocess.run("vdirsyncer -c vdirsyncer.config sync")
This obviously entails some execution overhead from the operating system, which is unnecessary as vdirsyncer is a Python module.
Problem
However, it doesn't seem to be (easily) possible to use vdirsyncer as a Python module from within Python code.
- In
__main__there isapp()being called like this:
from vdirsyncer.cli import app
app()
- The
climodule uses click, which has its own default parameters. - The
discovercommand requires interactively confirming certain actions (that's why we haveyes | ...in our call in the code sample above).
Question
Is there any documented way how to run vdirsyncer from Python code, cleanly? If not yet, what should we change to get this working avoiding major refactoring?
Expected Behavior
We should be able to run vdirsyncer from within Python with code like this, (e.g.)
import vdirsyncer
syncer = vdirsyncer.discover(config='vdirsyncer.config')
syncer.sync(interactive=False)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with vdirsyncer/main.py and the vdirsyncer.cli app entry point, then trace how Click dispatches the discover and sync commands and how discover requests confirmation. Done means documenting or exposing a clean Python-callable path that accepts the configuration and supports non-interactive discovery and synchronization without subprocesses.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100