-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Remove dependency on npm? #1014
Comments
In Nixpkgs we build in a sandbox, and define exactly what needs to be fetched where. Fetching stuff from the web like that is not possible and simply bad practice. Introduced in #809. Similar issue here with another package holoviz/panel#1819. |
Revert again as we did before. This wants to fetch from the web with npm. readthedocs/sphinx_rtd_theme#1014 This reverts commit 24d78e7.
There is some background here in a few other issues. We are moving away from storing generated CSS/JS assets in the repository, and instead building assets will be entirely a release procedure. Our releases to PyPI will therefore have the built assets, but if you are trying to use this repository directly, or in your case are building from source, you will need to build the assets. Storing the built assets in this repository has proved to be very problematic for maintenance and for releases. I'm not sure if there is a good middle ground for your use case, but I'm open to suggestions. |
I agree with not storing build assets in the repository, but it would be great to store those build assets in the PyPI tarballs so that you can download a release and build from source without needing npm. Is that possible? |
Great, yeah if you can use the source tarball, I think there was just an issue with it during the last release, or we didn't configure it correctly -- but it was our intention to have all of the PyPI release artifacts include the compiled assets. We can aim to resolve this in the next release. |
We typically prefer to build entirely from source, but given it is generally hard to deal with packages of multiple ecosystems I think including the assets in the sdist is indeed a good middle ground. Anyway, I do recommend moving this code out of the |
A new release is out (0.5.1) https://pypi.org/project/sphinx-rtd-theme/ the static files should be there, let us know if that's what you expect. |
@stsewd If I download 0.5.1 from PyPI or GitHub and run: $ python setup.py build # or install it errors out with:
I see the expected files in |
If I set the |
I think those commands should be moved to a make file or Lines 16 to 83 in f6554bf
/cc @agjohnson |
We already have this scripts in package.json, and we commit the static files in the repo. Close #1014
We already have this scripts in package.json, and we commit the static files in the repo. Close #1014
So, looks like we are moving to not have the static files in the repo, but we won't override the default build command, so you can download the source from pypi and install it manually. Users installing from github should/would be warned that they'll need to run npm to generate the assets. |
I agree with not having static files in the repo, as long as those files are in release tarballs on GitHub and PyPI. Has the |
@adamjstewart that is being done in #1039 |
@adamjstewart also, the other part to this discussion that @stsewd and i had about this change: core team discussed these changes a while back and came to the conclusion that we want to replace installation from git with more frequent development releases. So if you are currently installing from |
Nah, we're not installing from |
In a completely different direction, https://github.com/pradyunsg/sphinx-theme-builder adds an explicit dependency on npm, such that it can be managed by redistributors in a consistent manner across Sphinx themes. It has a clearly defined contract (build-time installation of npm dependencies declared in Furo, pydata-sphinx-theme and sphinx-book-theme all use this and (so far) the feedback from the maintainers as well as redistributors has been generally positive. It doesn't do away with "oh, never access the network" model, that certain redistributors would like to have -- but it does make it such that all the dependencies are declared explicitly and can be provided by the redistributor themselves. If they can't do that today, we can "solve" it in one place for all the Sphinx themes that use a JS-based build pipeline (like they should, given that they're basically web frontend projects). |
If I am correct it consists essentially of the following steps:
This looks good to me. Is the How is the required npm version declared? I imagine this to be project-dependent. |
The workflow is typically See the pyproject.toml file in any of the themes -- you need to specify a key for declaring the NodeJS version. The nodeenv is not shipped in any distribution files. |
We need to isolate the part doing the network access hence I was trying to see what steps
I now see the relevant section, thank you. https://github.com/executablebooks/sphinx-book-theme/blob/af6277a7276112ee915d901984193c49e56d5a76/pyproject.toml#L5 |
That would be the step that creates the nodeenv and run You can tell stb to use a local NodeJS instead of downloading a release when creating the nodeenv, by setting |
I guess, if you want to isolate the network access steps, you can do this:
|
With sphinx-theme-builder's use of nodeenv and its use of compiled binaries provided by the NodeJS release team, a build from source would not be required on platforms supported by the NodeJS team. Unsupported platforms will attempt a build, which may fail -- but that's no different from the status quo. |
Well, I came here to say that I think sphinx-theme-builder solves the problem that you're trying to solve here, and that I recommend using that. I've suggested it to RTD folks before, so I'm not going to try and push for adoption here. If they do decide to go ahead and adopt it, I'll be happy to help. :) |
@FRidh FYI: I just wrote this today -- https://sphinx-theme-builder.readthedocs.io/en/latest/build-process/ :) |
Great, thank you! |
I'm a developer for the Spack package manager. Spack builds all packages from source, including our
sphinx_rtd_theme
package. Right now, this requires the user to also installnpm
, which can be very time consuming to build from source and may not be buildable on all platforms. I'm wondering if it would be possible to handle all pre-processing that requires the use ofnpm
before each release so thatnpm
is only required to build from master/develop.@j-ogas
The text was updated successfully, but these errors were encountered: