Aspose.Tasks Cloud Python SDK
Create, Convert MS Project Files via Python REST API
Ptyhon Project Management Cloud API enables Project Managers to Generate, Read, Manipulate, or Convert Microsoft Project MPT, MPP, MPX & Oracle Primavera XER, XML and PrimaveraP6XML Files via Python REST API.
Aspose.Tasks Cloud Python SDK is a powerful set of tools that enables software developers to work seamlessly with project management files such as Microsoft Project (MPP) and Oracle Primavera formats. This SDK offers a range of features for creating, managing, and converting project files, providing essential functionality for building robust project management applications. By incorporating this cloud-based SDK, software developers can easily integrate project management capabilities into their Python applications without needing the actual Microsoft Project or Primavera software installed.
Aspose.Tasks Cloud Python SDK is a powerful solution for automating and streamlining your project management workflows. It provides complete support working with Microsoft Project (MPT, MPP, MPX) and Primavera P6 (XER, XML) file formats. With just a couple of lines of code developers can perform project files conversion to numerous file formats such as HTML, PDF, XPS, TXT, CSV, XLSX, SVG, TIFF, JPEG, PNG, BMP, and so on. The SDK supports creating and setting project document properties, creating or updating project tasks, managing project resources, managing project calendars, generating visual reports, getting all task links of a project, moving project task from one parent task to another and so on.
One of the most significant advantages of using Aspose.Tasks Cloud Python SDK is that it removes the dependency on Microsoft Project or Primavera. Since the SDK operates in the cloud, developers can integrate project management capabilities into Python applications that run on various platforms (Windows, macOS, Linux) without compatibility concerns. It facilitates scalability and collaboration by allowing teams to access and work on project files from different locations. If you need to convert files, keep track of task order, or create reports, the Aspose.Tasks Cloud has everything you need to smoothly integrate project management tasks.
Getting Started with Aspose.Tasks Cloud Python SDK
The recommend way to install Aspose.Tasks Cloud Python SDK is via Pypi. Please use the following commands for a smooth installation.
Install Aspose.Tasks for Python via .NET via Pypi
pip install asposetaskscloud
You can download the directly from Aspose.Tasks Release pageConvert Project Management Files via Python
One of the most useful features of Aspose.Tasks Cloud Python SDK is its ability to convert project management files between various formats. The SDK allows developers to convert Microsoft Project files (MPP) into formats such as PDF, XML, XLSX, and Primavera formats (P6XML and XER), making it easy to share project information across platforms. This code sample demonstrates how software developers can upload an MPP file to cloud storage and convert it to PDF format using the SDK.
How to Convert MPP Files to PDF via Python REST API?
api_client = asposetaskscloud.ApiClient()
api_client.configuration.host = 'https://api.aspose.cloud'
api_client.configuration.api_key['api_key'] = 'MY_CLIENT_SECRET'
api_client.configuration.api_key['app_sid'] = 'MY_CLIENT_ID'
tasks_api = asposetaskscloud.TasksApi(api_client)
file_name = 'SomeSeriousPlan.mpp'
upload_request = asposetaskscloud.models.requests.UploadFileRequest(os.path.join(self.remote_test_folder, file_name), file_name)
upload_result = self.tasks_api.upload_file(upload_request)
request = asposetaskscloud.models.requests.GetReportPdfRequest(file_name, ReportType.MILESTONES)
result = tasks_api.get_report_pdf(request)
Project Task Management in Cloud Apps
Aspose.Tasks Cloud Python SDK provides comprehensive APIs for creating and managing tasks in project files inside Python cloud-base applications. with just a couple of lines of code software developers can create, update, delete and assign tasks, set task dependencies, define constraints, and manage task baselines. This feature allows you to automate and manage complex project schedules with ease. In the following example, users can create two tasks and set a dependency between them using a "Finish-to-Start" link. Task dependencies are crucial in managing project workflows effectively.
How to Create and Manage Tasks inside Python Apps?
# Create a new task in the project
task = models.Task(name="Develop Backend", start="2024-10-23", duration=5)
created_task = api.create_task(file_name, task)
# Set task dependency (finish-to-start)
dependent_task = models.Task(name="Develop Frontend", start="2024-10-30", duration=5)
created_dependent_task = api.create_task(file_name, dependent_task)
dependency = models.TaskLink(predecessor_uid=created_task.uid, successor_uid=created_dependent_task.uid, link_type="FinishToStart")
api.create_task_link(file_name, dependency)
Handling Project Calendars via Python API
Managing project schedules requires proper handling of work hours, holidays, and non-working days. Aspose.Tasks Cloud Python SDK provides features for managing project calendars, allowing software developers to define working times, holidays, custom work schedules and many more inside cloud-based python applications. The following example shows how software developers can add a calendar to a project inside cloud-based Python applications.
How to Add a Calendar to a Project via Python REST API?
filename = 'Home_move_plan.mpp'
self.upload_file(filename)
first_day = WeekDay()
first_day.day_type = DayType.SUNDAY
first_day.day_working = False
second_day = WeekDay()
second_day.day_type = DayType.MONDAY
second_day.day_working = True
second_day.from_date = datetime(2000, 1, 1, 8)
second_day.to_date = datetime(2000, 1, 1, 17)
first_working_time = WorkingTime()
first_working_time.from_time = datetime(2000, 1, 1, 8)
first_working_time.to_time = datetime(2000, 1, 1, 13)
second_working_time = WorkingTime()
second_working_time.from_time = datetime(2000, 1, 1, 14)
second_working_time.to_time = datetime(2000, 1, 1, 17)
second_day.working_times = [first_working_time, second_working_time]
calendar = Calendar()
calendar.name = 'My new calendar'
calendar.days = [first_day, second_day]
calendar.is_base_calendar = False
calendar.is_baseline_calendar = False
request = PostCalendarRequest(filename, calendar)
post_result = self.tasks_api.post_calendar(request)
self.assertIsNotNone(post_result)
self.assertIsInstance(post_result, CalendarItemResponse)
get_result = self.tasks_api.get_calendar(GetCalendarRequest(filename, post_result.calendar_item.uid))
self.assertEqual('My new calendar', get_result.calendar.name)
self.assertEqual(7, len(get_result.calendar.days))
monday = next(d for d in get_result.calendar.days if d.day_type == DayType.MONDAY)
self.assertEqual(2, len(monday.working_times))
self.assertEqual(first_working_time.from_time.strftime("%H:%M:%S"), monday.working_times[0].from_time.strftime("%H:%M:%S"))
self.assertEqual(first_working_time.to_time.strftime("%H:%M:%S"), monday.working_times[0].to_time.strftime("%H:%M:%S"))
self.assertEqual(second_working_time.from_time.strftime("%H:%M:%S"), monday.working_times[1].from_time.strftime("%H:%M:%S"))
self.assertEqual(second_working_time.to_time.strftime("%H:%M:%S"), monday.working_times[1].to_time.strftime("%H:%M:%S"))
Add Gantt Charts and Reports to Project Files
Aspose.Tasks Cloud Python SDK makes it easy for software developers to generate visual reports, such as Gantt charts and task progress reports using Python REST API. These charts help project managers visualize task timelines, dependencies, and overall progress, which can be essential for stakeholders and team members. Here is an example that demonstrates how to export a project file to a PDF that could serve as a Gantt chart, providing visual insights into the project’s progress and structure.
How to Export Project to Gantt Chart (PDF) inside Cloud-Base Python Apps?
# Export project to PDF to visualize it as a Gantt chart
response = api.export(file_name, 'pdf')
with open('gantt_chart.pdf', 'wb') as f:
f.write(response)