python-gantt-csv manages the arguments of gantt.Task in csv format and resolves dependencies between tasks.
You will be able to edit tasks without worrying about the order in which you define them.
Requirements
This projects needs the following libraries:
python-gantt see http://xael.org/pages/python-gantt-en.html
Additionnal requirements
Installation
pip install python-gantt-csv
Definition of Task Arguments in CSV Format
column name |
valid value |
|---|---|
name |
str |
start |
‘today’ or iso format date (Ex: ‘2014-12-26’) |
duration |
int |
percent_done |
int |
resources |
‘None’ or str or colon separated str (Ex: ‘ANO:JLS’) |
depends_of |
‘None’ or unique str or colon separated unique str (Ex: ‘1:2’) |
color |
Hex color (Ex: #FF8080) |
id |
unique str |
Usage
Directory structure
. ├── example1.csv ├── example2.csv └── example.py
Run example
python example.py
example1.csv
name,start,depends_of,duration,percent_done,resources,color,id tache1,2014-12-25,None,4,44,ANO,#FF8080,1 tache2,2014-12-28,None,6,0,JLS,#c70039,2 tache3,2014-12-25,1:2:6,5,50,ANO:JLS,#f37121,3 tache4,2015-01-01,1,4,40,JLS,#c0e218,4 tache6,2014-12-25,6,4,0,ANO:JLS,#f37121,5 tache7,2014-12-28,None,6,0,JLS,#c0e218,6 tache8,today,6,4,0,ANO:JLS,#111d5e,7
example2.csv
name,start,depends_of,duration,percent_done,resources,color,id tache5,2014-12-23,None,3,0,ANO:JLS,#f37121,1
example.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import datetime
from pathlib import Path
import gantt
from gantt_csv import create_project_from_csv, RESOURCES
YMD_VACATIONS = [
(2014, 12, 30),
(2014, 12, 31),
(2015, 1, 1),
(2015, 1, 2),
]
# Change font default
gantt.define_font_attributes(fill='black',
stroke='black',
stroke_width=0,
font_family="Verdana")
# Add vacations for everyone
for year, month, date in YMD_VACATIONS:
gantt.add_vacations(datetime.date(year, month, date))
# Create project from csv files
projects = []
for csv_path in Path('.').glob('*.csv'):
p1 = create_project_from_csv(csv_path)
projects.append(p1)
# Or Create project from list
# task_table = []
# with open("gantt_args1.csv", "rt", encoding="utf-8", newline='') as f:
# reader = csv.reader(f)
# for row in reader:
# task_table.append(row)
# p1 = create_project_from_table(
# "Example2 project",
# task_table[1:],
# header=task_table[0]
# )
# Create parent project
parent_project = gantt.Project(name='Parent Project')
# which contains the other projects
for project in projects:
parent_project.add_task(project)
# MAKE DRAW
parent_project.make_svg_for_tasks(filename='test_full.svg',
today=datetime.date.today(),
start=datetime.date(2014, 12, 20),
end=datetime.date(2015, 2, 20))
parent_project.make_svg_for_resources(filename='test_resources.svg',
today=datetime.date.today(),
resources=tuple(RESOURCES.values()))
parent_project.make_svg_for_tasks(filename='test_weekly.svg',
today=datetime.date.today(),
scale=gantt.DRAW_WITH_WEEKLY_SCALE)
Licence
GPL v3 or any later version
Release files for python-gantt-csv 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| python-gantt-csv-0.4.0.tar.gz | 86.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| python_gantt_csv-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 93.3 kB
Release files / python-gantt-csv-0.4.0.tar.gz
| Download URL | python-gantt-csv-0.4.0.tar.gz |
|---|---|
| Size | 86.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c9f287b6049a5324843b958f8fccf7beeee7f065c56a6285b349d0af7858361b
|
|
BLAKE2b-256 checksum How to use checksums |
9d4c2bf8fb4db22bc7b11c4a6f16e68e7f9e23f9bb3e7f0291a0723dc7a12c8a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.6.10
|
Release files / python_gantt_csv-0.4.0-py3-none-any.whl
| Download URL | python_gantt_csv-0.4.0-py3-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f8e32ad497958a1e3d84abf69590c096cfdbf56cfe18bf551adffd27c68644e2
|
|
BLAKE2b-256 checksum How to use checksums |
9cb359c0c7bd3f2ac9001b4b77be92a3ebfc34e21c6722c40d007886d71a7bea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.6.10
|