# MALI Command-Line Tool
## Setup
### Install Dependencies
- Install `virtualenv` which is used to created a sandboxed Python environment for individual project
```bash
pip install virtualenv
```
- Install dependencies
```bash
make dev-requirements # install libraries required for development and testing
```
- If you are using zsh, you might want to install `virtualenvwrapper` plugin which will auto activate the virtual environment when you `cd` to the directory.
### Configure Pycharm
- Open the root directory `<repo-root>` in PyCharm
- Open `Pycharm -> Preferences -> Project Interpreter`.
- Click the Gear Wheel icon on the top right and choose `Add Local`
- Navigate to the virtualenv python executable `<repo-root>/.venv/bin/python`
- Click `Choose`
- In order to run tests in PyCharm, open `Run → Edit Configurations`. Then open `Defaults → Python Test → Unittests`, fill in the parameters:
- Working Directory: `<repo-root>`
## Running
### In terminal
At the project's root directory, run
```bash
pip install --editable .
```
This would install `mali` command and run it with the latest local code. You don't need to reinstall the package after editing code.
### Quick start
You can start running mali by first authenticate yourself.
```bash
mali auth init # authenticate
mali auth whoami # display current authenticated user
mali projects list # list all projects
mali --help # show help page
# Add `--configPrefix staging` option to run against the GAE staging environment
mali --configPrefix staging auth init # you only need to authenticate once
mali --configPrefix staging projects list # list projects on staging
```
### In PyCharm
`mali.py` is the starting point script. In order to run and, more importantly, debug in PyCharm,
- Open `Run → Edit Configurations`.
- Click `+ → Python`, fill in the parameters:
- Name: "Any thing you like, preferably the command you're testing e.g. `mali auth init`"
- Script: `<repo-root>/mali.py`
- Params: `--configPrefix staging auth init` (The options and arguments you would type in after `mali` in terminal)
- Working directory: `<repo-root>`
- Click OK
- Press the Run/Debug icon.
The above is equivalent to running the following command in the terminal.
```bash
mali --configPrefix staging auth init
```
## Linting
We use [pycodestyle](https://pycodestyle.readthedocs.io/en/latest/index.html) for linting. If you haven't, please read the [PEP 8 style guide for Python](https://www.python.org/dev/peps/pep-0008/#introduction).
Quick notes:
- We are not dogmatic regarding line width (E501 is ignored) but be reasonable!
- To disable the linter for a specific line, postfix the line with `# nopep8`. For example,
```python
import os # nopep8
```
### In terminal
To lint, run the following command
```bash
make lint
```
### In PyCharm
PyCharm supports code style and inspections using PEP 8 so you can reformat by selecting `Code > Reformat Code` (or `Alt + Cmd + L`) for a specific file or a directory.
Please note that PyCharm enforces line width by default so you might want to disable that.
## Tests
### In terminal
```bash
make test # run tests under `tests` directory
```
To run tests under `tests_caffe` directory, we need to first install Docker in order to run Caffe library. Please follow instructions [here](https://docs.docker.com/docker-for-mac/install/).
```bash
make test-caffe # run tests under `tests_caffe` directory
make test-all # run all the tests
```
### In PyCharm
Right click on the test file (e.g. `test_auth.py`), the test class (e.g. `TestAuth`) or simply a single test method (e.g. `test_init_auth`), and click `Run 'Unnittests ...'` in the dropdown menu.
没有合适的资源?快使用搜索试试~ 我知道了~
PyPI 官网下载 | mali-0.2467.tar.gz
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 76 浏览量
2022-01-13
02:19:59
上传
评论
收藏 203KB GZ 举报
温馨提示
共150个文件
py:141个
txt:5个
pkg-info:2个
资源来自pypi官网。 资源全名:mali-0.2467.tar.gz
资源推荐
资源详情
资源评论
收起资源包目录
PyPI 官网下载 | mali-0.2467.tar.gz (150个子文件)
setup.cfg 133B
README.md 4KB
PKG-INFO 583B
PKG-INFO 583B
pack.py 65KB
client.py 51KB
objects.py 44KB
repo.py 42KB
server.py 39KB
object_store.py 37KB
porcelain.py 37KB
refs.py 26KB
bigquery_metadata_db.py 23KB
diff_tree.py 22KB
data.py 20KB
index.py 20KB
web.py 17KB
test_experiments.py 17KB
protocol.py 16KB
walk.py 16KB
test_backend_gcs_object_storage.py 15KB
config.py 14KB
lru_cache.py 14KB
test_data_management.py 14KB
test_sql.py 12KB
utils.py 11KB
patch.py 11KB
ignore.py 10KB
gcs_object_store.py 10KB
scam_parser.py 10KB
experiments.py 9KB
fastexport.py 9KB
tree.py 8KB
bigquery_db_index.py 8KB
repo.py 8KB
check.py 8KB
test_runcode.py 8KB
commons.py 8KB
base.py 7KB
sqlite_metadata_db.py 7KB
mysql_metadata_db.py 6KB
file.py 6KB
parser.py 6KB
base_metadata_db.py 6KB
config.py 5KB
bq.py 5KB
test_repo.py 5KB
test_project.py 5KB
pretty.py 5KB
errors.py 5KB
hooks.py 5KB
greenthreads.py 5KB
objectspec.py 5KB
bigquery_mixin.py 5KB
parsetab.py 4KB
models.py 4KB
gae_datastore_tree_cache.py 4KB
test_data.py 4KB
archive.py 4KB
tree_cache.py 4KB
pip_util.py 4KB
mysql_ref_container.py 4KB
mali.py 3KB
code.py 3KB
backend_metadata.py 3KB
backend_gcs_object_store.py 3KB
options.py 3KB
data_volume_config.py 3KB
gae_datastore_ref_container.py 3KB
datastore_ref_container.py 3KB
multi_process_control.py 3KB
test_auth.py 3KB
log_utils.py 3KB
reflog.py 2KB
projects.py 2KB
base.py 2KB
base_connection.py 2KB
test_metadata.py 2KB
__init__.py 2KB
sqlite_tree_cache.py 2KB
test_orgs.py 2KB
sqlite_db_index.py 2KB
datastore_tree_cache.py 2KB
backend_ref_container.py 2KB
sqlite.py 2KB
source_tracking.py 2KB
mysql_db_index.py 2KB
rsync.py 2KB
backend_db_index.py 2KB
test_tree_cache.py 2KB
test_models_tensorflow.py 1KB
auth.py 1KB
orgs.py 1KB
gae_datastore_mixin.py 1KB
__init__.py 1KB
spanner.py 1KB
base_db_index.py 1KB
spanner_db_index.py 1KB
setup.py 1KB
tests_models.py 1013B
共 150 条
- 1
- 2
资源评论
挣扎的蓝藻
- 粉丝: 13w+
- 资源: 15万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功