Python YouTrack

https://img.shields.io/pypi/v/pyutrack.svg https://img.shields.io/travis/alisaifee/pyutrack.svg Documentation Status Updates https://codecov.io/gh/alisaifee/pyutrack/branch/master/graph/badge.svg

Command line utility to interface with YouTrack

Command line usage

The cli is invoked using the pyu executable.

Configuration

Before getting started you should configure pyu. This can be done manually by creating an ini file at ~/.pyutrack with the following contents:

[pyutrack]
base_url = https://my.myjetbrains.com/youtrack/
username = myusername
password = mypassword

password is optional and if not provided will be prompted for and subsequently persisted to the system keychain.

You can optionally store the config file in a custom location and on subsequent invocations of the executable provide the --config=${CONFIG_LOCATION} option.

Lastly, you can interactively generate the configuration by calling pyu new config

Quick start

All interaction with YouTrack resources is performed around five main sub-commands: new, update, list, show & delete.

Here’s a few examples to get started. For more details on each sub-command refer to command documentation.

Listing…

Users

pyu list users

Projects

pyu list projects

All Issues in a project

pyu list issues --project=MYPROJECT

Issues filtered with a query (Search Query Reference)

pyu list issues --filter='crash' # issues containing the word "crash"
pyu list issues --filter='for: me' # issues for current user
pyu list issues --filter='reporter: me' # issues reported by current user
pyu list issues --filter='priority: Critical' # critical issues

Creating…

New regular user

pyu new user new_user01 'New User' newuser@moo.com password

New user with specific group(s)

pyu new user new_admin01 'New Admin' newadmin@moo.com password --group=Admin

New issue

pyu new issue MYPROJECT 'this is an important issue'

New issue tagged with kitties and marked as critical and assigned to me (Command Reference)

pyu new issue MYPROJECT 'this is an important issue' --command='tag kitties priority critical assignee me'

Updating…

Change a user’s password

pyu update user some-user --password=new-password

Add a comment to an issue:

pyu update issue PRO-1 --comment='test comment'

Update an issue using a command (Command Reference)

pyu update issue PRO-1 --command='assignee: me' # assign issue to yourself
pyu update issue PRO-1 --command='tag: kitties' # tag the issue with kitties
pyu update issue PRO-1 --command='priority: critical' # increase priority to critical
pyu update issue PRO-1 --command='fixed' # mark issue as fixed

Command documentation

pyu

YouTrack command line interface

pyu [OPTIONS] COMMAND [ARGS]...

Options

--base_url <base_url>

root url of your youtrack installation

--username <username>

username to access youtrack as

--password <password>

password for current user

--debug, --no-debug

enable/disable verbose logging

--watch <watch>

watch the output of the command and run repeatedly every n seconds

delete

delete youtrack resources

pyu delete [OPTIONS] COMMAND [ARGS]...
group
pyu delete group [OPTIONS] NAME

Arguments

NAME

Required argument

issue
pyu delete issue [OPTIONS] ID

Arguments

ID

Required argument

project
pyu delete project [OPTIONS] ID

Arguments

ID

Required argument

user
pyu delete user [OPTIONS] LOGIN

Arguments

LOGIN

Required argument

list

List various youtrack resources

pyu list [OPTIONS] COMMAND [ARGS]...
groups
list groups
[Admin only]
pyu list groups [OPTIONS]

Options

--user <user>

user login

issues

list issues

pyu list issues [OPTIONS]

Options

--project <project>
--filter <filter>
--limit <limit>
permissions
list permissions
[Admin only]
pyu list permissions [OPTIONS]

Options

--role <role>

role name

projects

list projects [Admin only]

pyu list projects [OPTIONS]
roles
list roles
[Admin only]
pyu list roles [OPTIONS]

Options

--group <group>

group name

--user <user>

user login

users
list users
[Admin only]
pyu list users [OPTIONS]

Options

--group <group>

group name

--role <role>

role name

--query <query>

query to match users against

--permission <permission>

permission name

--project <project>

new

create new youtrack resources

pyu new [OPTIONS] COMMAND [ARGS]...
config

generate a new config

pyu new config [OPTIONS]

Options

--force <force>
--path <path>
group

create a new group [Admin only]

pyu new group [OPTIONS] NAME

Options

--description <description>
--auto-join, --no-auto-join

automatically add new users

Arguments

NAME

Required argument

issue

create a new issue

pyu new issue [OPTIONS] PROJECT SUMMARY

Options

--description <description>

issue details

--command <command>

command to run after issue is created

Arguments

PROJECT

Required argument

SUMMARY

Required argument

project

create a new project [Admin only]

pyu new project [OPTIONS] ID NAME

Options

--lead <lead>

Arguments

ID

Required argument

NAME

Required argument

role

create a new role [Admin only]

pyu new role [OPTIONS] NAME

Options

--description <description>
--permission <permission>

permission(s) to give new role

Arguments

NAME

Required argument

user

create a new user [Admin only]

pyu new user [OPTIONS] LOGIN NAME EMAIL PASSWORD

Options

--group <group>

group(s) to add new user to

Arguments

LOGIN

Required argument

NAME

Required argument

EMAIL

Required argument

PASSWORD

Required argument

show

show details for youtrack resources

pyu show [OPTIONS] COMMAND [ARGS]...
config

show current cli configuration

pyu show config [OPTIONS]
group

show group details [Admin only]

pyu show group [OPTIONS] NAME

Arguments

NAME

Required argument

issue

show issue details

pyu show issue [OPTIONS] ID

Arguments

ID

Required argument

project

show project details [Admin only]

pyu show project [OPTIONS] ID

Arguments

ID

Required argument

role

show role details [Admin only]

pyu show role [OPTIONS] NAME

Arguments

NAME

Required argument

user

show user details [Admin only]

pyu show user [OPTIONS] LOGIN

Arguments

LOGIN

Required argument

update

update existing youtrack resources

pyu update [OPTIONS] COMMAND [ARGS]...
group

update a group [Admin only]

pyu update group [OPTIONS] NAME

Arguments

NAME

Required argument

issue

update an issue

pyu update issue [OPTIONS] ID

Options

--summary <summary>
--description <description>
--command <command>

command to apply to issue.

--comment <comment>

comment to add to issue

Arguments

ID

Required argument

role

update a role [Admin only]

pyu update role [OPTIONS] NAME

Options

+permission <add_permissions>

add permission

-permission <remove_permissions>

remove permission

Arguments

NAME

Required argument

user

update a user [Admin only]

pyu update user [OPTIONS] LOGIN

Options

--name <name>
--email <email>
--password <password>
+group <add_groups>

add user to group

-group <remove_groups>

remove user from group

Arguments

LOGIN

Required argument