Skip to content

Modernize tooling: uv + Selenium 4 - #7

Open
benpetty wants to merge 1 commit into
mainfrom
chore/modernize-tooling
Open

Modernize tooling: uv + Selenium 4#7
benpetty wants to merge 1 commit into
mainfrom
chore/modernize-tooling

Conversation

@benpetty

Copy link
Copy Markdown
Owner

Summary

  • Replaces Pipenv with uv (pyproject.toml + uv.lock)
  • Bumps Selenium 3.141 → 4.x and rewrites all find_element_by_* call sites to the find_element(By.*, ...) API
  • Fixes a latent crash in RadioNatTurner.__init__ (os.mkdiros.makedirs(..., exist_ok=True))
  • Replaces the one-line extensionless README with a proper README.md
  • Extends .gitignore with Python build artifacts and .worktrees/

This gets the project off two EOL stacks (Python 3.9 + Selenium 3) in a single atomic change while preserving behavior end-to-end.

What changed

Tooling

  • pyproject.toml — PEP 621 metadata, hatchling build backend, declares scrape console-script entry point
  • uv.lock — pinned resolution (replaces Pipfile.lock)
  • Pipfile, Pipfile.lock, requirements.txt, requirements-dev.txt
  • 🔧 Makefile
    • make installuv sync --extra dev
    • make scrapeuv run scrape
    • Added uv to the required-bin check alongside geckodriver
    • Added export so .env values propagate to subprocesses
  • 🔧 Minimum Python bumped to 3.12

Selenium 4 migration (scrape/radio_nat_turner.py)

  • All six find_element_by_* / find_elements_by_* calls rewritten to find_element(By.*, ...)
  • Dropped unused imports: random, Select, strip_accents

Bug fix

  • RadioNatTurner.__init__ no longer crashes on first run when the parent data/ directory doesn't exist (os.mkdiros.makedirs(..., exist_ok=True))

Docs / hygiene

  • Replaced the extensionless README with README.md (install / config / usage / layout / how it works / known limitations)
  • Added Python build artifacts (__pycache__/, *.pyc, dist/, build/, *.egg-info/) and .worktrees/ to .gitignore

Test plan

  • uv sync --extra dev resolves cleanly on Python 3.12, locks Selenium 4.44.0
  • All package imports succeed under Selenium 4 (scrape, RadioNatTurner, Writer, ExitStatus, ProgressBars, strip_accents, get_track_filename)
  • uv run scrape reaches main() and prints the banner + URL list
  • End-to-end download of one category (deferred — requires the site password and is out of scope for tooling verification)

Notes for review

  • Dependabot alerts on main (34 across Pipfile.lock / requirements*.txt) should drop to zero after merge — the files those alerts target are deleted here. uv.lock will become the new alert surface going forward.
  • No retry cap on 429 and silent empty password remain known limitations (documented in README.md) — both pre-date this PR and weren't in scope for tooling modernization.

Replaces the Pipenv + Selenium 3 setup with `uv` and Selenium 4 to get
the project off two EOL stacks. Behavior is preserved end-to-end; only
the dependency manager, Selenium API surface, and one latent bug change.

Tooling
- Replace `Pipfile` / `Pipfile.lock` / `requirements*.txt` with
  `pyproject.toml` (PEP 621, hatchling build backend) and `uv.lock`.
- Rewire `Makefile` to call `uv sync` / `uv run scrape`; require `uv`
  alongside `geckodriver` in the bin-check. Add `export` so `.env`
  values reach the child process.
- Bump minimum Python to 3.12 in `pyproject.toml`.

Selenium 4 migration (`scrape/radio_nat_turner.py`)
- Bump `selenium` to `>=4.27`; remove the now-deprecated
  `find_element_by_*` calls in favor of `find_element(By.*, ...)`.
- Drop unused imports: `random`, `Select`, `strip_accents`.

Bug fix
- `RadioNatTurner.__init__` now uses `os.makedirs(folder_name,
  exist_ok=True)` instead of `os.mkdir`, so the first run no longer
  crashes when the parent `data/` directory doesn't exist.

Docs / hygiene
- Replace the one-line extensionless `README` with a proper
  `README.md` covering install, configuration, usage, project layout,
  and known limitations.
- Extend `.gitignore` with Python build artifacts and `.worktrees/`.
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.

1 participant