Skip to content

Commit

Permalink
Update pyproject.toml and GitHub actions
Browse files Browse the repository at this point in the history
  • Loading branch information
alexhad6 committed Nov 1, 2023
1 parent 16ea182 commit 8113e69
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 38 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
env:
HATCH_VERSION: "1.7.0"
PYTHON_VERSION: "3.9"
PYTHON_PACKAGE_NAME: "jupyterlab_display_name"

jobs:
ci:
Expand All @@ -28,13 +29,13 @@ jobs:
python-version: ${{ env.PYTHON_VERSION }}

- name: Check Formatting (Black)
run: hatch run black datalogger_jupyterlab --check
run: hatch run black ${{ env.PYTHON_PACKAGE_NAME }} --check

- name: Lint (Flake8)
run: hatch run flake8 datalogger_jupyterlab
run: hatch run flake8 ${{ env.PYTHON_PACKAGE_NAME }}

- name: Lint (Pylint)
run: hatch run pylint datalogger_jupyterlab
run: hatch run pylint ${{ env.PYTHON_PACKAGE_NAME }}

- name: Type Check (Mypy)
run: hatch run mypy datalogger_jupyterlab
run: hatch run mypy ${{ env.PYTHON_PACKAGE_NAME }}
30 changes: 14 additions & 16 deletions .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ on: workflow_dispatch

env:
HATCH_VERSION: "1.7.0"
PYTHON_VERSION: "3.9"
JUPYTERLAB_DISPLAY_NAME_VERSION: "0.1.0"
PACKAGE_VERSION: "0.1.0"
PACKAGE_NAME: "jupyterlab-display-name"
PYTHON_PACKAGE_NAME: "jupyterlab_display_name"

jobs:
build:
Expand All @@ -17,11 +18,6 @@ jobs:
- name: Install Hatch
run: pipx install hatch==${{ env.HATCH_VERSION }}

- name: Set up Python with pip cache
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Build package
run: hatch build

Expand All @@ -32,25 +28,27 @@ jobs:
echo '<!DOCTYPE html>
<html>
<body>
<a href="jupyterlab-display-name/">jupyterlab-display-name</a>
<a href="${{ env.PACKAGE_NAME }}/">${{ env.PACKAGE_NAME }}</a>
</body>
</html>' > _site/releases/index.html
- name: Create _site/releases/jupyterlab-display-name/index.html
- name: Create _site/releases/<package-name>/index.html
run: |
mkdir _site/releases/jupyterlab-display-name
mkdir _site/releases/${{ env.PACKAGE_NAME }}
echo '<!DOCTYPE html>
<html>
<body>
<a href="jupyterlab_display_names-${{ env.JUPYTERLAB_DISPLAY_NAME_VERSION }}-py3-none-any.whl">
jupyterlab_display_names-${{ env.JUPYTERLAB_DISPLAY_NAME_VERSION }}-py3-none-any.whl
<a href="${{ env.PYTHON_PACKAGE_NAME }}-${{ env.PACKAGE_VERSION }}-py3-none-any.whl">
${{ env.PYTHON_PACKAGE_NAME }}-${{ env.PACKAGE_VERSION }}-py3-none-any.whl
</a>
<a href="${{ env.PYTHON_PACKAGE_NAME }}-${{ env.PACKAGE_VERSION }}.tar.gz">
${{ env.PYTHON_PACKAGE_NAME }}-${{ env.PACKAGE_VERSION }}.tar.gz
</a>
<a href="jupyterlab_display_names-${{ env.JUPYTERLAB_DISPLAY_NAME_VERSION }}.tar.gz">jupyterlab_display_names-${{ env.JUPYTERLAB_DISPLAY_NAME_VERSION }}.tar.gz</a>
</body>
</html>' > _site/releases/jupyterlab-display-name/index.html
</html>' > _site/releases/${{ env.PACKAGE_NAME }}/index.html
- name: Move package files into _site/releases/jupyterlab-display-name
run: mv dist/* _site/releases/jupyterlab-display-name
- name: Move package files into _site/releases/<package-name>
run: mv dist/* _site/releases/${{ env.PACKAGE_NAME }}

- name: Upload site artifact
uses: actions/upload-pages-artifact@v2
Expand Down
23 changes: 5 additions & 18 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ readme = "README.md"
keywords = [
"jupyter",
"jupyterlab",
"jupyterlab-extension"
"jupyterlab-extension",
]
classifiers = [
"Framework :: Jupyter",
Expand All @@ -28,7 +28,7 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
]
requires-python = ">=3.9,<3.13"
requires-python = ">=3.9"
dependencies = [
"jupyter_server>=2.9.1,<3",
]
Expand All @@ -37,24 +37,14 @@ dependencies = [
Homepage = "https://github.com/PainterQubits/jupyterlab-display-name"
Repository = "https://github.com/PainterQubits/jupyterlab-display-name"

[tool.hatch.build.targets.sdist]
exclude = ["**/*"]
artifacts = [
"/jupyterlab_display_name",
"/jupyter_server_config.json",
]

[tool.hatch.build.targets.wheel]
artifacts = [
"py.typed",
"templates",
]
packages = ["jupyterlab_display_name"]

[tool.hatch.build.targets.wheel.shared-data]
"jupyter_server_config.json" = "etc/jupyter/jupyter_server_config.d/jupyterlab_display_name.json"

# For building and linting
[tool.hatch.envs.default]
description = "For building and linting"
dependencies = [
"jupyterlab>=4.0.7,<5",
"flake8>=6.1.0,<7",
Expand All @@ -63,8 +53,8 @@ dependencies = [
"black>=23.10.1,<24",
]

# For running JupterLab in development
[tool.hatch.envs.jupyterlab]
description = "For running JupterLab in development"
dependencies = [
"jupyterlab>=4.0.7,<5",
"jupyter-collaboration>=1.2.0,<2",
Expand All @@ -75,6 +65,3 @@ start = "jupyter lab"

[tool.mypy]
strict = true

[tool.pylint.basic]
good-names-rgxs = ["^[a-z][a-z0-9]?$"]

0 comments on commit 8113e69

Please sign in to comment.