Skip to main content

Write a json's GPAO file

Project description

IGN GPAO Project Builder

IGN GPAO Project builder est une bibliothèque python de création de projet au format JSON pour la GPAO.

Prérequis

  • Python 3 ou plus

Installation

Vous pouvez la télécharger depuis les dépôts officiels de PyPI:

pip install ign-gpao-project-builder

Exemple d'utilisation

from gpao.builder import Builder
from gpao.project import Project
from gpao.job import Job

job1 = Job("job1", "touch file", tags=["tag1", "tag2"])
job2 = Job("job2", "touch file")
job3 = Job("job3", "touch file", job1, tags=["tag1", "tag2"])
job3.add_dependency(job2)

# print(job1.to_json())
# print(job2.to_json())
# print(job3.to_json())

project1 = Project("project1", [job1, job2, job3])
# print(project1.to_json())

job4 = Job("job4", "touch file")
job5 = Job("job5", "touch file")
job5.add_dependency(job4)

project2 = Project("project2", [job4, job5])

# print(project2.to_json())

job6 = Job("job6", "touch file")
job7 = Job("job7", "touch file", job6)
project3 = Project("project3", [job6, job7], [project1, project2])

# print(project3.to_json())

builder = Builder([project1, project2])
builder.add_project(project3)

builder.save_as_json("project.json")


job8 = Job("job8", "touch file")
job8bis = Job("job8bis", "touch file", job8)
project4 = Project("project4",  [job8, job8bis])

job9 = Job("job9", "touch file")
project5 = Project("project5",  [job9], [project4])

builder = Builder([project4, project5])

builder.send_project_to_api("http://localhost:8080")

Cet exemple sauvegarde un fichier project.json avec le contenu suivant :

{
    "projects": [
        {
            "name": "project1",
            "jobs": [
                {
                    "name": "job1",
                    "command": "touch file",
                    "tags": [
                        "tag1",
                        "tag2"
                    ]
                },
                {
                    "name": "job2",
                    "command": "touch file"
                },
                {
                    "name": "job3",
                    "command": "touch file",
                    "deps": [
                        {
                            "id": 0
                        },
                        {
                            "id": 1
                        }
                    ],
                    "tags": [
                        "tag1",
                        "tag2"
                    ]
                }
            ]
        },
        {
            "name": "project2",
            "jobs": [
                {
                    "name": "job4",
                    "command": "touch file"
                },
                {
                    "name": "job5",
                    "command": "touch file",
                    "deps": [
                        {
                            "id": 0
                        }
                    ]
                }
            ]
        },
        {
            "name": "project3",
            "jobs": [
                {
                    "name": "job6",
                    "command": "touch file"
                },
                {
                    "name": "job7",
                    "command": "touch file",
                    "deps": [
                        {
                            "id": 0
                        }
                    ]
                }
            ],
            "deps": [
                {
                    "id": 0
                },
                {
                    "id": 1
                }
            ]
        }
    ]
}

Licence

Ce projet est sous licence CECILL-B (voir LICENSE.md).

IGN

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

ign-gpao-project-builder-0.9.0.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

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

ign_gpao_project_builder-0.9.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file ign-gpao-project-builder-0.9.0.tar.gz.

File metadata

File hashes

Hashes for ign-gpao-project-builder-0.9.0.tar.gz
Algorithm Hash digest
SHA256 ed387d88dbb79b1daba23cfcba009cc9e41a8d54f056a88c4db7c085f03de4c6
MD5 63d6673ee6c5be0ca65a1e98f2dcbad7
BLAKE2b-256 c1a08d0707546ec89b9149ebf558b32ea1c2cf1af46738635558eeca431cf5be

See more details on using hashes here.

File details

Details for the file ign_gpao_project_builder-0.9.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ign_gpao_project_builder-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fdef063f4225d26be2f96d00d95719049a5d23c6bc1455e333bcdae4c0df0dd1
MD5 90a893497c547b99bee45430c3df11e4
BLAKE2b-256 64e5dd6af79f5696b441a75ebb3ca022a872995459a05fe053a3fb3c0cc5e9d2

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