-
Notifications
You must be signed in to change notification settings - Fork 493
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
[Feature Requests] Better integration with standard tooling #1466
Comments
Thank you @jlopezpena for writing up such a detailed proposal. As a user, these are all changes I want as well. |
Regarding use of
|
Interesting. The only reference I could find in I have been using @jph00 I understand if you don't feel like rehashing an old debate and your vision for |
Thanks @jlopezpena -- anything to increase compatibility with modern python tooling would be welcome, as long as it doesn't add significant new deps or remove compatibility with classic python tooling and can support at least py38 ootb. It sounds from your experience like that might now be possible, so I'm happy to re-open that discussion. The challenge I'm not sure about is how to deal with the lack of toml support in the stdlib. How do we ensure nbdev works in CI and I definitely do not want to require folks to use uv or poetry BTW, although I'm happy if we can provide tools that also help those users. |
Thanks for you response! The way I made my changes no additional dependencies would be required. Even for newer python, my intention was not to replace the current system using The way I'd do this would be by creating a subclass of For people using For the sake of simplicity, I'd implement the subclassing of |
Regarding |
OK that all sounds pretty good! I'd be happy to look at PRs to add this.
Ideally, can we please aim to minimise the amount of code, that's written
for this, and particularly to minimise the amount of code in each PR (i.e
if it's reasonably convenient to break it into smaller pieces, please do
so). I'm not smart enough to understand large chunks of code -- although
notebooks that lay things out in small bits with plenty of examples
certainly helps!
… Message ID: ***@***.***>
|
Hello and thanks for considering better uv support for nbdev. I am new to nbdev and really feel that it is very underrated also for single person teams to make massive progress fast. On thing that still bugs me is the use of I can also use (venv) ➜ nbproject git:(main) ✗ uv add --editable nbproject
error: Requirement name `nbproject` matches project name `nbproject`, but self-dependencies are not permitted without the `--dev` or `--optional` flags. If your project name (`nbproject`) is shadowing that of a third-party dependency, consider renaming the project. so currently i am running uv add --editable --dev nbproject but am not 100% sure this is actually working with the perfect way to do things and would appreciate it a lot if someone with more fundamental understand of both uv and nbdev can take a look. I also have to add a license to pyproject.toml for |
Been using extensively
nbdev
over the last couple of weeks, and have identified a few quirks that bug me. This issue is to collect them so that they don't get lost. If the devs are open to these features, I could even contribute some PRs myself.Long story short, I have been trying hard to integrate
nbdev
with other tools that enable what are considered "best practices" in the community, namely I have been working on some repos usinguv
as a package and environment managerruff
for linting and formattingmypy
for type checking (untilruff
finished their work on thered-knot
module!)deptry
for dependency QAnbQA
to be able to run some of these tools on notebooksFirst hurdle I experienced was the duplication of settings data. Modern tooling relies on
pyproject.toml
for their settings, whereasnbdev
usessettings.ini
instead. Most of thenbdev
settings get loaded in thesetup.py
file, which can be used together withpyproject.toml
by defining the build-system assetuptools
, but I'd rather use more modern alternatives likehatchling
.So, I tried moving as many settings as possible from
settings.ini
topyproject.toml
, and (much to my surprise) I found I could safely move almost all of them and still get the core functionality ofnbdev
working. Besides allowing for using modern tooling, this has the additional benefit of bootstrappingnbdev
for new projects: with this setupnbdev
can be declared to be a dev dependency instead of requiring to be installed at some outside place. This allows to run everything from a virtual environment created byuv
. The thing that one would "lose" would be the capability of creating a new project withnbdev_init
(but that can be sorted by using a package template to either clone or use withuv init
).The remining minimal set of options I need left in
settings.ini
to usenbdev
is so barebones that I think there would be no big loss of functionality if all those settings were to be loaded from a[tools.nbdev]
section inpyproject.toml
.I have a very early stages simple project template showcasing how I got my setup to work (still very much WIP as I keep finding quirks when using that setup with real projects).
So, here is a list of changes I'd like to see (and can potentially help to implement if core devs agree with the vision):
nbdev
to read settings frompyproject.toml
and delegate the dependency management to other toolsnbdev_export
command so that:ruff
as it can change the import orderingruff format
(or any other formatter) to prettify the generated source (instead of black)Does this resonate with the core devs vision for the project and the community needs? Any feedback either here or in my template much appreciated!
The text was updated successfully, but these errors were encountered: