-
Notifications
You must be signed in to change notification settings - Fork 427
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
build2023/switch to pyproject #240
build2023/switch to pyproject #240
Conversation
Thanks @baggiponte! Let me first answer your questions:
The core library comes with some pre-defined prompts, Colang flows and examples that are loaded by default into the server interface, if you don't specify a configs folder. Hence why we need to include the additional files. Also, the
Not sure. It might make more sense to have a
No strong reason here. We just used a piece of code that used Next StepsRegarding the next steps:
Let's leave this for now. We're not using pylint as part of CI just yet.
I'll need to look into this. I haven't used ruff.
Yes, that should work. We don't yet have 100% code coverage with the tests, so there is still a risk that something might break. But the critical part should be covered.
We don't expect dependencies to change a lot. If anything, we want to simplify and have as few as possible. So, let's stick with the Thanks again for putting the effort to make this conversion! |
Should we merge this and have a separate PR to relax the dependencies? |
Hey, sorry for the late reply. A bit busy, will get back to this later this week if you don't mind. |
👋 I had actually prepared a similar PR before noticing this had already been done although I think this is better as I'd also switched to hatchling for build as I wasn't as well versed in setuptools so its much nicer to change fewer things! My motivation for the PR was that we're also unable to use the project in its current state due to the pinned dependency versions so we're currently experimenting with a fork right now. That all said I'd be a big +1 on the approach of either having a [core] which was a reduced set and removed the server deps, OR moving the server deps out to a [server] package - I guess that just depends on how core to the product you see the server component |
Hi @drazvan, finally have some time to get back to this. I agree, the dependencies constraints should be a separate PR. About ruff: if you like, I can add it now, otherwise it can be a separate PR. I checked the develop branch and I am still on par with that. Let me know if I should rebase against another branch. Thanks! |
Oh definitely, in the PR it might also be appropriate to include whether you want to split dependencies. It's really straightforward, can do that. |
Hello there! Finally had time to work on #234. I realised that to fully address the issue, I need to first switch the previous settings to a pyproject.toml-based configuration, then start working on the constraints.
Changes
And replaced their contents with a single
pyproject.toml
file, following these guides:[python -m] pip install ".[dev]"
version
property to be read directly fromnemoguardrdails.__version__
so you just have to change it in one place.setuptools
from the dependency list.watchdog
to core dependencies.How to test
All tests run successfully, yay!
To test whether the new setup works, we should push a release to TestPyPI. I don't know what schema you should use. Might just be a dev release like
0.6.1.dev<whatever>
since it's just a throwaway.Questions
pip install nemoguardrails[cli]
? This would allow to remove starlette, watchdog, fastapi, uvicorn and typer out of core dependencies.Next steps
<=
constraint for that lib. Do you think this might work?Packaging info
Python PEP 517 and 518 specify the behaviours of packaging frontends and backends. Backends like setuptools are what builds the wheels behind the curtains. Frontends usually provide a unified interface (see here) to work with backends, publish packages, manage virtualenvs and other amenities. Frontends that comply with PEPs will be compatibile with any backend.
To the best of my knowledge, PDM is the most feature-complete frontend that complies with PEPs. But this project does not really need to make a switch if the dependencies won't change much in the near future.
This is why I left setuptools as backend. This means the project can be managed as you used to: just add new dependencies by hand to the
pyproject.toml
'sdependencies
oroptional-dependencies
table(s).In the future, if using pip + venv + setuptools + twine (to publish the package) is too much, you can always switch to PDM. It will require some small changes to pyproject.toml, but not many.