Skip to content

Version 2.0.0: Refactor PagerDuty into a multi-file module#36

Merged
Deconstrained merged 49 commits intomainfrom
issue-27-multi-file-refactor
Apr 8, 2025
Merged

Version 2.0.0: Refactor PagerDuty into a multi-file module#36
Deconstrained merged 49 commits intomainfrom
issue-27-multi-file-refactor

Conversation

@Deconstrained
Copy link
Collaborator

@Deconstrained Deconstrained commented Feb 14, 2025

Context

This pull request addresses #27.

Summary

Multi-file Refactor

It includes significant structural changes to the pagerduty package by refactoring what was a monolithic python module file into a multi-file module in the pagerduty directory.

For backwards compatibility, all helper methods and classes are imported to the root namespace of the module (in __init__.py). Any new API client classes (i.e. for the newer integration product APIs) are expected to be added in aptly-named files and similarly imported to the root of the module. Classes are expected to be usable as they always previously have. For example:

# Valid, preferred
client = pagerduty.RestApiV2Client(API_KEY)

# Also now valid, but should not be necessary:
client = pagerduty.rest_api_v2_client.RestApiV2Client(API_KEY)

Going forward, any specialized helpers that are declared only in the module where they are used are not necessary to import into the root module namespace (or add to sphinx/source/module_reference.rst for that matter) unless the intention is to publish them for use outside their original purpose. All methods should still have docstrings regardless.

Minor changes

  • Update docstring and type hint in EventsApiV2Client.send_change_event. The return statement was removed in 1.0.0 because it is expected to always be None based on the schema, and Python functions without a return statement effectively return None, but the docstring and type hint were not updated. This caused an issue with Airflow CI/CD builds (see Fix: add missing Return event ID from change event submission #38).
  • Change the prefix of the user-agent header from pagerduty to python-pagerduty

Before Releasing

  • Perform a test publish / install to validate that upgrading from 1.0.0 works
  • Integration test the module as a reality check

@Deconstrained Deconstrained force-pushed the issue-27-multi-file-refactor branch from 788813b to 396deb4 Compare February 14, 2025 23:06
@Deconstrained Deconstrained force-pushed the issue-27-multi-file-refactor branch from d207c63 to bfd390a Compare February 14, 2025 23:13
@Deconstrained Deconstrained force-pushed the issue-27-multi-file-refactor branch 2 times, most recently from c62bc39 to 03cafd7 Compare March 18, 2025 23:48
@Deconstrained Deconstrained force-pushed the issue-27-multi-file-refactor branch 2 times, most recently from e847b67 to b3bdbe6 Compare March 18, 2025 23:56
@Deconstrained Deconstrained force-pushed the issue-27-multi-file-refactor branch from d2993bb to 73faca3 Compare March 19, 2025 21:25
@Deconstrained Deconstrained force-pushed the issue-27-multi-file-refactor branch from 132b685 to 8e85cf1 Compare March 19, 2025 22:05
@Deconstrained Deconstrained force-pushed the issue-27-multi-file-refactor branch from ac2118b to 44f0f99 Compare April 7, 2025 19:23
@Deconstrained Deconstrained force-pushed the issue-27-multi-file-refactor branch from 44f0f99 to 9716538 Compare April 7, 2025 19:31
@Deconstrained Deconstrained force-pushed the issue-27-multi-file-refactor branch from 9716538 to 8b395ea Compare April 7, 2025 19:33
@Deconstrained Deconstrained force-pushed the issue-27-multi-file-refactor branch from 84534c2 to 41a9c49 Compare April 7, 2025 20:44
@Deconstrained Deconstrained force-pushed the issue-27-multi-file-refactor branch from 41a9c49 to 478dde3 Compare April 7, 2025 21:12
The original issue in #38 was not caused by the lack of a return statement but by the docstring specifying a string-type return value.
…mespace

This is for backwards compatibility and so that links render properly in doc builds.
@Deconstrained Deconstrained force-pushed the issue-27-multi-file-refactor branch from 0a9593e to eda166d Compare April 7, 2025 21:38
@Deconstrained Deconstrained force-pushed the issue-27-multi-file-refactor branch 2 times, most recently from ea25237 to 3468737 Compare April 7, 2025 22:12
@Deconstrained Deconstrained force-pushed the issue-27-multi-file-refactor branch from 3468737 to f7df93f Compare April 7, 2025 22:22
@Deconstrained Deconstrained force-pushed the issue-27-multi-file-refactor branch from f7df93f to 7687e1f Compare April 7, 2025 22:28
The return value is the same as send_change_event which is expected to always return None.
@Deconstrained Deconstrained force-pushed the issue-27-multi-file-refactor branch from 7687e1f to c92605d Compare April 8, 2025 16:29
Interros are not permitted in user-agent headers per specification.
@Deconstrained Deconstrained force-pushed the issue-27-multi-file-refactor branch from c92605d to a107946 Compare April 8, 2025 16:58
@Deconstrained Deconstrained merged commit 6019275 into main Apr 8, 2025
13 checks passed
@Deconstrained Deconstrained deleted the issue-27-multi-file-refactor branch June 4, 2025 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants