Skip to content

Conversation

@vasilmax
Copy link
Collaborator

Description

Updated the project to use the uv package package manager and its toolset to install python
Updated the project to use the pnpm package manager and its toolset to install node
Added docker for postgresql and redis

Fixes # (link issue)

Type of change

  • Updated README.md
  • Added docker-compose.yml

@d33bs d33bs self-requested a review June 11, 2025 20:42
Copy link
Collaborator

@d33bs d33bs left a comment

Choose a reason for hiding this comment

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

Nice job - cool to see this added. I left a few comments for your consideration. Please don't hesitate to let me know if you have any questions.

README.md Outdated
4. **PostgreSQL:** A running PostgreSQL database server (version 12+ recommended). You'll need the ability to create a database and a user. [Download PostgreSQL](https://www.postgresql.org/download/)
5. **Redis:** A running Redis server. Celery uses this to manage background tasks. [Download Redis](https://redis.io/docs/getting-started/installation/) or use Docker.
+6. **Node.js and npm:** For running the frontend application. Npm usually comes bundled with Node.js. [Download Node.js](https://nodejs.org/) (LTS version recommended). You can check your installation by running `node -v` and `npm -v` in your terminal.
1. **Python:** Version 3.13 or higher. [Download Python](https://www.python.org/downloads/)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need to download Python (would uv do this for us automatically)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nope, uv can manage install and manage python versions with uv install python 3.13 . This should be done after creating and activating the environment. You can use uv python list to see what's installed and available.

README.md Outdated
Use uv to install setup virtual environment.

```sh
uv python install 3.13 # Install python
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need to explicitly install a Python version (would uv select and install for us)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I imagine if you have python already installed system-wide, the venv uv creates would just use that. However after many broken system configs, I avoid installing python directly and let uv manage it entirely. This also avoids some puzzling errors I've encountered which I now believe were caused by conflicts with the build-in pip that's installed with the official python installer.

Jon originally used 3.10, but running through with 3.13 alongside updating the libraries seemed to work.

That is a great point though! I'll update the readme to better detail installation of python with uv. Do you think a .python-version file would help? As outputted by uv python pin

README.md Outdated
* **On macOS/Linux:**

```sh
source .venv/bin/activate
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would it be possible to avoid this step by using uv run when necessary?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You're right, using uv run should walk up the directory path until it finds a pyproject.toml, and is simpler. I'll remove the second pyproject.toml here /MOSS/Older Experiments/pyproject.toml .

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You're right, uv commands walk up the path tree until they hit a pyproject.toml , so it should work. I'll rename the other one at ./MOSS/Older Experiments/pyproject.toml just in case.

README.md Outdated
Install all the required Python packages listed in `pyproject.toml`:

```sh
uv sync
Copy link
Collaborator

Choose a reason for hiding this comment

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

Consider removing as this step is typically automatic when using uv.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yea ok. Would it makes sense to split the readme into 2 sections? One for just getting the project running, and the other for developing.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yea ok. Would it makes sense to split the readme into 2 sections? One for just getting the project running, and the other for developing.

I agree with this sentiment but the change should probably be done in a separate pr. this one is already quite long

README.md Outdated
Comment on lines 269 to 271
1. **Terminal 1:** Backend API Server (`uvicorn backend.main:app ...`)
2. **Terminal 2:** Celery Worker (`celery -A backend.celery_app worker ...`)
3. **Terminal 3:** Frontend Development Server (`cd frontend && npm run dev`)
Copy link
Collaborator

Choose a reason for hiding this comment

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

There's probably an opportunity to improve this by making the code here a run.sh script (we have almost as much code as we do natural language in these lines). Depending on how you feel you could possibly add that to this PR or we could bump this into a new issue and work on it later.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I too considered wrapping that in a script for this PR, but I wasn't sure whether to do it with a script and have different OS to consider/test, or add it to docker as well..

There is also the option of specifying it in pyproject.toml, which may be cleaner and closer aligned to a standardized approach. Here for instance, where they use taskipy task runner to start the rest (ex. https://github.com/leosussan/fastapi-gino-arq-uvicorn/blob/master/pyproject.toml)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I used poethepoet like you suggested, and it did work. However, the solution uses Shell tasks, as it seems parallel execution support is an open problem nat-n/poethepoet#24

My concern is this note in the docs:
By default poe attempts to find a posix shell (sh, bash, or zsh in that order) on the system and uses that. When running on windows, poe will first look for [git bash](https://gitforwindows.org/) at the usual location, and otherwise attempt to find it via the PATH, though this might not always be possible.

@@ -0,0 +1,27 @@
services:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Consider adding a comment to the top of the file to help describe what it does. We have that information within the readme but oftentimes when in development we are deep in the weeds of individual files, where it can help to have notes so as to not go searching for meaning elsewhere.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Okay, will do.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Seeing that you added this in - great!

Copy link
Collaborator

Choose a reason for hiding this comment

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

This comment is outside the bounds of this PR's focus. It might be a good idea for us to consider using Dependabot to help maintain the environment specifications for this project over time (esp. for Node and Python dependencies). uv-style pyproject.toml files aren't yet supported but likely will be in the future.

Copy link
Collaborator

Choose a reason for hiding this comment

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

using Dependabot is a great idea! we should create an issue for this so it doesn't get forgotten.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Cheers - let's add this in for later work: #48

main.py Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

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

This looks like it might have been a test file. Consider removing if we don't need it any longer. If we do still need it, consider placing in a source code directory where appropriate.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think this is actually the default file that is created with uv init . The backend shouldn't serve that though, so we can remove it. Towards production we should add a 404 page and look into locking down the backend.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Seeing that this was removed - nice, thanks for addressing this!

README.md Outdated
## Frontend Setup and Running
```sh
ur run uvicorn backend.main:app --reload --host 0.0.0.0 --port 8000
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
ur run uvicorn backend.main:app --reload --host 0.0.0.0 --port 8000
uv run uvicorn backend.main:app --reload --host 0.0.0.0 --port 8000

README.md Outdated
npm run dev
```sh
pnpm dev
Copy link
Collaborator

Choose a reason for hiding this comment

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

When trying to run this I ran into the error:  ERROR  packages field missing or empty. It's possible I did something wrong but I wanted to bring it up just in case there's a need to update the pnpm-workspace.yaml or similar.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added the packages field, so hopefully that helps. Let me know!

@d33bs
Copy link
Collaborator

d33bs commented Jul 5, 2025

Hi @vasilmax - just wanted to double check, is this ready for another review? If so, feel free to respond here or re-request a review using the "reviewers" pane in the top right of the GitHub PR web interface. Please also don't hesitate to let me know if I can follow up on anything in particular before that point.

@vasilmax
Copy link
Collaborator Author

vasilmax commented Jul 7, 2025

Hi @vasilmax - just wanted to double check, is this ready for another review? If so, feel free to respond here or re-request a review using the "reviewers" pane in the top right of the GitHub PR web interface. Please also don't hesitate to let me know if I can follow up on anything in particular before that point.

Hi @d33bs, thanks for following up! I was preoccupied over the weekend but did start on the changes last night. I will make a commit with the updates by eod today and will re-request your review once I push. Really appreciate your knowledge and expertise!

@df0o
Copy link
Collaborator

df0o commented Jul 8, 2025

just some minor changes to the readme, otherwise looks good to me. i tried following through the setup process and it runs no issues for me 👍

@vasilmax vasilmax requested review from d33bs and df0o July 8, 2025 14:53
@vasilmax vasilmax marked this pull request as ready for review July 8, 2025 23:18
Copy link
Collaborator

@df0o df0o left a comment

Choose a reason for hiding this comment

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

lgtm 👍

Copy link
Collaborator

@d33bs d33bs left a comment

Choose a reason for hiding this comment

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

Excellent work @vasilmax !

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks - looks like these errors and warnings no longer appear!

@@ -0,0 +1,27 @@
services:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Seeing that you added this in - great!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Cheers - let's add this in for later work: #48

main.py Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

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

Seeing that this was removed - nice, thanks for addressing this!

requires-python = ">=3.13"
license = { text = "Apache-2.0" }
authors = [
{ name = "The MOSS Authors", email = "[email protected]" },
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just double checking here: will Jon be the coordinating author for all on this project? As-is, that's how this entry into the authors field looks. I think we can also subtract the email value, leaving this a bit more vague in terms of who to contact (perhaps that should be the repository, openly?).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yea that's a great suggestion! I'll open an issue regarding the author's field and its format so we can discuss at the next meeting.

"python-louvain>=0.16",
]

[tool.poe.tasks]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice! In testing all of these I found they worked beautifully, great job!

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.

4 participants