Python YouTrack¶
Command line utility to interface with YouTrack
- Free software: MIT license
- Documentation: https://pyutrack.readthedocs.io.
Contents¶
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
list¶
List various youtrack resources
pyu list [OPTIONS] COMMAND [ARGS]...
list issues
pyu list issues [OPTIONS]
Options
-
--project
<project>
¶
-
--filter
<filter>
¶
-
--limit
<limit>
¶
- list permissions
- [Admin only]
pyu list permissions [OPTIONS]
Options
-
--role
<role>
¶ role name
new¶
create new youtrack resources
pyu new [OPTIONS] COMMAND [ARGS]...
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
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
create a new project [Admin only]
pyu new project [OPTIONS] ID NAME
Options
-
--lead
<lead>
¶
Arguments
-
ID
¶
Required argument
-
NAME
¶
Required argument
show¶
show details for youtrack resources
pyu show [OPTIONS] COMMAND [ARGS]...
show group details [Admin only]
pyu show group [OPTIONS] NAME
Arguments
-
NAME
¶
Required argument
update¶
update existing youtrack resources
pyu update [OPTIONS] COMMAND [ARGS]...
update a group [Admin only]
pyu update group [OPTIONS] NAME
Arguments
-
NAME
¶
Required argument
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
Installation¶
Stable release¶
To install YouTrack CLI, run this command in your terminal:
$ pip install pyutrack
This is the preferred method to install YouTrack CLI, as it will always install the most recent stable release.
If you don’t have pip installed, this Python installation guide can guide you through the process.
From sources¶
The sources for YouTrack CLI can be downloaded from the Github repo.
You can either clone the public repository:
$ git clone git://github.com/alisaifee/pyutrack
Or download the tarball:
$ curl -OL https://github.com/alisaifee/pyutrack/tarball/master
Once you have a copy of the source, you can install it with:
$ python setup.py install
API¶
The internal API is internal at the moment and - though it can be used for interacting with the YouTrack REST API using an object oriented interface - is not supported.
Connection¶
-
class
pyutrack.connection.
Connection
(base_url=None, credentials=None)[source]¶ -
api_url
¶
-
base_url
¶
-
credentials
¶
-
Resource Types¶
-
class
pyutrack.resources.
Group
(connection, hydrate=False, **fields)[source]¶ -
classmethod
create
(connection, name, auto_join=False, description='')¶ create group
-
delete
()¶ delete group
-
get
()¶ get group
-
get_roles
()¶ get group roles
-
classmethod
list
(connection)¶ list group
-
roles
¶ group roles
-
update
(description, auto_join, new_name)¶ update group
-
classmethod
-
class
pyutrack.resources.
Issue
(connection, hydrate=False, **fields)[source]¶ -
assignee
¶
-
command
(command=None, comment=None)[source]¶ executes a command for the given issue.
Parameters: command (str) – The youtrack command to execute. See https://www.jetbrains.com/help/youtrack/standalone/Commands.html for command grammar.
-
classmethod
create
(connection, project, description='', summary='')¶ create issue
-
delete
()¶ delete issue
-
get
()¶ get issue
-
get_issue_links
()¶ get issue issue_links
-
id
¶
-
issue_links
¶ issue issue_links
-
link
¶
-
classmethod
list
(connection, filter, max=100)¶ list issue
-
priority
¶
-
reporter
¶
-
status
¶
-
update
(description='', summary='')¶ update issue
-
updater
¶
-
-
class
pyutrack.resources.
IssueLinkType
(connection, hydrate=False, **fields)[source]¶ -
classmethod
create
(connection, outward_name, inward_name, directed=False)¶ create issuelinktype
-
delete
()¶ delete issuelinktype
-
get
()¶ get issuelinktype
-
classmethod
list
(connection)¶ list issuelinktype
-
update
(new_name='', inward_name='', directed='', outward_name='')¶ update issuelinktype
-
classmethod
-
class
pyutrack.resources.
Permission
(connection, hydrate=False, **fields)[source]¶ -
classmethod
list
(connection)¶ list permission
-
classmethod
-
class
pyutrack.resources.
Project
(connection, hydrate=False, **fields)[source]¶ -
classmethod
create
(connection, project_name, project_lead_login, project_id=None, description='', starting_number=1)¶ create project
-
delete
()¶ delete project
-
description
¶
-
get
()¶ get project
-
get_issues
(filter='', max=100)¶ get project issues
-
id
¶
-
issues
¶ project issues
-
lead
¶
-
classmethod
list
(connection)¶ list project
-
classmethod
-
class
pyutrack.resources.
Role
(connection, hydrate=False, **fields)[source]¶ -
classmethod
create
(connection, name, description='')¶ create role
-
delete
()¶ delete role
-
get
()¶ get role
-
get_permissions
()¶ get role permissions
-
classmethod
list
(connection)¶ list role
-
permissions
¶ role permissions
-
update
(description, new_name)¶ update role
-
classmethod
-
class
pyutrack.resources.
User
(connection, hydrate=False, **fields)[source]¶ -
classmethod
create
(connection, login, full_name, email, password)¶ create user
-
delete
()¶ delete user
-
get
()¶ get user
-
get_groups
()¶ get user groups
-
get_roles
()¶ get user roles
-
groups
¶ user groups
-
classmethod
list
(connection, project='', query='', role='', group='', permission='')¶ list user
-
roles
¶ user roles
-
update
(login='', password='', full_name='', email='')¶ update user
-
classmethod
Contributing¶
Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.
You can contribute in many ways:
Types of Contributions¶
Report Bugs¶
Report bugs at https://github.com/alisaifee/pyutrack/issues.
If you are reporting a bug, please include:
- Your operating system name and version.
- Any details about your local setup that might be helpful in troubleshooting.
- Detailed steps to reproduce the bug.
Fix Bugs¶
Look through the GitHub issues for bugs. Anything tagged with “bug” and “help wanted” is open to whoever wants to implement it.
Implement Features¶
Look through the GitHub issues for features. Anything tagged with “enhancement” and “help wanted” is open to whoever wants to implement it.
Write Documentation¶
YouTrack CLI could always use more documentation, whether as part of the official YouTrack CLI docs, in docstrings, or even on the web in blog posts, articles, and such.
Submit Feedback¶
The best way to send feedback is to file an issue at https://github.com/alisaifee/pyutrack/issues.
If you are proposing a feature:
- Explain in detail how it would work.
- Keep the scope as narrow as possible, to make it easier to implement.
- Remember that this is a volunteer-driven project, and that contributions are welcome :)
Get Started!¶
Ready to contribute? Here’s how to set up pyutrack for local development.
Fork the pyutrack repo on GitHub.
Clone your fork locally:
$ git clone git@github.com:your_name_here/pyutrack.git
Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:
$ mkvirtualenv pyutrack $ cd pyutrack/ $ pip install -r requirements/test.txt
Create a branch for local development:
$ git checkout -b name-of-your-bugfix-or-feature
Now you can make your changes locally.
When you’re done making changes, check that your changes pass flake8 and the tests:
$ flake8 youtrack_cli tests $ nosetests
Commit your changes and push your branch to GitHub:
$ git add . $ git commit -m "Your detailed description of your changes." $ git push origin name-of-your-bugfix-or-feature
Submit a pull request through the GitHub website.
Pull Request Guidelines¶
Before you submit a pull request, check that it meets these guidelines:
- The pull request should include tests.
- If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.rst.
- The pull request should work for Python 2.6, 2.7, 3.3, 3.4 and 3.5, and for PyPy. Check https://travis-ci.org/alisaifee/pyutrack/pull_requests and make sure that the tests pass for all supported Python versions.
Credits¶
Development Lead¶
- Ali-Akber Saifee <ali@indydevs.org>
Contributors¶
None yet. Why not be the first?
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
list¶
List various youtrack resources
pyu list [OPTIONS] COMMAND [ARGS]...
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
new¶
create new youtrack resources
pyu new [OPTIONS] COMMAND [ARGS]...
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
show¶
show details for youtrack resources
pyu show [OPTIONS] COMMAND [ARGS]...
group¶
show group details [Admin only]
pyu show group [OPTIONS] NAME
Arguments
-
NAME
¶
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