FastUI icon indicating copy to clipboard operation
FastUI copied to clipboard

Add rye and ruff, and local dependency for CI and development

Open ManiMozaffar opened this issue 9 months ago • 25 comments

I'm going to write tests with playwright, but before doing that, I found repo a bit messy.

~~So I used PDM as it's conventional tool in pydantic team~~ Samuel asked to use rye instead.

I added some # type ignore, because this PR was not meant to fix all types.

~~about Playwright and ui test, since they usually take quite long time to pass, might make more sense to use "pre push hook" instead of pre commit? I find it very annoying to have some browser running on every commit :) (ofc I can ignore it, till last push, but that's also annoying hahaha)~~

From samuel input, which I also very agree with, we don't need to run playwright tests on any git hooks. Only in CI :) and also a way to execute it manually. Will engineer this in next PR

ManiMozaffar avatar Apr 28 '24 14:04 ManiMozaffar

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

:loudspeaker: Thoughts on this report? Let us know!

codecov[bot] avatar Apr 28 '24 15:04 codecov[bot]

@sydney-runkle lmk if you agree with these changes ^ and your ideas about what i just said in my first comment so I can then start working on playwright tests :)

ManiMozaffar avatar Apr 28 '24 15:04 ManiMozaffar

hi @ManiMozaffar thanks so much for contributing.

I have a few thoughts:

  • please lets not use PDM, we use it on Pydantic due to the complex set of dependencies but I really don't love it - I'd suggest using rye, or sticking to what we have now
  • Playwright tests, while useful, can be pretty frustrating - let's keep the number to a minimum
  • let's run playwright tests on CI, and of course via a make command, no need for anything else

(btw, we don't really have a default packaging choice right now - pydantic uses PDM, pydantic-core uses pure pip, internal stuff uses poetry, things we're about to release use rye)

samuelcolvin avatar Apr 28 '24 16:04 samuelcolvin

Let's not switch package manager at the same time as adding playwright tests.

samuelcolvin avatar Apr 28 '24 16:04 samuelcolvin

Hey samuel, thanks for quick check.

please lets not use PDM, we use it on Pydantic due to the complex set of dependencies but I really don't love it - I'd suggest using rye, or sticking to what we have now

Agreed. I was wondering why you're not using rye in pydantic. I can rework PR to use rye instead. Makes much more sense. That pip dependency was kinda bad IMO.

Playwright tests, while useful, can be pretty frustrating - let's keep the number to a minimum

I also asked Sydney some days ago, she also agreed to write test. Playwright is much better than selenium and other alternatives as for my experience, being frustrating depends on the what you test, and how much you test. Testing at correct amount with correct approach, wouldn't be frustrating to maintain. frustrating to run? maybe. that's why I was kinda against running it on pre commit hook.

Let's not switch package manager at the same time as adding playwright tests.

That's why I made this PR. To first decide about package manager, then continue with writing test. Sorry for the branch name, should have renamed it.

ManiMozaffar avatar Apr 28 '24 16:04 ManiMozaffar

@samuelcolvin, did you consider using https://github.com/prefix-dev/pixi?

Zaubeerer avatar Apr 29 '24 06:04 Zaubeerer

Hey @ManiMozaffar,

Thanks for your work here! I can review this thoroughly this afternoon - stay tuned!!

sydney-runkle avatar Apr 29 '24 13:04 sydney-runkle

@ManiMozaffar,

Ah shoot, sorry, in my queue for first thing tomorrow :).

sydney-runkle avatar Apr 30 '24 00:04 sydney-runkle

A bit more research into rye, found this: https://lucumr.pocoo.org/2024/2/15/rye-grows-with-uv/

According to Armin Ronacher, rye and uv eventually converge into one. So the decision to choose rye might have not been the best there. But I think it might make more sense to just keep using rye for now as it's already there, and if in future rye converge into uv, migrate to uv.

ManiMozaffar avatar Apr 30 '24 10:04 ManiMozaffar

@ManiMozaffar,

Should we use uv instead?

sydney-runkle avatar Apr 30 '24 18:04 sydney-runkle

@ManiMozaffar,

I guess we're using a combo in https://github.com/pydantic/logfire, so we could always migrate to uv down the line.

sydney-runkle avatar Apr 30 '24 18:04 sydney-runkle

Ah also, looks like there are some changes with the __init__.py file with the components, likely due to my docs additions.

sydney-runkle avatar Apr 30 '24 18:04 sydney-runkle

Ok great, I'll rebase the branch tomorrow and do the changes requested @sydney-runkle

ManiMozaffar avatar Apr 30 '24 19:04 ManiMozaffar

@sydney-runkle build docs fails. I don't have the "PPPR_TOKEN", so I can't test and debug it locally. I'm not even sure why it's failing, it said it requires black to function, so maybe pip install black would solve it? but then why didn't it happen before this PR? i think the diagnostic might be wrong.

ManiMozaffar avatar May 01 '24 13:05 ManiMozaffar

@sydney-runkle build docs fails. I don't have the "PPPR_TOKEN", so I can't test and debug it locally.

Ah yes, this is a barrier we need to work on. This is bc of the documentation PR that I merged recently. The local failure makes sense, but I'm not sure why it's failing on CI. I'll look into this!

sydney-runkle avatar May 01 '24 20:05 sydney-runkle

@ManiMozaffar,

Are you able to repro the lint failure locally at least?

sydney-runkle avatar May 01 '24 20:05 sydney-runkle

@ManiMozaffar,

Are you able to repro the lint failure locally at least?

No image

ManiMozaffar avatar May 01 '24 20:05 ManiMozaffar

What if you try make install first to make sure that your versions are lined up?

sydney-runkle avatar May 01 '24 20:05 sydney-runkle

Looks like the docs are failing on other PRs as well, so I need to fix that 🤧

sydney-runkle avatar May 01 '24 20:05 sydney-runkle

Will work on the docs fix tonight. Might end up disabling the typescript docs for now until mkdocstrings-typescript has a public version.

sydney-runkle avatar May 01 '24 20:05 sydney-runkle

@ManiMozaffar,

This should fix the docs issue (I'm hoping): https://github.com/pydantic/FastUI/pull/299.

sydney-runkle avatar May 01 '24 23:05 sydney-runkle

@ManiMozaffar,

You should be able to rebase now :).

sydney-runkle avatar May 02 '24 13:05 sydney-runkle

@sydney-runkle still lint fails, not sure why. can't reproduce it locally.

ManiMozaffar avatar May 04 '24 16:05 ManiMozaffar

Screenshot 2024-06-03 at 22 53 48

Rebased again, still happens, still can't reproduce it :/ What this is actually checking? @sydney-runkle

ManiMozaffar avatar Jun 03 '24 20:06 ManiMozaffar

For completeness I think this link belongs here: https://github.com/astral-sh/rye/discussions/1164#discussioncomment-9812734

Seems like rye would be mostly in maintenance mode

elephantum avatar Aug 24 '24 09:08 elephantum