Skip to content

Commit

Permalink
Transition to hatch and pyproject.toml
Browse files Browse the repository at this point in the history
Add support for Python 3.12
Update .github/workflow
  • Loading branch information
mwouts committed Mar 13, 2024
1 parent bab19de commit e630205
Show file tree
Hide file tree
Showing 11 changed files with 144 additions and 137 deletions.
57 changes: 35 additions & 22 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,59 +17,56 @@ jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
- uses: pre-commit/[email protected].0
uses: actions/setup-python@v5
- uses: pre-commit/[email protected].1

codeql:
runs-on: ubuntu-latest
permissions:
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: python, javascript
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3

pytest:
strategy:
fail-fast: false
matrix:
python-version: [3.6, 3.7, 3.8, 3.9, "3.10", "3.11"]
python-version: [3.7, 3.8, 3.9, "3.10", "3.11", "3.12"]
pandas-version: [latest]
include:
- python-version: 3.6
pandas-version: 0.22
- python-version: 3.7
pandas-version: '<1.0'
- python-version: 3.9
pandas-version: 1.5
- python-version: "3.11"
pandas-version: '<2.0'
- python-version: "3.12"
pandas-version: pre
polars: true
- python-version: "3.11"
- python-version: "3.12"
uninstall_jinja2: true
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Node
uses: actions/setup-node@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: Install a development version of 'itables'
run: pip install -e .
run: pip install -e .[test]

- name: Install pandas latest
if: matrix.pandas-version == 'latest'
Expand All @@ -79,7 +76,7 @@ jobs:
run: pip install pandas --pre
- name: Install pandas ${{ matrix.pandas-version }}
if: matrix.pandas-version != 'pre' && matrix.pandas-version != 'latest'
run: pip install pandas==${{ matrix.pandas-version }}
run: pip install 'pandas${{ matrix.pandas-version }}'

- name: Install polars
if: matrix.polars
Expand All @@ -97,3 +94,19 @@ jobs:

- name: Upload coverage
uses: codecov/codecov-action@v3

build:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install hatch
run : pip install hatch
- name: Build package
run: hatch build
8 changes: 5 additions & 3 deletions .github/workflows/publish-book.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ jobs:
deploy-book:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Node
uses: actions/setup-node@v4

# Install dependencies
- name: Set up Python 3.11
uses: actions/setup-python@v1
uses: actions/setup-python@v5
with:
python-version: 3.11

Expand Down
16 changes: 9 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,21 @@ jobs:
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/jupytext
url: https://pypi.org/p/itables
permissions:
id-token: write
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: 3.11
- name: Build package
run: |
pip install wheel requests
python setup.py sdist bdist_wheel
python -m pip install wheel build
python -m build
- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1
18 changes: 10 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,29 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8

- repo: https://github.com/timothycrosley/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
args: ["--profile", "black", "--filter-files"]

- repo: https://github.com/psf/black
rev: 23.1.0
rev: 22.3.0
hooks:
- id: black

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.1
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]

- repo: https://github.com/mwouts/jupytext
rev: v1.14.5
hooks:
- id: jupytext
types: ["markdown"]
args: ["--pipe", "black"]
args: ["--pipe", "black", "--check", "ruff check {} --ignore E402"]
additional_dependencies:
- black==22.3.0 # Matches hook
- ruff==0.3.1
2 changes: 2 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ ITables ChangeLog
**Changed**
- ITables uses the latest version `2.0.1` of `datatables-net` ([#121](https://github.com/mwouts/itables/issues/121))
- Large Python integers are now mapped to JavaScript `BigInt` ([#172](https://github.com/mwouts/itables/issues/172))
- ITables is build using `hatch` and `pyproject.toml`

**Added**
- The CSV, Excel and Print buttons are now included ([#50](https://github.com/mwouts/itables/issues/50))
- ITables is now tested with Python 3.12


1.7.1 (2024-03-05)
Expand Down
82 changes: 80 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,81 @@
[build-system]
build-backend = "setuptools.build_meta"
requires = ["setuptools", "requests", "pathlib"]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "itables"
authors = [{name = "Marc Wouts", email = "[email protected]"}]
maintainers = [{name = "Marc Wouts", email = "[email protected]"}]
description = "Pandas and Polar DataFrames as interactive datatables"
readme = "README.md"
keywords = ["Pandas", "Polars", "Interactive", "Javascript", "datatables-net"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: MIT License",
"Framework :: Jupyter",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
requires-python = ">= 3.7"
dependencies = ["IPython", "pandas", "numpy"]
dynamic = ["version"]

[tool.hatch.version]
path = "itables/version.py"

[project.optional-dependencies]
test = [
# Pytest
"pytest",
"pytest-cov",
# Sample dfs
"pytz",
"world_bank_data",
# Test the documentation
"ipykernel",
"nbconvert",
"jupytext",
# Pandas style
"matplotlib",
# Shiny test app
"shiny"
]
polars = ["polars", "pyarrow"]

[project.urls]
Homepage = "https://mwouts.github.io/itables/"
Documentation = "https://mwouts.github.io/itables"
Repository = "https://github.com/mwouts/itables.git"
Issues = "https://github.com/mwouts/itables/issues"
Changelog = "https://github.com/mwouts/itables/blob/main/docs/changelog.md"

[pycodestyle]
max-line-length = 88

[tool.coverage.report]
exclude_lines = [
# Have to re-enable the standard pragma
"pragma: no cover",

# Don't complain if tests don't hit defensive assertion code:
"raise NotImplementedError",
"except ImportError",
]

[tool.hatch.build.hooks.jupyter-builder]
dependencies = ["hatch-jupyter-builder"]
build-function = "hatch_jupyter_builder.npm_builder"
ensured-targets = ["itables/dt_bundle/dt.js", "itables/dt_bundle/dt.css"]

[tool.hatch.build.hooks.jupyter-builder.build-kwargs]
path = "itables/dt_package"
build_cmd = "build"
npm = ["npm"]
13 changes: 0 additions & 13 deletions requirements-dev.txt

This file was deleted.

2 changes: 0 additions & 2 deletions requirements.txt

This file was deleted.

19 changes: 0 additions & 19 deletions setup.cfg

This file was deleted.

58 changes: 0 additions & 58 deletions setup.py

This file was deleted.

Loading

0 comments on commit e630205

Please sign in to comment.