Skip to content

Conversation

@jonavellecuerdo
Copy link
Contributor

@jonavellecuerdo jonavellecuerdo commented Sep 11, 2023

What does this PR do?

Introduce a module (feed.py) containing classes for creating
two types of XML feeds--PeopleXmlFeed and ArticlesXmlFeed to improve code coherency.
Encapsulating the previously 'loose' functions in app.py into these two classes results in
cleaner and more readable code, which will make it easier for future developers to maintain
and/or introduce new features to the Carbon application.

Helpful background context

  • feed.py Consists of a 'base' XML feed class that is used by the PeopleXmlFeed' and ArticlesXmlFeed` subclasses.

How can a reviewer manually see the effects of these changes?

  1. Clone the repo.
  2. Check into this branch IN-907-define-feed-classes.
  3. Create a new virtual environment.
  4. Install dependencies: make install.
  5. Run linters: make lint.
  6. Run test: make test.

All tests should pass, and since carbon.app.FileWriter and all pytest tests have been updated to use the XML feed classes, it's safe to say that the XML feed class methods work as expected!

Includes new or updated dependencies?

NO

Developer

  • README is updated to reflect all changes as needed
  • All related Jira tickets are linked in commit message(s)

Code Reviewer

  • The commit message is clear and follows our guidelines
    (not just this pull request message)
  • There are appropriate tests covering any new functionality
  • The documentation has been updated to reflect all changes or is not needed
  • The changes have been verified
  • New dependencies are appropriate or there were no changes

@jonavellecuerdo jonavellecuerdo self-assigned this Sep 11, 2023
@jonavellecuerdo jonavellecuerdo force-pushed the IN-907-define-feed-classes branch from 00c9fec to 8f08aa0 Compare September 11, 2023 16:33
Why these changes are being introduced:
* Improve code coherency by encapsulating functions for creating
and running XML feeds in classes based on feed type.

How this addresses that need:
* Update app module to use XML feed classes
* Rename classes in app module:
   * Writer -> FileWriter
   * PipeWriter -> ConcurrentFileWriter
   * FtpFileWriter (fka FTPReader) -> FtpFile
* Move tests for helper functions to test_helpers.py

Side effects of this change:
* None

Relevant ticket(s):
* https://mitlibraries.atlassian.net/browse/IN-907
@jonavellecuerdo jonavellecuerdo force-pushed the IN-907-define-feed-classes branch from 8f08aa0 to 0ff26a2 Compare September 11, 2023 16:46
@jonavellecuerdo jonavellecuerdo marked this pull request as ready for review September 11, 2023 16:49
Copy link
Contributor

@ehanson8 ehanson8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, a few questions

Copy link
Contributor

@ehanson8 ehanson8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Continues to look better and better!

@jonavellecuerdo jonavellecuerdo merged commit 22a70a7 into main Sep 12, 2023
@jonavellecuerdo jonavellecuerdo deleted the IN-907-define-feed-classes branch September 12, 2023 17:14
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