コマンドラインツールによるGakuNin RDMの一括処理機能
Let using the supported Python versions. Refer to https://devguide.python.org/versions/
Recommend using the latest stable Python version (Python 3.11.3 - April 5, 2023).
* Note that Python 3.9+ cannot be used on Windows 7 or earlier.
You need to provide your credentials as Personal Access Token (PAT),
by setting the OSF_TOKEN environment variable.
You also need to provide the server URL, by setting the OSF_API_URL environment variable.
You can set default values for the token and the server URL
by using a configuration file in the current directory.
Create .grdmcli.config and set
[default]
osf_token = <Your Personal Access Token>
osf_api_url = http://localhost:8000/v2/
From all publicly documented scopes, please select:
osf.full_write: View and edit all information associated with this account, including for private projects.
-
If you are using a self-signed SSL certificate (e.g., Testing), please skip the verification of the SSL server certificate using the following configuration.
In.grdmcli.config, you can overwrite it by:ssl_cert_verify = falseOr disable by an optional argument
--disable_ssl_verifyin command line. -
debugandverboseis setFalsein theconstants.pyDEBUG = False VERBOSE = FalseIn
.grdmcli.config, you can overwrite them by:debug = true verbose = trueOr enable by optional arguments
--debugand--verbosein command line
Change directory to the root of the project directory and run:
python -m pip install .. refers to the current working directory
Or install via specific branch
python -m pip install git+https://github.com/RCOSDP/RDM-cli.git@feature/202303-cli/4.2.cli_add_memberThe following functions are possible
- Create new projects
- Create new components for each specific project
- Create new projects from an available template
- Create new components from an available template (don't support on the website UI)
- Creates a fork of an available project
- Link an available other projects to each specific project
- Override the project information
- Override the component information
The impossible ones:
- Update attributes for available projects
* Notice about the order of creating a project/component:
- Create project (includes
category,title,description,public,tags) - Add license (as
node_license) - Create components for the created project
- Link to other projects (as
project_links)
* Notice about forking from a project/component:
When forking, the following information will be changed: title.
The other properties will be ignored: category, description, public, tags, node_license.
* Notice about override project/component:
If id is entered in input project information, the other properties: id, fork_id, template_from will be overwritten.
If id and fork_id is entered in the input project information, the error message: "Project could not created" is shown.
If id of the project does not exist or does not belong to the currently logged in user entered in the input project information, the error message: "Project could not created" is shown.
If id of the component is entered in the input project information, the component information will be overwritten and the project's existing components will not be deleted.
The output information only contains information for newly created or overwritten projects or components.
Get help and see available commands, get help on a specific command
grdmcli --help
grdmcli projects --help
grdmcli projects create --helpExample for projects/components creation function
$ grdmcli projects create --help
usage: grdmcli projects create [-h]
--template TEMPLATE
[--output_result_file OUTPUT_RESULT_FILE]
[--osf_token OSF_TOKEN]
[--osf_api_url OSF_API_URL]
[--disable_ssl_verify]
[--debug]
[--verbose]
projects create command
options:
-h, --help show this help message and exit
--template TEMPLATE The template file for projects/components
--output_result_file OUTPUT_RESULT_FILE
The output result file path
--osf_token OSF_TOKEN
The Personal Access Token
--osf_api_url OSF_API_URL
The API URL
--disable_ssl_verify Disable SSL verification
--debug Enable Debug mode
--verbose Enable Verbose mode
Refer to docs/Template_file_design.xlsx for template file design.
Refer to docs/sample for template sample.
The following functions are possible:
- Overwrite the project's contributor list
* Notice about the order of registration/overwrite contributors of a project/component:
- Clear available contributors from the project. Except the current user. This member is project admin.
- Add new contributors list. Except the current user
* Notice about creating a contoributor:
- When the command is executed, it first deletes all contributors and then inserts the user according to the template.
- The "currently logged-in user" will keep its role as ProjectAdmin, and other attributes will not change.(No Delete/Create/Update)
Get help and see available commands, get help on a specific command
grdmcli --help
grdmcli contributors --help
grdmcli contributors create --helpExample for contributors registration/overwrite function
$ grdmcli contributors create --help
usage: grdmcli contributors create [-h]
--template TEMPLATE
[--output_result_file OUTPUT_RESULT_FILE]
[--osf_token OSF_TOKEN]
[--osf_api_url OSF_API_URL]
[--disable_ssl_verify]
[--debug]
[--verbose]
contributors create command
options:
-h, --help show this help message and exit
--template TEMPLATE The template file for contributors
--output_result_file OUTPUT_RESULT_FILE
The output result file path
--osf_token OSF_TOKEN
The Personal Access Token
--osf_api_url OSF_API_URL
The API URL
--disable_ssl_verify Disable SSL verification
--debug Enable Debug mode
--verbose Enable Verbose mode
Refer to docs/Template_file_design.xlsx for template file design.
Refer to docs/sample for template sample.
The following functions are possible:
- Get the project list belonging to the currently logged-in user .
* Notice about getting the project list:
- Get all projects belonging to the user, output information includes: the project name and GUID, no component information.
Get help and see available commands, get help on a specific command
grdmcli --help
grdmcli projects --help
grdmcli projects list --helpExample for getting user's project list function
$ grdmcli projects list --help
usage: grdmcli projects list [-h]
[--output_result_file OUTPUT_RESULT_FILE]
[--display_console]
[--osf_token OSF_TOKEN]
[--osf_api_url OSF_API_URL]
[--disable_ssl_verify]
[--debug]
[--verbose]
projects list command
options:
-h, --help show this help message and exit
--output_result_file OUTPUT_RESULT_FILE
The output result file path
--display_console Output result to console screen
--osf_token OSF_TOKEN
The Personal Access Token
--osf_api_url OSF_API_URL
The API URL
--disable_ssl_verify Disable SSL verification
--debug Enable Debug mode
--verbose Enable Verbose mode
The following functions are possible:
- Get the all project/components and contributors information of user
* Notice About input information
- If project_id is not specified, information of all projects/components and contributors of the user will be gotten
- If project_id is specified, only project/component and contributor information of the specified project will be gotten
* Notice About output information
- The output will be 2 Json files and can be input for "grdmcli projects create" and "grdmcli contributors create" commands.
- Can output information of more than 1000 projects and 1000 contributors
Get help and see available commands, get help on a specific command
grdmcli --help
grdmcli projects --help
grdmcli projects get --helpExample for projects get function
$ grdmcli projects get --help
usage: grdmcli projects get [-h]
[--project_id PROJECT_ID [PROJECT_ID ...]]
[--output_projects_file OUTPUT_PROJECTS_FILE]
[--output_contributors_file OUTPUT_CONTRIBUTORS_FILE]
[--osf_token OSF_TOKEN]
[--osf_api_url OSF_API_URL]
[--disable_ssl_verify]
[--debug]
[--verbose]
projects get command
options:
-h, --help show this help message and exit
--project_id PROJECT_ID [PROJECT_ID ...]
List id of project that user want to get information
--output_projects_file OUTPUT_PROJECTS_FILE
The output projects file path
--output_contributors_file OUTPUT_CONTRIBUTORS_FILE
The output contributors file path
--osf_token OSF_TOKEN
The Personal Access Token
--osf_api_url OSF_API_URL
The API URL
--disable_ssl_verify Disable SSL verification
--debug Enable Debug mode
--verbose Enable Verbose mode
- To run test code in the
testmodule,
Ensure the following packages inrequirements.txtare installed:
# for testing
pytest==7.3.1
pytest-cov==4.0.0
-
Run TC
coverage run -m --source=./ pytest ./tests/
Run
pytestmodule with all test cases under./tests/directory and measure on./all directories of code -
Create an HTML report,
htmlcovfolder will be exportedcoverage html
-
Show report coverage stats on modules.
coverage report -m
Change directory to the root of the project directory and run:
python -m pip install -e .The pip command-line flag -e is short for --editable,
and . refers to the current working directory,
so together, it means to install the current directory (i.e. your project) in editable mode.