diff --git a/.github/workflows/test_and_release.yml b/.github/workflows/test_and_release.yml index 8c0f7b3..4eddb33 100644 --- a/.github/workflows/test_and_release.yml +++ b/.github/workflows/test_and_release.yml @@ -10,9 +10,9 @@ jobs: pre-commit: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v5 with: python-version: "3.9" @@ -49,10 +49,10 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} @@ -74,10 +74,10 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set Up Node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 14 @@ -91,15 +91,21 @@ jobs: needs: [pre-commit, pytest, test-npm-build] runs-on: ubuntu-latest if: github.event_name == 'push' + environment: + name: pypi + url: https://pypi.org/p/trame-deckgl + permissions: + id-token: write + contents: write steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set Up Node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 14 @@ -110,8 +116,11 @@ jobs: npm run build - name: Python Semantic Release - uses: relekang/python-semantic-release@v7.34.6 + id: release + uses: python-semantic-release/python-semantic-release@v10.5.3 with: github_token: ${{ secrets.GITHUB_TOKEN }} - repository_username: __token__ - repository_password: ${{ secrets.PYPI_API_TOKEN }} + + - name: Publish package distributions to PyPI + if: steps.release.outputs.released == 'true' + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.gitignore b/.gitignore index 5566039..ed2e099 100644 --- a/.gitignore +++ b/.gitignore @@ -78,6 +78,8 @@ ipython_config.py # pyenv .python-version +# uv +uv.lock # pdm # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 21c6c49..5c85e7f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,3 +1,9 @@ +ci: + autoupdate_commit_msg: "chore: update pre-commit hooks" + autofix_commit_msg: "style: pre-commit fixes" + +exclude: ^.cruft.json|.copier-answers.yml$ + repos: - repo: https://github.com/psf/black rev: 22.3.0 @@ -6,11 +12,20 @@ repos: entry: black --check - repo: https://github.com/codespell-project/codespell - rev: v2.1.0 + rev: v2.3.0 hooks: - id: codespell - - repo: https://github.com/PyCQA/flake8 - rev: 4.0.1 + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.9.1 + hooks: + - id: ruff + args: ["--fix", "--show-fixes"] + - id: ruff-format + + - repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook + rev: v9.20.0 hooks: - - id: flake8 + - id: commitlint + stages: [commit-msg] + additional_dependencies: ["@commitlint/config-conventional"] diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..44f137f --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,74 @@ +[project] +name = "trame-deckgl" +version = "2.0.3" +description = "Deck.gl widget for trame" +authors = [ + {name = "Kitware Inc."}, +] +dependencies = [ + "trame-client", +] +requires-python = ">=3.9" +readme = "README.rst" +license = {text = "MIT"} +keywords = [ + "Python", + "Interactive", + "Web", + "Application", + "Framework", +] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: Web Environment", + "License :: OSI Approved :: MIT License", + "Natural Language :: English", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: JavaScript", + "Topic :: Software Development :: Libraries :: Application Frameworks", + "Topic :: Software Development :: Libraries :: Python Modules", +] + +[project.optional-dependencies] +dev = [ + "pre-commit", + "ruff", + "pytest", + "pytest-asyncio", + "trame-client[test]", +] + +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[tool.hatch.build] +include = [ + "/trame/**/*.py", + "/trame_deckgl/**/*.py", + "/trame_deckgl/module/serve/**/*.js", + "/trame_deckgl/module/serve/**/*.css", + "/trame_deckgl/LICENSE", +] + +[tool.hatch.build.targets.wheel] +packages = [ + "trame", + "trame_deckgl", +] + +[tool.semantic_release] +version_toml = [ + "pyproject.toml:project.version", +] +build_command = """ + python -m venv .venv + source .venv/bin/activate + pip install -U pip build + python -m build --sdist --wheel . +""" + +[tool.semantic_release.publish] +dist_glob_patterns = ["dist/*"] +upload_to_vcs_release = true diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index b6c730c..0000000 --- a/setup.cfg +++ /dev/null @@ -1,33 +0,0 @@ -[metadata] -name = trame-deckgl -version = 2.0.3 -description = Deck.gl widget for trame -long_description = file: README.rst -long_description_content_type = text/x-rst -author = Kitware Inc. -license = MIT -classifiers = - Development Status :: 5 - Production/Stable - Environment :: Web Environment - License :: OSI Approved :: MIT License - Natural Language :: English - Operating System :: OS Independent - Programming Language :: Python :: 3 :: Only - Programming Language :: JavaScript - Topic :: Software Development :: Libraries :: Application Frameworks - Topic :: Software Development :: Libraries :: Python Modules -keywords = - Python - Interactive - Web - Application - Framework - -[options] -packages = find: -include_package_data = True -install_requires = - trame-client - -[semantic_release] -version_pattern = setup.cfg:version = (\d+\.\d+\.\d+) diff --git a/setup.py b/setup.py deleted file mode 100644 index 6068493..0000000 --- a/setup.py +++ /dev/null @@ -1,3 +0,0 @@ -from setuptools import setup - -setup() diff --git a/trame/modules/deckgl.py b/trame/modules/deckgl.py index ae84831..42b50c3 100644 --- a/trame/modules/deckgl.py +++ b/trame/modules/deckgl.py @@ -1 +1,7 @@ -from trame_deckgl.module import * +from trame_deckgl.module import scripts, serve, vue_use + +__all__ = [ + "scripts", + "serve", + "vue_use", +] diff --git a/trame/widgets/deckgl.py b/trame/widgets/deckgl.py index 4611ad9..f70d4fe 100644 --- a/trame/widgets/deckgl.py +++ b/trame/widgets/deckgl.py @@ -1,7 +1,13 @@ -from trame_deckgl.widgets.deckgl import * +from trame_deckgl.widgets.deckgl import Deck def initialize(server): from trame_deckgl import module server.enable_module(module) + + +__all__ = [ + "Deck", + "initialize", +]