-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #24 -- Move config to pyproject.yaml
The python community has widely adopeted PIP 621. Therefore, it seems the best place to implement it in this package too. There are two key changes: 1. The config moves to `tool.importmap`. 2. The importmap config allows adding multiple entries. Additionally, this commits removes two dependencies: * marshmellow * tomli (python_version>=12.0)
- Loading branch information
Showing
8 changed files
with
50 additions
and
883 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,21 +31,23 @@ INSTALLED_APPS = [ | |
] | ||
``` | ||
|
||
### 2. Create an `importmap.toml` file | ||
### 2. Configuring an import map | ||
|
||
This should live next to your `manage.py` file. | ||
Here you'll add a list of "packages" you want to use. | ||
You JavaScript dependencies are conveniently located in your`pyproject.toml` file. | ||
|
||
The "name" can be anything, but should probably be the same as what it you would import from in typical bundling setups (i.e. `import React from "react"`). | ||
|
||
The "source" will get passed on to the [jspm.org generator](https://jspm.org/docs/api#install), but is basically the `<npm package>@<version>` you want to use. | ||
They are listed under `[tool.importmap.dependencies]` and you can add them there. The format is `name = "version"`, | ||
similar to how you would add a dependency to your `package.json` file. | ||
|
||
```toml | ||
[[packages]] | ||
name = "react" | ||
source = "[email protected]" | ||
# pyproject.toml | ||
[tool.importmap.dependencies] | ||
react = "17.0.2" | ||
react-dom = "17.0.2" | ||
``` | ||
|
||
[jspm.org generator](https://jspm.org/docs/api#install) is used lock and serve the dependencies, | ||
but is basically just like installing them via `npm i <npm package>@<version>`. | ||
|
||
### 3. Run `importmap_generate` | ||
|
||
To resolve the import map, you'll need to run `python manage.py importmap_generate`. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.