Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload Python Package

on:
release:
types: [created]
workflow_dispatch:
# Allow to run manually

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.SAGEMATH_PYPI_API_TOKEN }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Python packaging generated files
/dist
*.egg-info
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include LICENSE
include version
graft jupyter_threejs_sage/static
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@

# Custom build of Three.js for SageMath

The steps to create this build from a stable tagged version are
This package provides a single minified Javascript file `three.min.js`, which combines
standard Three.js with a number of scripts from `examples/jsm/`.

The file is made available both as package data of a Python package `jupyter_threejs_sage` (for local access by SageMath) and as a Jupyter notebook extension (to be installed in the Jupyter notebook's Python environment).

# Development

The steps to create this build from a stable tagged version of Three.js are

* Perform a shallow clone of the desired version with

Expand All @@ -24,6 +31,14 @@ export { LineSegmentsGeometry } from '../examples/jsm/lines/LineSegmentsGeometry

* Build the library with `npm run build`

The minified file will be located in the `build` directory and has been copied to the same directory here. The final step before releasing is to update the `version` file with the new number.
The minified file `three.min.js` will be located in the `build` directory.

* Copy the minified file to the `build` directory here.

* Create a new directory for the new version in `jupyter_threejs_sage/static/` and copy the minified file there.
(Do not remove old versions that needed by any released versions of Sage.)

* The final step before releasing is to update the `version` file.


As noted in [this issue](https://github.com/mrdoob/three.js/issues/20591), Three.js releases can be modified for up to a week after the initial release. This build process should wait for this period of time to ensure future consistency of building.
Empty file.
2 changes: 2 additions & 0 deletions jupyter_threejs_sage/static/r122/three.min.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions jupyter_threejs_sage/static/r123/three.min.js

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions jupyter_threejs_sage/static/r130/three.min.js

Large diffs are not rendered by default.

34 changes: 34 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[build-system]
requires = ["setuptools>=61.2"]
build-backend = "setuptools.build_meta"

[project]
name = "jupyter-threejs-sage"
description = "Sage: Open Source Mathematics Software: Jupyter extension for 3D graphics with threejs"
license = {text = "MIT License"}
authors = [{name = "The Sage Developers", email = "[email protected]"}]
classifiers = [
"Development Status :: 6 - Mature",
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Framework :: Jupyter",
]
urls = {Homepage = "https://github.com/sagemath/threejs-sage"}
dynamic = ["version"]

[project.readme]
file = "README.md"
content-type = "text/markdown"

[tool.setuptools]
zip-safe = false
include-package-data = true
packages = ["jupyter_threejs_sage"]

[tool.setuptools.package-data]
jupyter_threejs_sage = ["jupyter_threejs_sage/static"]
15 changes: 15 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from setuptools import setup
import os

with open('version') as f:
package_version_without_r = f.read()[1:]

versions = [ x for x in os.listdir('jupyter_threejs_sage/static') if x.startswith('r') ]

setup(
version=package_version_without_r,
data_files = [(
f'share/jupyter/nbextensions/threejs-sage/{version}', [
f'jupyter_threejs_sage/static/{version}/three.min.js'
]) for version in versions]
)