Skip to content

Assorted uplifts #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 23 commits into
base: main
Choose a base branch
from

Conversation

ned9
Copy link

@ned9 ned9 commented Jun 9, 2025

A range of uplifts to the codebase:

pyproject.toml & poetry.lock

  • add Python 3.13 support
  • remove Python 3.9 and 3.10 support (numpy dropped 3.10 support with the recent 2.3.0 release)
  • adopt Poetry's new recommended defaults of using [project] rather than [tool.poetry]
  • remove mypy, flake8, and black (added ruff as a pre-commit hook instead)
  • remove requests as dependency, as it wasn't being used
  • replace unconstrained * version specifiers for dependencies with locked major versions
  • update all dependencies

other changes:

  • fix bug in test_dimensionality_reducer test
  • mark test_dimensionality_reducer test as skipped initially, so that tests can go green after completing first exercise
  • move the location of run_analysis.py to the top level directory, which is a less surprising location for workflow runner, and will ensure that the package has been installed correctly (and not succeeding just because it's in the same directory as the political_party_analysis module)
  • add pre-commit hooks: ruff formatter and linter, as well as selection of other sensible hooks
  • add a selection of helpful things to .gitignore
  • improve type annotations in loader.py, visualization.py, and dim_reducer.py
  • clean up path handling in run_analysis.py and loader.py

@ned9 ned9 changed the title Assorted upliftscccccdcfvnuinffkhblvuveienhntnjlvtteuieehnlr Assorted uplifts Jun 9, 2025
Copy link

@natelee-tw natelee-tw left a comment

Choose a reason for hiding this comment

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

Ned, thank you so much for improving this!!

Choose a reason for hiding this comment

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

Wondering should we specify in the README that the entry path is /run_analysis.py? I think sometimes candidates could be searching for main.py

##### YOUR CODE GOES HERE #####
pyplot.savefig(Path(__file__).parents[1].joinpath(*["plots", "left_right_parties.png"]))
pyplot.title("Lefty/righty parties")
plt.title("Lefty/righty parties")

Choose a reason for hiding this comment

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

I think since we have commented out the code for dim_reduced_data charts above, should we also comment out these codes?

@@ -1,43 +1,46 @@
from pathlib import Path

from matplotlib import pyplot
import matplotlib.pyplot as plt

from political_party_analysis.loader import DataLoader

Choose a reason for hiding this comment

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

As run_analysis.py is now in root directory, rather than src/, the import should be from src.political_party_analysis.loader import DataLoader

Copy link

@natelee-tw natelee-tw Jun 17, 2025

Choose a reason for hiding this comment

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

Since run_analysis.py is in repo root now, maybe we could remove "political_party_analysis" folder and simply move the files to src/? (i.e. import from src.loader)

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.

3 participants