CLI¶
Create a new project¶
Start a user-interactive CLI to create a new OneCode project.
onecode-create
Example
? Enter the path where to create OneCode project: ~/
? Enter your OneCode project name: HelloWorld
⠋ Creating new OneCode project
✅ Created HelloWorld OneCode project
Extract project parameters¶
usage: onecode-extract [-h] [--all] [--modules [MODULES [MODULES ...]]] [--path PATH]
[--verbose] output_file
Extract OneCode project parameters to JSON file
positional arguments:
output_file Path to the output JSON file
optional arguments:
-h, --help Show this help message and exit
--all Extract parameters with their full info set
--modules [MODULES [MODULES ...]]
Optional list of modules to import first
--path PATH Path to the project root directory if not the current working directory
--verbose Print verbose information when processing files
Example
# extract project parameters from the root folder
onecode-extract params.json
Archive project output data¶
usage: onecode-zip [-h] [--output-file FILE] [--path PATH]
[--data PATH] [--compression INT] [--verbose]
Archive the outputs in a zip file
optional arguments:
-h, --help Show this help message and exit
--output-file FILE Path to the output zip file, defaults to data.zip
--path PATH Path to the project root directory if not the current working directory
--data PATH Path to the data root directory if not the default data directory
--compression INT Compression level from 0 (no compresssion) to 9 (highest compression),
defaults to 6
--verbose Print verbose information when processing files
Example
# archive project output data
onecode-zip
Check project modules¶
usage: onecode-check [-h] [--path PATH]
Check whether all packages are present in the current Python environment
options:
-h, --help show this help message and exit
--path PATH Path to the project root directory if not the current working directory
Example
# modules required by project are in the Python environnement and/or requirements.txt
onecode-check
[INFO] - |OneCode|.check.py:52 - ✅ argparse
[INFO] - |OneCode|.check.py:52 - ✅ importlib
[INFO] - |OneCode|.check.py:52 - ✅ json
[INFO] - |OneCode|.check.py:52 - ✅ onecode (1.1.0)
[INFO] - |OneCode|.check.py:52 - ✅ os
Get project requirements¶
usage: onecode-require [-h] [--path PATH] [--specify-version] output_file
Output guessed required packages into the given requirements txt file
positional arguments:
output_file Path to the output requirements txt file
options:
-h, --help show this help message and exit
--path PATH Path to the project root directory if not the current working directory
--specify-version Specify the version if package is present in the current Python environment
Example
# generate requirements.txt file
onecode-require requirements.txt