Basic Youtrack CLI in python
Project description
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:
-
set into current repo's git config:
❯ git config youtrack.token "$YOUTRACK_TOKEN" ❯ git config youtrack.url https://your-youtrack-server/api
-
set via environment variables,
YOUTRACK_URL
andYOUTRACK_TOKEN
-
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. 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 build && poetry build
# 7. Publish
❯ poetry publish --username=__token__ --password=$(<~/.noahp-pypi-pw)
# 8. Github release stuff
❯ gh release create --generate-notes ${_VER}
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 build && poetry build \
&& poetry publish --username=__token__ --password=$(<~/.noahp-pypi-pw) \
&& gh release create --generate-notes ${_VER}
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for youtrack_python_cli-0.1.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a9a6abc8facdf91afe8238558d0bea28e0f791708798bdae0df8144fd3b2e24 |
|
MD5 | 9b0c2a1bb9284a18c065a1c4fd1ad98f |
|
BLAKE2b-256 | 6acda8585dba670a53765c739f3a631634127659dc660bbeca82cfb153922fcd |
Close
Hashes for youtrack_python_cli-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3842299d1a54d078b03419e4e02cf1f88eddffb3eebe984222aceae38f1c79f0 |
|
MD5 | eb36d5290963d6e768029f1c65b46d62 |
|
BLAKE2b-256 | a581dbb767a0d628fa4ed031df6f92f8de58d5b71bc9f5cebffd58eb74908caf |