Skip to content

Commit

Permalink
Merge pull request #42 from agoose77/feat-pdm-build
Browse files Browse the repository at this point in the history
Feat: move to PDM & hatch
  • Loading branch information
agoose77 authored May 11, 2022
2 parents 1024597 + a4145f7 commit 0c211bc
Show file tree
Hide file tree
Showing 30 changed files with 1,248 additions and 2,010 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.ipynb_checkpoints
__pycache__
.ipynb_checkpoints/
__pycache__/
lib/
7 changes: 0 additions & 7 deletions MANIFEST.in

This file was deleted.

6 changes: 0 additions & 6 deletions literary_config.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
{
"ProjectOperator": {
"packages_dir": "src"
},
"PackageBuilder": {
"generated_dir": "lib"
},
"ProjectTester": {
"extra_sources": ["examples"]
},
Expand Down
83 changes: 81 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,82 @@
[project]
name = "literary"
version = "4.0.0"
description = "Literate package development with Jupyter"
authors = [
{name = "Angus Hollands", email = "[email protected]"},
]
dependencies = [
"nbformat[fast]>=5",
"nbclient>=0.5.12",
"nbconvert>=6.0",
"traitlets>=5",
"astunparse>=1.6; python_version < \"3.9\"",
"ipython>=7.33.0",
"typing-extensions>=3.10",
"jupyter-core>=4.7",
]
requires-python = ">=3.7"
readme = "README.md"
license = {file = "LICENSE"}
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9"]
keywords = [
"literate-programming",
"jupyter",
"notebooks",
"nbconvert"
]

[project.urls]
"Repository" = "http://github.com/agoose77/literary"
"Bug Tracker" = "http://github.com/agoose77/literary/issues"

[project.scripts]
literary = "literary.commands.__main__:launch_new_instance"

[project.entry-points."nbconvert.exporters"]
literary = "literary.transpile.exporter:LiteraryExporter"

[project.optional-dependencies]

[tool]
[tool.pdm]
[tool.pdm.dev-dependencies]
dev = [
"jupyterlab>=3.4.0",
"pytest>=7.1.2",
"literary>=3.0.0",
]

[tool.hatch.build]
only-packages = true
# Ensure even if VCS includes file, we don't!
exclude = ["lib"]

# Include generated package for wheels
[tool.hatch.build.targets.wheel.force-include]
"lib" = "/"


[tool.hatch.build.targets.wheel.shared-data]
"share/jupyter/nbconvert/templates/literary/conf.json" = "share/jupyter/nbconvert/templates/literary/conf.json"
"share/jupyter/nbconvert/templates/literary/index.py.j2" = "share/jupyter/nbconvert/templates/literary/index.py.j2"


[tool.hatch.build.targets.wheel.hooks.literary]
dependencies = ["literary-build-hatch"]


[build-system]
requires = ["wheel", "literary-build>=2.0.0,<3.0.0"]
build-backend = "literary.build_meta"
requires = ["hatchling"]
build-backend = "hatchling.build"
7 changes: 0 additions & 7 deletions requirements-dev.txt

This file was deleted.

67 changes: 0 additions & 67 deletions setup.cfg

This file was deleted.

91 changes: 75 additions & 16 deletions src/literary/commands/__main__.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@
"cells": [
{
"cell_type": "markdown",
"id": "mediterranean-ministry",
"id": "solar-necessity",
"metadata": {
"tags": [
"docstring"
]
},
"source": [
"# Entrypoint"
"# Commandline Application"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "swiss-address",
"id": "charming-harassment",
"metadata": {
"execution": {
"iopub.execute_input": "2021-05-18T21:00:14.796299Z",
"iopub.status.busy": "2021-05-18T21:00:14.795249Z",
"iopub.status.idle": "2021-05-18T21:00:14.949840Z",
"shell.execute_reply": "2021-05-18T21:00:14.948801Z"
"iopub.execute_input": "2021-05-18T21:00:13.513196Z",
"iopub.status.busy": "2021-05-18T21:00:13.512587Z",
"iopub.status.idle": "2021-05-18T21:00:13.648972Z",
"shell.execute_reply": "2021-05-18T21:00:13.649946Z"
}
},
"outputs": [],
Expand All @@ -32,27 +32,86 @@
{
"cell_type": "code",
"execution_count": 2,
"id": "advance-flavor",
"id": "informed-raise",
"metadata": {
"execution": {
"iopub.execute_input": "2021-05-18T21:00:14.955483Z",
"iopub.status.busy": "2021-05-18T21:00:14.954285Z",
"iopub.status.idle": "2021-05-18T21:00:14.966761Z",
"shell.execute_reply": "2021-05-18T21:00:14.966100Z"
"iopub.execute_input": "2021-05-18T21:00:13.655795Z",
"iopub.status.busy": "2021-05-18T21:00:13.654549Z",
"iopub.status.idle": "2021-05-18T21:00:13.662259Z",
"shell.execute_reply": "2021-05-18T21:00:13.662730Z"
},
"tags": [
"export"
]
},
"outputs": [],
"source": [
"from .launcher import LiteraryLauncher, launch_new_instance"
"import sys\n",
"\n",
"from traitlets import default\n",
"from traitlets.config import Application\n",
"\n",
"from .build import LiteraryBuildApp\n",
"from .test import LiteraryTestApp"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "binary-economy",
"id": "imported-thickness",
"metadata": {
"execution": {
"iopub.execute_input": "2021-05-18T21:00:13.669139Z",
"iopub.status.busy": "2021-05-18T21:00:13.668540Z",
"iopub.status.idle": "2021-05-18T21:00:13.670479Z",
"shell.execute_reply": "2021-05-18T21:00:13.671128Z"
},
"tags": [
"export"
]
},
"outputs": [],
"source": [
"class LiteraryLauncher(Application):\n",
" description = \"Work with literate notebooks\"\n",
" subcommands = {\n",
" \"build\": (LiteraryBuildApp, \"Build a package from a series of notebooks\"),\n",
" \"test\": (LiteraryTestApp, \"Run a series of notebook tests\"),\n",
" }\n",
"\n",
" def start(self):\n",
" \"\"\"Perform the App's actions as configured\"\"\"\n",
" super().start()\n",
" \n",
" if self.subapp is None:\n",
" sub_commands = \", \".join(sorted(self.subcommands))\n",
" sys.exit(\"Please supply at least one subcommand: {}\".format(sub_commands))"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "sustainable-archive",
"metadata": {
"execution": {
"iopub.execute_input": "2021-05-18T21:00:13.676540Z",
"iopub.status.busy": "2021-05-18T21:00:13.675210Z",
"iopub.status.idle": "2021-05-18T21:00:13.677853Z",
"shell.execute_reply": "2021-05-18T21:00:13.678926Z"
},
"tags": [
"export"
]
},
"outputs": [],
"source": [
"launch_new_instance = LiteraryLauncher.launch_instance"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "7cd5310f-b1a4-4926-b909-b736e37d839c",
"metadata": {
"execution": {
"iopub.execute_input": "2021-05-18T21:00:14.973332Z",
Expand All @@ -78,7 +137,7 @@
"notebook_metadata_filter": "-all"
},
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -92,7 +151,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.0"
"version": "3.10.4"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 0c211bc

Please sign in to comment.