Skip to content

Commit 6b27833

Browse files
authored
Merge pull request #28 from UlysseDurand/serve-version
Put project version in the served umd.js file url
2 parents c365e1c + 6011bcc commit 6b27833

7 files changed

Lines changed: 19 additions & 18 deletions

File tree

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,10 @@ The **project_type** can be only one of the following options:
4141
By default a simple vtk.js application is used as reference to provide
4242
the trame basic while demonstrating an interactive application with code
4343
separation between the Python core and the web frontend.
44-
Whithin that Python package, a jupyter helper module will also be available
45-
to run and show your application within a jupyter environment.
46-
On top of that Python package, you will have access to several bundling
47-
option ranging from a standalone executable to a docker image for cloud
48-
deployment.
44+
Within that Python package, a jupyter helper module will also be available
45+
to run and show your application within a jupyter environment. On top of
46+
that Python package, you will have access to several bundling option ranging
47+
from a standalone executable to a docker image for cloud deployment.
4948
* **App with Components**
5049
This will provide the same infrastructure as above but with an additional
5150
directory that will contain a vue.js project for defining new UI elements

{{cookiecutter.package_name}}/.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ ci:
22
autoupdate_commit_msg: "chore: update pre-commit hooks"
33
autofix_commit_msg: "style: pre-commit fixes"
44

5-
exclude: ^.cruft.json|.copier-answers.yml$
5+
exclude: ^.cruft.json|.copier-answers.yml$|uv\.lock$
66

77
repos:
88
- repo: https://github.com/pre-commit/pre-commit-hooks

{{cookiecutter.package_name}}/README.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ Run the application
2626
2727
{%- endif %}
2828

29-
Developement setup
29+
Development setup
3030
----------------------------------------
3131

32-
We recommend using uv for setting up and managing a virtual environement for your development.
32+
We recommend using uv for setting up and managing a virtual environment for your development.
3333

3434
.. code-block:: console
3535
3636
# Create venv and install all dependencies
3737
uv sync --all-extras --dev
3838
39-
# Activate environement
39+
# Activate environment
4040
source .venv/bin/activate
4141
{% if cookiecutter.include_ci %}
4242
# Install commit analysis
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from {{cookiecutter.import_name}}.module import *
1+
from {{cookiecutter.import_name}}.module import * # noqa: F403
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from {{cookiecutter.import_name}}.widgets.{{cookiecutter.module_short_name}} import *
1+
from {{cookiecutter.import_name}}.widgets.{{cookiecutter.module_short_name}} import * # noqa: F403
22

33

44
def initialize(server):
5-
from {{cookiecutter.import_name}} import module
5+
from {{cookiecutter.import_name}} import module # noqa: PLC0415
66

77
server.enable_module(module)

{{cookiecutter.package_name}}/src/{{cookiecutter.import_name}}/module/__init__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
from pathlib import Path
22

3+
from {{cookiecutter.import_name}} import __version__
4+
35
# Compute local path to serve
46
serve_path = str(Path(__file__).with_name("serve").resolve())
7+
serve_directory = f"__{{cookiecutter.import_name}}_{__version__}"
58

69
# Serve directory for JS/CSS files
7-
serve = {"__{{cookiecutter.import_name}}": serve_path}
10+
serve = {serve_directory: serve_path}
811

912
# List of JS files to load (usually from the serve path above)
10-
scripts = ["__{{cookiecutter.import_name}}/{{cookiecutter.import_name}}.umd.js"]
13+
scripts = [f"{serve_directory}/{{cookiecutter.import_name}}.umd.js"]
1114

1215
# List of CSS files to load (usually from the serve path above)
1316
if (Path(serve_path) / "style.css").exists():
14-
styles = ["__{{cookiecutter.import_name}}/style.css"]
17+
styles = [serve_directory + "/style.css"]
1518

1619
# List of Vue plugins to install/load
1720
vue_use = ["{{cookiecutter.import_name}}"]
@@ -23,4 +26,3 @@
2326
# Optional if you want to execute custom initialization at module load
2427
def setup(app, **kwargs):
2528
"""Method called at initialization with possibly some custom keyword arguments"""
26-
pass

{{cookiecutter.package_name}}/tests/test_import.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ def test_import():
33
from {{ cookiecutter.import_name }}.app import main # noqa: F401
44
{%- endif %}
55
{%- if cookiecutter.include_components %}
6-
from {{ cookiecutter.import_name }}.widgets.{{ cookiecutter.module_short_name }} import CustomWidget # noqa: F401
6+
from {{ cookiecutter.import_name }}.widgets.{{ cookiecutter.module_short_name }} import CustomWidget # noqa: F401, PLC0415
77
{%- endif %}
88
{%- if cookiecutter.include_components_only %}
99

1010
# For components only, the CustomWidget is also importable via trame
11-
from trame.widgets.{{ cookiecutter.import_name }} import CustomWidget # noqa: F401,F811
11+
from trame.widgets.{{ cookiecutter.import_name }} import CustomWidget # noqa: F401, PLC0415, F811
1212
{%- endif %}

0 commit comments

Comments
 (0)