Skip to main content

Extract project data from GitLab

Project description

Magshimim GitLab Project Management

This package extracts project data from GitLab, and writes it to .csv files, which can be used for monitoring and analysis (e.g., using Excel)

The data extracted by this package includes:

  • events.csv - (almost) every activity made, including opening and closing issues, pushing to the repository, and more...

  • backlog.csv - a pool of issues, not associated with assignee or milestone.

  • sprints.csv - an advanced feature for close monitoring of sprint progress (see special requirements below)

Installation

pip install magpy-raz

Requirements

To use this package, you need to provide a GitLab personal access token file, with api scope.

Assumptions

  • Gitlab projects belong to GitLab groups (not individual users)

  • Each project has a defined start_date and end_date

  • Output csv files will be created in the same folder as the main program

Special Requirements for Sprint Tracking

To use the sprints feature, you need to implement the following in your GitLab projects:

  • Create a set of milestones, each with a start and due date, creating a continuous timeline (i.e., the due date of sprint-1 is the day before the start date of sprint-2)

  • Define a work-hours budget for the sprint, by including the following line at the top of the milestone descrition: Budget: .... = __h

  • Define work estimate for each issue, associated with the milestone, by using the Gitlab /estimate command (see GitLab Time Tracking for more details)

  • Use the standard To Do, In Progress and Done labels, to indicate issue status.

Example

import magpy.general as mg
import magpy.project as my
import magpy.projects as mp
import sys

PROJECTS = "[ירושלים,14970506,2019-10-29,2020-03-30]" + \
           "[בית-שמש,14969935,2019-10-31,2020-04-01]"

TOKEN = 'token-raz.txt'


def parse_projects(project_string):
    '''
    Convert Projects string to a list of projects
    '''
    project_list = []

    project_string_list = project_string.split(sep=']')
    for project_string in project_string_list:
        project_params = project_string.strip('[,').split(sep=',')
        if len(project_string) >= 4:
            project_list.append((project_params[0],
                                 project_params[1],
                                 project_params[2],
                                 project_params[3]))

    return project_list


def main():

    try:
        # Get projects from a calling script (e.g., from Excel)
        token = sys.argv[1]
        project_list = parse_projects(sys.argv[2])
    except BaseException:
        # Get locally defined projects (for debug)
        token = TOKEN
        project_list = parse_projects(PROJECTS)

    # Connect to GitLab
    gl = mg.MagGitlab(token)

    # Get data for my projects
    projects = mp.Projects(gl, project_list)
    projects.write_csv_files()


if __name__ == '__main__':
    main()

Author

Raz Nitzan

License

Distributed under the MIT License.

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

magpy-raz-1.0.9.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

magpy_raz-1.0.9-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file magpy-raz-1.0.9.tar.gz.

File metadata

  • Download URL: magpy-raz-1.0.9.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.7.3

File hashes

Hashes for magpy-raz-1.0.9.tar.gz
Algorithm Hash digest
SHA256 c8f814403682e3a6bc6ad78b3c5bc11c3cc515bcb3ceeda1ba449a6fd506e2b0
MD5 d65fb91aa0a4c9d87f192ff4692864da
BLAKE2b-256 0635c8e4fb93f4e5bd25adf0fd2002c0ad348aede6561184cbe2ffa4c3cd2e9f

See more details on using hashes here.

File details

Details for the file magpy_raz-1.0.9-py3-none-any.whl.

File metadata

  • Download URL: magpy_raz-1.0.9-py3-none-any.whl
  • Upload date:
  • Size: 16.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.7.3

File hashes

Hashes for magpy_raz-1.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 8979aeecdf9a9602687f284bfc5dbae7d321caf6198bcf4395dff3041b8a2932
MD5 9e8f1746557d3c9710f89db6ec434258
BLAKE2b-256 40c008feadf4f5a3e4eb4519520233dadb684283c2cbf967a4a8154c552265d7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page