Run from pyftpsync.yaml¶
Users can define sets of command line options as named tasks and store them in the project folder. It can then be executed like so:
$ pyftpsync run TASK
The file must be named
pyftpsync.yaml and located in the root folder of
pyftpsync run is called, it looks for that file in the current
working directory and its parent folders.
pyftpsync run was called from a subdirectory of the project,
it has to be clarified if the synchronization should be done for the whole
project (i.e. the root folder where pyftpsync.yaml is located), or only for the
current sub branch.
This can be done by passing the
pyftpsync.yaml defines a list of tasks that have a name and a set of
Options are named like the command line arguments, using YAML syntax.
Main sections are
Name of a task that is run when not explicitly specified, i.e. running like
Contains settings that are shared/inherited by all concrete task definitions.
Same syntax as described in
contains one dict per task name
Contains optins that are passed to the CLI command.
Values are inherited from the
common_configsection, but can be overridden here.
Typical values include:
command: COMMAND_NAME(str, mandatory)
Command that should be run with the defined options. Must be one of ‘upload’, ‘dowlnload’, ‘sync’, ‘tree’.
remote: URL(str, mandatory)
Remote target URL and protocol, e.g.
local: REL_PATH(str, default:
.or current folder)
Local target path, relative to the location of the yaml file.
See also root option.
dry_run: FLAG(bool, default:
If true, the task will run in dry-run mode.
A caller can override
dry_run: trueby passing
A caller can override
dry_run: falseby passing
root: FLAG(bool, default: undefined)
pyftpsync runwas called from a subdirectory, it has to be clarified if the synchronization should be done for the whole project (i.e. the root folder where pyftpsync.yaml is located), or only for the current sub branch.
hereis set, the remote target URL is adjusted relative to the depth.|br| When neither
here: trueare set, the command will prompt the user.
here: FLAG(str, default: undefined)
Most availble command line options can also be added, hovever leading
--must be removed and
A task is started like
pyftpsync run TASK, where TASK must be an
existing entry in the yaml file.
pyftpsync run is called without a TASK, it defaults to the
task name defined in
Task settings can be overidden by command line args, for example:
$ pyftpsync run deploy --execute --force -v
would overide task definition entries in the yaml file:
verbose: 4, and
If the credentials are already stored in the keyring or .netrc file, a
pyftpsync run should synchronize the current project without
When SFTP is used, also make sure that the remote host’s public key is stored in ~/.ssh/known_hosts.
1# Configuration for `pyftpsync run ...` command line tool. 2# Edit this file, rename to `pyftpsync.yaml`, and store in the project's root folder. 3# See https://pyftpsync.readthedocs.io/ for details. 4 5#: This task is used by `pyftpsync run` if no task name is passed as argument 6default_task: deploy 7 8#: Default settings inherited by all tasks 9common_config: 10 #: Verbosity (default: 3, use -v/-q to modify from CLI) 11 # verbose: 4 12 #: Show progress 13 progress: true 14 #: Optional relative path to the yaml root (default: .) 15 # local: sync_root 16 #: Remote target protocol and address 17 remote: sftp://example.com/my_project 18 #: Make --dry-run default (pass `--execute` or `--no-dry-run` to override) 19 dry_run: true 20 #: Make --root default (pass `--here` to override) 21 root: true 22 #: Return exit code 10 on skipped files 23 report_problems: true 24 25#: List of task definitions (inherits settings from `common_config`) 26tasks: 27 show: 28 command: tree 29 dry_run: false 30 sort: true 31 files: false # Pass `--files` to override 32 33 sync_all: 34 command: sync 35 36 deploy: 37 command: upload 38 delete: false 39 delete_unmatched: false 40 exclude: build,node_modules,.*,_* 41 42 deploy_force: 43 command: upload 44 # create_folder: true 45 delete: true 46 delete_unmatched: true 47 exclude: build,node_modules,.*,_* 48 force: true 49 resolve: local
For a start, copy
Annotated Sample Configuration,
rename it to
pyftpsync.yaml, and edit it to your needs.