Skip to content

Add UV for project management, Ruff for formatting.#1391

Open
phalt wants to merge 6 commits intomasterfrom
use-uv
Open

Add UV for project management, Ruff for formatting.#1391
phalt wants to merge 6 commits intomasterfrom
use-uv

Conversation

@phalt
Copy link
Member

@phalt phalt commented Feb 3, 2026

This is the first part of #1390

UV package manager

uv is fast becoming the standard for managing an entire Python project. It handles package management, environment management, tool management etc. It's great.

The first commit introduces it. We also add pyproject.toml which is the new project dependency standard by Python. It replaces requirements.txt and other configurations.

Ruff auto formatting

Ruff is a Python code formatter. It is super fast, and like uv becoming the standard.

The second commit is the "auto" formatted changes - there were very few.

Ruff manual formatting

This is the big commit. I had to manually go and update all the poorly formatted code in the entire project. Read the commit to see the summary of the changes.

Docker changes

I'm not the best at Docker, but I finally got it working. Changes are mostly around using uv properly.

postgres job

This job used to run in Docker. For some reason it now hits memory limits. I've decided to just shift this to use "bare metal" and achieve the same result.

AI support

For the very very large files, I made 3-4 changes, then asked a coding agent to "copy the changes I did for the rest of the file to fix the import errors". Then I verified it by manually reading the diff

Proof it works

  • Formatting passes
  • Tests pass
  • Serve can be ran locally
  • make build-all works still
  • All the docker commands work.

@phalt phalt force-pushed the use-uv branch 4 times, most recently from c6fbdf7 to 1952c6c Compare February 3, 2026 13:34
@phalt
Copy link
Member Author

phalt commented Feb 3, 2026

So, turns out we're hitting a memory limit on the github action when compiling the docker images, so I am going to figure out what to do there.

@phalt phalt force-pushed the use-uv branch 2 times, most recently from d5c573b to e407e93 Compare February 3, 2026 14:30
@phalt phalt requested a review from Naramsim February 3, 2026 14:43
@phalt
Copy link
Member Author

phalt commented Feb 3, 2026

Weirdly this job hung forever waiting for something to happen.

@phalt
Copy link
Member Author

phalt commented Feb 3, 2026

I think perhaps the k8s job isn't always supposed to run like this? cc @Naramsim

@phalt phalt force-pushed the use-uv branch 2 times, most recently from bb9897a to a9d9cb6 Compare February 3, 2026 16:17
@Naramsim
Copy link
Member

Naramsim commented Feb 4, 2026

hi! Give me some time to take a look into this. I wasn't expeting a overhaul. I'll have to look into these new tools and confirm they are become the standard.

Regarding the GH Action, I'll try to look into it. The k8s job probably is failing because you didn't update the k8s configuration files. I'll take a look.

Secondly, the Postgres job is useful for, as you said, testing (and documenting) how to dump and load the database. I think every functionality of PokeAPI should be tested and having some test files that document how to actually do something is the best.

@phalt
Copy link
Member Author

phalt commented Feb 4, 2026

I've not set up and used k8s myself before so testing and debugging is slow going.

RE: Postgres job. Does it have to be done via docker? If so, I think porting it to circle CI so I can provision a bigger runner is the best course? It keep hitting memory limits. GitHub runner options are limited.

@Naramsim
Copy link
Member

Naramsim commented Feb 4, 2026

No need to run it on Docker

@phalt
Copy link
Member Author

phalt commented Feb 4, 2026

Postgres job rewritten to use bare metal instead of docker, now works :)

phalt added 4 commits February 5, 2026 11:11
Context:

- Far more modern, easier environment management
- I have tested all makefile commands work
Context:

- This commit includes automatic formatting additions
Context:

- This is a big change, but it is functionality identical
- Explicit imports for some files make the diff very large
- I set line length to 120 which is standard in Python
- Some files used tabs instead of spaces (!) - now fixed
phalt added 2 commits February 5, 2026 12:00
Context:
- We needed to explicilty include psycopg-binary here
- Rest of the changes are just replacements of python -> uv run
Context:
- With the Docker config we hit a memory limit in Github actions
- This alternative approach uses "bare metal" and still works
@phalt
Copy link
Member Author

phalt commented Feb 5, 2026

@Naramsim All tests passing now. Reorganised the commits to be distinct. Best reviewed commit by commit.

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