Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transition ITables to the src layout #247

Merged
merged 1 commit into from
May 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![ITables Logo](itables/logo/wide.svg)
![ITables logo](https://raw.githubusercontent.com/mwouts/itables/3f8e8bd75af7ad38a500518fcb4fbbc370ea6c4c/itables/logo/wide.svg)

![CI](https://github.com/mwouts/itables/actions/workflows/continuous-integration.yml/badge.svg?branch=main)
[![codecov.io](https://codecov.io/github/mwouts/itables/coverage.svg?branch=main)](https://codecov.io/github/mwouts/itables?branch=main)
Expand Down
2 changes: 1 addition & 1 deletion docs/_config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
title: Interactive Tables
author: Marc Wouts
copyright: "2019-2024"
logo: "../itables/logo/logo.svg"
logo: "../src/itables/logo/logo.svg"
execute:
execute_notebooks: force
sphinx:
Expand Down
7 changes: 7 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
ITables ChangeLog
=================

2.1.0-dev (2024-05-??)
------------------

**Changed**
- ITables now uses the `src` layout ([#246](https://github.com/mwouts/itables/issues/246)) - many thanks to [Mahendra Paipuri](https://github.com/mahendrapaipuri) for his help on this topic!


2.0.1 (2024-04-30)
------------------

Expand Down
18 changes: 13 additions & 5 deletions docs/custom_extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,26 @@ To use custom extensions in the offline mode, you will need
to create a bundle of jQuery, DataTables, and the desired extensions.

To do so, make a copy of
[`itables/dt_for_itables`](https://github.com/mwouts/itables/tree/main/itables/dt_for_itables):
[`packages/dt_for_itables`](https://github.com/mwouts/itables/tree/main/packages/dt_for_itables):
```bash
$ ls itables/dt_for_itables/
package.json package-lock.json README.md src.js
$ tree
```
```
.
├── LICENSE
├── package.json
├── package-lock.json
├── README.md
└── src
└── index.js
```

Add or remove the desired extensions in `package.json` and `src.js`. To do this,
Add or remove the desired extensions in `package.json` and `src/index.js`. To do this,
you can use the [DataTables download](https://datatables.net/download/) page and
follow the instructions for the _NPM_ download method.

For instance, say you want to bundle the PDF export button. Change
`src.js` to this code:
`src/index.js` to this code:
```javascript
import JSZip from 'jszip';
import jQuery from 'jquery';
Expand Down
2 changes: 1 addition & 1 deletion docs/quick_start.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ kernelspec:
name: itables
---

![ITables Logo](../itables/logo/text.svg)
![ITables Logo](../src/itables/logo/text.svg)

![CI](https://github.com/mwouts/itables/actions/workflows/continuous-integration.yml/badge.svg?branch=main)
[![codecov.io](https://codecov.io/github/mwouts/itables/coverage.svg?branch=main)](https://codecov.io/github/mwouts/itables?branch=main)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ and some of its extensions for [ITables](https://github.com/mwouts/itables/).
Run the following commands:
```bash
npm install
npm run build
npm run build:js
```

# How to update the dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"description": "DataTables bundle for itables",
"main": "src.js",
"scripts": {
"build": "esbuild src.js --format=esm --bundle --outfile=dt_bundle.js --minify"
"build:js": "esbuild src/index.js --format=esm --bundle --outfile=dt_bundle.js --minify",
"install:js": "cp dt_bundle.js dt_bundle.css ../../src/itables/html",
"build": "npm run build:js && npm run install:js"
},
"author": "Marc Wouts",
"license": "MIT",
Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ test = [
]

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

[project.urls]
Homepage = "https://mwouts.github.io/itables/"
Expand All @@ -76,15 +76,15 @@ exclude_lines = [
enable-by-default = true
dependencies = ["hatch-jupyter-builder"]
build-function = "hatch_jupyter_builder.npm_builder"
ensured-targets = ["itables/dt_for_itables/dt_bundle.js", "itables/dt_for_itables/dt_bundle.css"]
ensured-targets = ["src/itables/html/dt_bundle.js", "src/itables/html/dt_bundle.css"]

[tool.hatch.build.hooks.jupyter-builder.build-kwargs]
path = "itables/dt_for_itables"
path = "packages/dt_for_itables"
build_cmd = "build"
npm = ["npm"]

[tool.hatch.build.targets.sdist]
artifacts = ["itables/dt_for_itables/dt_bundle.js", "itables/dt_for_itables/dt_bundle.css"]
artifacts = ["src/itables/html/dt_bundle.js", "src/itables/html/dt_bundle.css"]

[tool.hatch.build.targets.wheel]
artifacts = ["itables/dt_for_itables/dt_bundle.js", "itables/dt_for_itables/dt_bundle.css"]
artifacts = ["src/itables/html/dt_bundle.js", "src/itables/html/dt_bundle.css"]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
2 changes: 1 addition & 1 deletion itables/options.py → src/itables/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
dt_url = UNPKG_DT_BUNDLE_URL

"""The DataTable bundle for the offline mode"""
dt_bundle = find_package_file("dt_for_itables/dt_bundle.js")
dt_bundle = find_package_file("html/dt_bundle.js")

"""Display the ITables animated logo when loading"""
display_logo_when_loading = True
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion itables/version.py → src/itables/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""ITables' version number"""

__version__ = "2.0.1"
__version__ = "2.1.0-dev"
2 changes: 1 addition & 1 deletion tests/test_javascript.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def test_unpkg_links(url):


def test_unpkg_urls_are_up_to_date():
with open(Path(__file__).parent / "../itables/dt_for_itables/package.json") as fp:
with open(Path(__file__).parent / "../packages/dt_for_itables/package.json") as fp:
dt_for_itables = json.load(fp)
bundle_version = dt_for_itables["version"]
assert (
Expand Down
2 changes: 1 addition & 1 deletion tests/test_update_samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import world_bank_data as wb

SAMPLE_DIR = Path(__file__).parent / ".." / "itables" / "samples"
SAMPLE_DIR = Path(__file__).parent / ".." / "src" / "itables" / "samples"


def create_csv_file_if_missing(df, csv_file):
Expand Down