Affichage des articles dont le libellé est python. Afficher tous les articles
Affichage des articles dont le libellé est python. Afficher tous les articles

mercredi 21 août 2019

JIRA Python script : iterate to get the JQL result

Python 2.7 script to :

  • query the result of a JIRA search query in JQL
  • iterate so that we do not get all the data at once but only by small batches
  • print the result list

Pre-requesites :

  • python
  • https://pypi.org/project/atlassian-python-api/
  • https://atlassian-python-api.readthedocs.io/en/latest/index.html
  • some JIRA Server or JIRA Cloud + credentials
    • Note that the auth for JIRA Cloud might change a bit



from atlassian import Jira
import json

#auth for JIRA Server
jira = Jira(
    url='https://support.valiantys.com',
    username='username',
    password='password')
# Get the SERVER issues that are Running
JQL = 'project = DEMO AND resolution = Unresolved AND issuetype = "Story" AND status = "In Progress" ORDER BY cf[16032] DESC, cf[15857] DESC'

data_tmp = {}   # data we progressively get each interation
issues_all = [] # full list of issues
issues_tmp = {} # list of issues during this iteration

next_start = 0
size = 50

while size > 0 :
        print("-------- trying to get issues:%s..%s" % (next_start, next_start+size))
        data_tmp = jira.jql(JQL, start=next_start, limit=size)
        next_start += size
        issues_tmp = data_tmp['issues']
        size = len(data_tmp['issues'])
        issues_all.extend(issues_tmp)

print ("(final) #issues=%s" % len(issues_all))

# now we can do things with the data
for x in issues_all:
print("%s %s %s %s" % (x['key'], x['fields']['customfield_16032'], x['fields']['customfield_15862'], x['fields']['customfield_15857']))

mardi 17 février 2015

REF / Link : Benchmark of Python Web Servers

http://nichol.as/benchmark-of-python-web-servers

An extensive analysis of the different python web servers available on the market.

mardi 2 juin 2009

Rubber : a LaTeX processing tool

I still have to test it with other .tex files, but I just discovered and tried "rubber", and LaTeX compilation seems to be pretty fast (for an 8 pages document).


It seems that it proposes a tool that compiles and analyses the LaTeX source file to generate either a ps, pdf or dvi, and to run the needed tools : makeindex, bibtex, etc. and all by itself without having to write a complicated makefile.



From "rubber" man pages :

NAME
rubber - a building system for LaTeX documents

SYNOPSIS
rubber [options] sources ...
rubber-pipe [options]

DESCRIPTION
Rubber is a wrapper for LaTeX and companion programs. Its purpose is,
given a LaTeX source to process, to compile it enough times to resolve
all references, possibly running satellite programs such as BibTeX,
makeindex, Metapost, etc. to produce appropriate data files.

The command rubber builds the specified documents completely. The
source files may be either LaTeX sources (in which case the suffix .tex
may be omitted) or documents in a format Rubber knows how to translate
into LaTeX (this currently means CWEB or Literate Haskell documents).
If one compilation fails, the whole process stops, including the compi‐
lation of the next documents on the command line, and rubber returns a
non-zero exit code.


Some Links :

jeudi 15 janvier 2009

Tomboy and python, using dbus

Tomboy expose a bunch of methods on the dbus interface.

Dbus is a kind of component-oriented middleware comunicating by messages.

Here http://arstechnica.com/journals/linux.ars/2007/09/26/using-the-tomboy-d-bus-interface
I found a description of the dbus interface that tomboy propose to the programmer, so I gave it a try in order to implement a few scripts :

  • showAllNotes

  • showNotebook myNbkName




The previously cited blog article on arstechnica cites this deeper plugin example.




showAllNotes



#!/usr/bin/env python

## In Tomboy, display all the notes.

## Licence : GPL
## Date : 2009-01-14

# This uses the tomboy dbus interface and the methods exposed by tomboy

import sys, dbus, gobject, dbus.glib

# Get the D-Bus session bus
bus = dbus.SessionBus()
# Access the Tomboy D-Bus object
obj = bus.get_object("org.gnome.Tomboy", "/org/gnome/Tomboy/RemoteControl")
# Access the Tomboy remote control interface
tomboy = dbus.Interface(obj, "org.gnome.Tomboy.RemoteControl")

# Show every note
for n in tomboy.ListAllNotes(): tomboy.DisplayNote(n)




showNotebook



#!/usr/bin/env python

## In Tomboy, display all the notes labeled under a given "Notebook"

## Licence : GPL
## Date : 2009-01-14

# This is based on the underliying Tomboy tag mechanism (unused)
# knowing that a given notebook "mynotebookname" will be under the
# tag : "system:notebook:mynotebookname"
# (Thanks to irc.gnome.org#tomboy:sandy for the hint)


import sys, dbus, gobject, dbus.glib

# Get the D-Bus session bus
bus = dbus.SessionBus()
# Access the Tomboy D-Bus object
obj = bus.get_object("org.gnome.Tomboy", "/org/gnome/Tomboy/RemoteControl")
# Access the Tomboy remote control interface
tomboy = dbus.Interface(obj, "org.gnome.Tomboy.RemoteControl")

if len(sys.argv) > 1:
for note in tomboy.GetAllNotesWithTag("system:notebook:" + "".join(sys.argv[1:])):
tomboy.DisplayNote(note)
else : sys.stderr.write("Notebook name not specified. Exiting.\n")