Skip to content

Conversation

@utnapischtim
Copy link
Contributor

@utnapischtim utnapischtim commented Feb 19, 2025

this supersede #380

steps to how to use it

1.) check that uv and pnpm are installed
2.) create a new my-site directory with the regular content as usual OR go into your current development my-site directory
2.a) deactivate the active environment
3.) create with uv a virtual environment with uv venv --prompt uv-env && source .venv/bin/activate
4.) install invenio-cli with uv pip install "git+https://github.com/utnapischtim/invenio-cli@uv-rspack-pnpm-web-worker-ports"
4.a) uv pip install "git+https://github.com/utnapischtim/pynpm@add-pnpm"
5.) copy following text into the .invenio file into the cli section

python_packages_manager = uv
javascript_packages_manager = pnpm
assets_builder = rspack

5.a) please copy following to invenio.cfg

JAVASCRIPT_PACKAGES_MANAGER = "pnpm"
ASSETS_BUILDER = "rspack"

6.) copy following text into the pyproject.toml file. the file should be created beside the invenio.cfg file

[project]
name = "InvenioRDM"
requires-python = ">= 3.12"
dynamic = ["version"]

dependencies = [
  "invenio-app-rdm[opensearch2]~=13.0.0b2.dev2",
  "uwsgi>=2.0",
  "uwsgitop>=0.11",
  "uwsgi-tools>=1.1.1",

  # rspack
  "flask-webpackext",
  "invenio-assets",
  "pywebpack",
  "pynpm",
]

[tool.setuptools]
py-modules = [] # necessary to make the packages with setup.py usable with uv

# overrides packages from "dependencies"
[tool.uv.sources]
flask-webpackext = { git = "https://github.com/utnapischtim/flask-webpackext", branch = "make-ready-for-rspack" }
invenio-assets = { git = "https://github.com/slint/invenio-assets", branch = "rspack" }
pywebpack = { git = "https://github.com/utnapischtim/pywebpack", branch = "add-scripts" }
pynpm = { git = "https://github.com/utnapischtim/pynpm", branch = "add-pnpm" }

7.) run invenio-cli install to install

utnapischtim and others added 2 commits February 19, 2025 23:17
* since uv uses pyproject.toml relying on Pipfile doesn't work
* handle the detection of the python package manager to be used and the
  generation of its commands in a central spot to lower the maintenance
  burden
* make some commands (like translations) aware of the CLI config, to
  enable using pipenv alternatives too
* also rename packages_manager to package_manager because that's the
  common term
* tell invenio about which JS package manager is actually selected
  currently (npm or pnpm), via the new `ASSETS_NPM_PKG_CLS` config
* it looks like there's no direct analogue in uv though, so they're
  implemented in shell scripts...
* put random multi-line strings into a single line
* slightly reword some help text
* also, use the module_pkg to execute the install command in the target
  path (rather than the instance's path, which made a difference in the
  case of pnpm)
@utnapischtim
Copy link
Contributor Author

superseded by #385 and #384

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