syncgitlab2msproject package¶
Submodules¶
syncgitlab2msproject.argparse_actions module¶
-
class
syncgitlab2msproject.argparse_actions.
EnvDefault
(envvar, required=True, default=None, **kwargs)[source]¶ Bases:
argparse.Action
syncgitlab2msproject.cli module¶
Handle the Command Line Interface
-
syncgitlab2msproject.cli.
filter_by_labels
(issues: List[syncgitlab2msproject.gitlab_issues.Issue], label: str) → List[syncgitlab2msproject.gitlab_issues.Issue][source]¶ Filter out issues whoes label matches given one
- Note: Currently not used as filtering is done directly in the match
to allow better debug messages
- Parameters
issues – origin
label – to filter out
Returns: filtered list of issues
-
syncgitlab2msproject.cli.
has_not_label
(issue: syncgitlab2msproject.gitlab_issues.Issue, label: str) → bool[source]¶ Give true if to include the issue as it has no ignored label
- Parameters
issue – to compare with
label – to ignore
Returns: True if to include the label
-
syncgitlab2msproject.cli.
label_convert
(label_string: str) → str[source]¶ Convert the label string for easier matches
-
syncgitlab2msproject.cli.
main
(args)[source]¶ Main entry point allowing external calls
- Parameters
args ([str]) – command line parameter list
syncgitlab2msproject.custom_types module¶
syncgitlab2msproject.decorators module¶
-
syncgitlab2msproject.decorators.
T_OUT
¶ Overload variants to show that the value is only None if None was given
- Note: This overloading is readable but not recognized by mypy, so we drop it for
the moment but still keep it
@overload def make_none_safe(func: Callable[[T_IN], T_OUT]) -> Callable[[T_IN], T_OUT]: …
@overload def make_none_safe(func: Callable[[None], None]) -> Callable[[None], None]: …
alias of TypeVar(‘T_OUT’)
syncgitlab2msproject.exceptions module¶
-
exception
syncgitlab2msproject.exceptions.
ClassNotInitiated
[source]¶ Bases:
syncgitlab2msproject.exceptions.MSProjectSyncError
Tried to load a function without properly initiate the class
-
exception
syncgitlab2msproject.exceptions.
GitlabSyncError
[source]¶ Bases:
ValueError
-
exception
syncgitlab2msproject.exceptions.
MSProjectSyncError
[source]¶ Bases:
ValueError
syncgitlab2msproject.funcions module¶
syncgitlab2msproject.gitlab_issues module¶
-
class
syncgitlab2msproject.gitlab_issues.
Issue
(obj: Union[gitlab.v4.objects.GroupIssue, gitlab.v4.objects.ProjectIssue])[source]¶ Bases:
object
Wrapper class around Group/Project Issues
-
property
assignees
¶ list of Gitlab Assignees.
Note in the community edition only one assignee is possible
-
property
closed_at
¶
-
property
closed_by
¶
-
property
description
¶
-
property
due_date
¶
-
property
group_id
¶
-
property
has_tasks
¶
-
property
id
¶ The id of an issue - it seems to be unique within an installation
-
property
iid
¶
-
property
is_closed
¶
-
property
is_open
¶
-
property
labels
¶ list of labels
-
property
moved_reference
¶ get the reference to the moved issue if defined
:exceptions MovedIssueNotDefined
-
property
moved_to_id
¶
-
obj
: GitlabIssue¶
-
property
percentage_tasks_done
¶ Percentage of tasks done, 0 if no tasks are defined and not closed. By definition always 100 if issue is closed (and not moved)
:exceptions MovedIssueNotDefined
-
property
project_id
¶
-
property
time_estimated
¶ Time estimated in minutes
-
property
time_spent_total
¶ Total time spent in minutes
-
property
title
¶
-
property
web_url
¶ give the url from which the issue can be accessed
-
property
-
syncgitlab2msproject.gitlab_issues.
get_gitlab_class
(server: str, personal_token: Optional[str] = None) → gitlab.Gitlab[source]¶
-
syncgitlab2msproject.gitlab_issues.
get_group_issues
(gitlab: gitlab.Gitlab, group_id: int) → List[syncgitlab2msproject.gitlab_issues.Issue][source]¶
-
syncgitlab2msproject.gitlab_issues.
get_project_issues
(gitlab: gitlab.Gitlab, project_id: int) → List[syncgitlab2msproject.gitlab_issues.Issue][source]¶
syncgitlab2msproject.helper_classes module¶
-
class
syncgitlab2msproject.helper_classes.
ForceFixedWork
(issue: syncgitlab2msproject.gitlab_issues.Issue)[source]¶ Bases:
syncgitlab2msproject.helper_classes.SetTaskTypeConservative
No matter what always set Task Type to Fixed Work for all synced Task
-
set_task_type_after_sync
(task: syncgitlab2msproject.ms_project.Task) → None[source]¶ Function just before finishing the sync
-
-
class
syncgitlab2msproject.helper_classes.
SetTaskTypeConservative
(issue: syncgitlab2msproject.gitlab_issues.Issue)[source]¶ Bases:
syncgitlab2msproject.helper_classes.TaskTyperSetter
Set Fixed Work as default creating a new task and before syncing any Task but make sure to reset to the original value (including Effort Driven Setting) after finishing the sync
-
set_task_type_after_sync
(task: syncgitlab2msproject.ms_project.Task) → None[source]¶ Function just before finishing the sync
-
set_task_type_before_sync
(task: syncgitlab2msproject.ms_project.Task, is_inital: bool) → None[source]¶ Function that is called at the beginning of the sync
-
-
class
syncgitlab2msproject.helper_classes.
TaskTyperSetter
(issue: syncgitlab2msproject.gitlab_issues.Issue)[source]¶ Bases:
abc.ABC
Abstract Base Class that is used to dynamically allow setting the task type
-
abstract
set_task_type_after_sync
(task: syncgitlab2msproject.ms_project.Task) → None[source]¶ Function just before finishing the sync
-
abstract
set_task_type_before_sync
(task: syncgitlab2msproject.ms_project.Task, is_initial: bool) → None[source]¶ Function that is called at the beginning of the sync
-
abstract
syncgitlab2msproject.ms_project module¶
-
class
syncgitlab2msproject.ms_project.
MSProject
(doc_path: os.PathLike)[source]¶ Bases:
collections.abc.Sequence
,typing.Generic
Python Wrapper around the Communication with MS Project
Offers at task list
-
add_task
(name: str) → syncgitlab2msproject.ms_project.Task[source]¶
-
get_task
(task_nr: int) → Optional[syncgitlab2msproject.ms_project.Task][source]¶
-
-
class
syncgitlab2msproject.ms_project.
PjTaskFixedType
(value)[source]¶ Bases:
enum.IntEnum
MS Project Task Type as defined in https://docs.microsoft.com/en-us/office/vba/api/project.pjtaskfixedtype
-
pjFixedDuration
= 1¶
-
pjFixedUnits
= 0¶
-
pjFixedWork
= 2¶
-
-
class
syncgitlab2msproject.ms_project.
Task
(project: syncgitlab2msproject.ms_project.MSProject, task_number: int)[source]¶ Bases:
object
Python Wrapper Class around MS Project Task API
Find API reference here: https://docs.microsoft.com/office/vba/api/project.task
this helps to use the Task object in a pythonic way, converting all values automatically. Properties naming follows PEP8 (lower case naming)
-
property
actual_finish
¶
-
property
actual_start
¶
-
property
actual_work
¶ Gets or sets the actual work (in minutes) for the task. Read/write Variant.
-
property
deadline
¶
-
property
duration
¶ Gets the duration (in minutes) of a task. Read-only for summary tasks. Read/write Variant.
-
property
effort_driven
¶
-
property
estimated
¶ True if the task duration is an estimate. False if the task duration is a set value. Read/write Variant.
-
property
finish
¶
-
property
has_children
¶
-
property
hyperlink_address
¶ set or get hyplerlink (url) see https://docs.microsoft.com/en-us/office/vba/api/project.task.hyperlink
-
property
hyperlink_name
¶ set or get hyplerlink (name) see https://docs.microsoft.com/en-us/office/vba/api/project.task.hyperlink
-
property
id
¶
-
property
name
¶
-
property
notes
¶
-
property
outline_level
¶
-
property
percent_complete
¶
-
property
start
¶
-
property
text1
¶ get or sets the Text1 Property
-
property
text10
¶ get or sets the Text10 Property
-
property
text11
¶ get or sets the Text11 Property
-
property
text12
¶ get or sets the Text12 Property
-
property
text13
¶ get or sets the Text13 Property
-
property
text14
¶ get or sets the Text14 Property
-
property
text15
¶ get or sets the Text15 Property
-
property
text16
¶ get or sets the Text16 Property
-
property
text17
¶ get or sets the Text17 Property
-
property
text18
¶ get or sets the Text18 Property
-
property
text19
¶ get or sets the Text19 Property
-
property
text2
¶ get or sets the Text2 Property
-
property
text20
¶ get or sets the Text20 Property
-
property
text21
¶ get or sets the Text21 Property
-
property
text22
¶ get or sets the Text22 Property
-
property
text23
¶ get or sets the Text23 Property
-
property
text24
¶ get or sets the Text24 Property
-
property
text25
¶ get or sets the Text25 Property
-
property
text26
¶ get or sets the Text26 Property
-
property
text27
¶ get or sets the Text27 Property
-
property
text28
¶ get or sets the Text28 Property
-
property
text29
¶ get or sets the Text29 Property
-
property
text3
¶ get or sets the Text3 Property
-
property
text30
¶ get or sets the Text30 Property
-
property
text4
¶ get or sets the Text4 Property
-
property
text5
¶ get or sets the Text5 Property
-
property
text6
¶ get or sets the Text6 Property
-
property
text7
¶ get or sets the Text7 Property
-
property
text8
¶ get or sets the Text8 Property
-
property
text9
¶ get or sets the Text9 Property
-
property
type
¶
-
property
work
¶ Gets or sets the work (in minutes) for the task. Read/write Variant.
-
property
-
syncgitlab2msproject.ms_project.
na_py2win_datetime
(dt: Optional[datetime.datetime]) → Union[datetime.datetime, str][source]¶ Convert nullable datetype for usage in MS Project
-
syncgitlab2msproject.ms_project.
na_win2py_datetime
(win32datetime: pywintypes.datetime) → Optional[datetime.datetime][source]¶ Convert also NA datetime to Python Datetype, give None if NA
-
syncgitlab2msproject.ms_project.
win2python_datetime
(win32datetime: pywintypes.datetime) → datetime.datetime[source]¶ Convert MSProject time to Python time
might be a cumbersome to convert to string first but seems the only way to be sure the timezone is correct see http://timgolden.me.uk/python/win32_how_do_i/use-a-pytime-value.html for an alternative. This solution is taken from: https://stackoverflow.com/questions/39028290/
syncgitlab2msproject.sync module¶
-
class
syncgitlab2msproject.sync.
IssueFinder
(issues: List[syncgitlab2msproject.gitlab_issues.Issue])[source]¶ Bases:
object
-
by_ref_id
(ref_id: NewType.<locals>.new_type) → syncgitlab2msproject.gitlab_issues.Issue[source]¶ -
by_ref_id
(ref_id: None) → None Give related issue if ref_id is set and the issue is found If an invalid reference is given throw :exceptions KeyError
-
by_web_url
(web_url: Optional[NewType.<locals>.new_type]) → Optional[syncgitlab2msproject.gitlab_issues.Issue][source]¶ Give related issue if weburl is set and the issue is found, If an invalid web_url is given throw :exceptions KeyError
-
-
syncgitlab2msproject.sync.
add_issue_as_task_to_project
(tasks: syncgitlab2msproject.ms_project.MSProject, issue: syncgitlab2msproject.gitlab_issues.Issue, task_type_setter: Type[syncgitlab2msproject.helper_classes.TaskTyperSetter])[source]¶
-
syncgitlab2msproject.sync.
get_issue_ref_from_task
(task: Optional[syncgitlab2msproject.ms_project.Task]) → Optional[NewType.<locals>.new_type][source]¶ get reference to gitlab issues from MS Project task
-
syncgitlab2msproject.sync.
get_issue_ref_id
(issue: syncgitlab2msproject.gitlab_issues.Issue) → NewType.<locals>.new_type[source]¶ Return the ID of an gitlab issue
Note the
-
syncgitlab2msproject.sync.
get_issue_web_url
(issue: syncgitlab2msproject.gitlab_issues.Issue) → NewType.<locals>.new_type[source]¶ Get the web url from an gitlab issue
-
syncgitlab2msproject.sync.
get_weburl_from_task
(task: Optional[syncgitlab2msproject.ms_project.Task], gitlab_url: NewType.<locals>.new_type) → Optional[NewType.<locals>.new_type][source]¶ Get the weburl from MS Project Task (is saved as hyperlink)
-
syncgitlab2msproject.sync.
is_gitlab_hyperlink
(url: NewType.<locals>.new_type, gitlab_url: NewType.<locals>.new_type) → bool[source]¶
-
syncgitlab2msproject.sync.
set_issue_ref_to_task
(task: syncgitlab2msproject.ms_project.Task, issue: syncgitlab2msproject.gitlab_issues.Issue) → None[source]¶ set reference to gitlab issues in MS Project task
-
syncgitlab2msproject.sync.
sync_gitlab_issues_to_ms_project
(tasks: syncgitlab2msproject.ms_project.MSProject, issues: List[syncgitlab2msproject.gitlab_issues.Issue], gitlab_url: NewType.<locals>.new_type, task_type_setter: Type[syncgitlab2msproject.helper_classes.TaskTyperSetter], include_issue: Optional[Callable[[syncgitlab2msproject.gitlab_issues.Issue], bool]] = None) → None[source]¶ - Parameters
tasks – MS Project Tasks that will be synchronized
issues – List of Gitlab Issues
gitlab_url – the gitlab istance url to check url found in MS project against
include_issue – Include issue in sync, if None include everything
-
syncgitlab2msproject.sync.
update_task_with_issue_data
(task: syncgitlab2msproject.ms_project.Task, issue: syncgitlab2msproject.gitlab_issues.Issue, task_type_setter: Type[syncgitlab2msproject.helper_classes.TaskTyperSetter], *, parent_ids: Optional[List[NewType.<locals>.new_type]] = None, ignore_issue: bool = False, is_add: bool = False) → List[NewType.<locals>.new_type][source]¶ Update task with issue data
if an issue is moved the date of the new issue is used as long it is available
- Parameters
task – The MS Project task that will be updated
issue – the issue with the data to be considered
task_type_setter – Helper class to set the task type correct
parent_ids – the parent stuff
ignore_issue – only return the related (and moved) ids but do not really sync This is required so we can ignored also moved issues correctly
is_add –
- Returns
list of IssueRefs that
Module contents¶
-
class
syncgitlab2msproject.
Issue
(obj: Union[gitlab.v4.objects.GroupIssue, gitlab.v4.objects.ProjectIssue])[source]¶ Bases:
object
Wrapper class around Group/Project Issues
-
property
assignees
¶ list of Gitlab Assignees.
Note in the community edition only one assignee is possible
-
property
closed_at
¶
-
property
closed_by
¶
-
property
description
¶
-
property
due_date
¶
-
property
group_id
¶
-
property
has_tasks
¶
-
property
id
¶ The id of an issue - it seems to be unique within an installation
-
property
iid
¶
-
property
is_closed
¶
-
property
is_open
¶
-
property
labels
¶ list of labels
-
property
moved_reference
¶ get the reference to the moved issue if defined
:exceptions MovedIssueNotDefined
-
property
moved_to_id
¶
-
obj
: GitlabIssue¶
-
property
percentage_tasks_done
¶ Percentage of tasks done, 0 if no tasks are defined and not closed. By definition always 100 if issue is closed (and not moved)
:exceptions MovedIssueNotDefined
-
property
project_id
¶
-
property
time_estimated
¶ Time estimated in minutes
-
property
time_spent_total
¶ Total time spent in minutes
-
property
title
¶
-
property
web_url
¶ give the url from which the issue can be accessed
-
property
-
class
syncgitlab2msproject.
MSProject
(doc_path: os.PathLike)[source]¶ Bases:
collections.abc.Sequence
,typing.Generic
Python Wrapper around the Communication with MS Project
Offers at task list
-
add_task
(name: str) → syncgitlab2msproject.ms_project.Task[source]¶
-
get_task
(task_nr: int) → Optional[syncgitlab2msproject.ms_project.Task][source]¶
-
-
syncgitlab2msproject.
sync_gitlab_issues_to_ms_project
(tasks: syncgitlab2msproject.ms_project.MSProject, issues: List[syncgitlab2msproject.gitlab_issues.Issue], gitlab_url: NewType.<locals>.new_type, task_type_setter: Type[syncgitlab2msproject.helper_classes.TaskTyperSetter], include_issue: Optional[Callable[[syncgitlab2msproject.gitlab_issues.Issue], bool]] = None) → None[source]¶ - Parameters
tasks – MS Project Tasks that will be synchronized
issues – List of Gitlab Issues
gitlab_url – the gitlab istance url to check url found in MS project against
include_issue – Include issue in sync, if None include everything