Skip to content

Commit

Permalink
Transition to the src layout
Browse files Browse the repository at this point in the history
  • Loading branch information
mwouts committed May 12, 2024
1 parent e2a7b91 commit 9f951dd
Show file tree
Hide file tree
Showing 26 changed files with 31 additions and 14 deletions.
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-03-??)
------------------

**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
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
File renamed without changes.
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.
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_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

0 comments on commit 9f951dd

Please sign in to comment.