Skip to main content

GitHub PyPI version PyPI pyversions GitHub Workflow Status codecov

YouTrack Python CLI

Installation

❯ pip install youtrack-python-cli
# OR, if you use virtualenvs or conda envs in your working repo, use pipx:
❯ pipx install youtrack-python-cli

Configuration

The script needs a YouTrack URL to target API requests, and a token for auth.

3 configuration methods:

  1. set into current repo's git config:

    ❯ git config youtrack.token "$YOUTRACK_TOKEN"
    ❯ git config youtrack.url https://your-youtrack-server/api
    
  2. set via environment variables, YOUTRACK_URL and YOUTRACK_TOKEN

  3. set via command line parameters, --url and --token

Usage

As git pre-push hook

See the pre-push example, which can be copied directly into .git/hooks/pre-push. That example checks the commit title for the YouTrack ticket ID as the first item, for example EXAMPLE-1234 some commit title.

Running standalone

❯ youtrack-cli --url "https://your-youtrack-server/api" --token $YOUTRACK_TOKEN get --confirm-prompt --ticket example-1234
                                                  Issue data for example-1234
┏━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃           Key ┃ Value                                                                                                     ┃
┡━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│    idReadable │ EXAMPLE-9377                                                                                              │
├───────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│       summary │ Test ticket title                                                                                         │
├───────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ assignee_name │ Jane Doe                                                                                                  │
├───────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ reporter_name │ jane                                                                                                      │
├───────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│   description │ Long description, truncated to max of 1024 characters                                                     │
├───────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│           url │ https://your-youtrack-server/issue/EXAMPLE-1234                                                           │
└───────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Type the ticket id to confirm: example-1234

Development

Releasing

Manual (TODO this should happen via tag push automatically!). Steps are:

# 1. bump version, eg just the patch:
❯ poetry version patch
Bumping version from 0.1.1 to 0.1.2
# 2. store version for remaining commands
❯ _VER=$(poetry version --short)
# 3. Save version bump
❯ git add . && git commit -m "Bump version to ${_VER}"
# 4. Create annotated tag
❯ git tag -a {-m=,}${_VER}
# 5. Push
❯ git push && git push --tags
# 6. Build pypi release artifacts
❯ rm -rf dist && poetry build
# 7. Publish
❯ poetry publish --username=__token__ --password=$(<~/.noahp-pypi-pw)
# 8. Github release stuff
❯ gh release create --generate-notes ${_VER}
❯ gh release upload ${_VER} dist/*

And all-in-one for copy paste:

poetry version patch \
  && _VER=$(poetry version --short) \
  && git add . \
  && git commit -m "Bump version to ${_VER}" \
  && git tag -a {-m=,}${_VER} \
  && git push && git push --tags \
  && rm -rf dist && poetry build \
  && poetry publish --username=__token__ --password=$(<~/.noahp-pypi-pw) \
  && gh release create --generate-notes ${_VER} \
  && gh release upload ${_VER} dist/*

Metadata

Release files for youtrack-python-cli 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for youtrack-python-cli 0.2.0
File Size Uploaded
youtrack_python_cli-0.2.0.tar.gz 5.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for youtrack-python-cli 0.2.0
File Interpreter ABI Platform
youtrack_python_cli-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.1 kB

Release files / youtrack_python_cli-0.2.0.tar.gz

Download URL youtrack_python_cli-0.2.0.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
64af4e0ed863ffb201d6d73185931a33ae51e281c4f37c52582e9f4245501096
BLAKE2b-256 checksum
How to use checksums
5d0869c11a8d1ab145048e7944453fa1e13e3d8b20c8e8acef977d6d7a3694eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.11.6 Linux/6.5.0-14-generic

Release files / youtrack_python_cli-0.2.0-py3-none-any.whl

Download URL youtrack_python_cli-0.2.0-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0c5c46d575d06c819dafd6cca391a3285d367bfb3e73998916054e5f886e8f1e
BLAKE2b-256 checksum
How to use checksums
13691657a6f21b0d62f38b1773066174092a6aba5f4ffebadc8de19701b20902
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.11.6 Linux/6.5.0-14-generic

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page