Skip to content

Commit d40a3c3

Browse files
authored
Merge pull request #46 from agoose77/agoose77/maint-upgrade-developmentwq
maint: improve dev experience
2 parents 68453a3 + e580021 commit d40a3c3

File tree

8 files changed

+850
-22
lines changed

8 files changed

+850
-22
lines changed

.github/workflows/ci-cd.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ jobs:
2020
strategy:
2121
matrix:
2222
python-version:
23-
- "3.10"
23+
- "3.13"
2424
steps:
25-
- uses: actions/checkout@v2
26-
- uses: actions/setup-python@v2
25+
- uses: actions/checkout@v5
26+
- uses: actions/setup-python@v5
2727
with:
2828
python-version: ${{ matrix.python-version }}
2929

@@ -38,7 +38,7 @@ jobs:
3838
pip install twine
3939
twine check dist/*
4040
41-
- uses: actions/upload-artifact@v2
41+
- uses: actions/upload-artifact@v4
4242
with:
4343
name: build
4444
path: dist/*
@@ -56,11 +56,11 @@ jobs:
5656
- "3.10"
5757
- "3.11"
5858
steps:
59-
- uses: actions/checkout@v2
60-
- uses: actions/setup-python@v2
59+
- uses: actions/checkout@v5
60+
- uses: actions/setup-python@v5
6161
with:
6262
python-version: ${{ matrix.python-version }}
63-
- uses: actions/download-artifact@v2
63+
- uses: actions/download-artifact@v4
6464
with:
6565
name: build
6666
path: dist
@@ -76,7 +76,7 @@ jobs:
7676
runs-on: ubuntu-latest
7777
if: github.event_name == 'release' && github.event.action == 'published'
7878
steps:
79-
- uses: actions/download-artifact@v2
79+
- uses: actions/download-artifact@v4
8080
with:
8181
name: build
8282
path: dist

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
[wiki]: https://github.com/agoose77/literary/wiki
1616

1717
## TL;DR
18+
> [!Info]
19+
> To get started, see [the wiki]
20+
1821
Literary is a Python tool to make Jupyter (IPython) notebooks behave like pure-Python packages. This allows pure-Python packages to be generated from notebooks, and notebooks to be imported at runtime. Literary now [bootstraps itself](https://en.wikipedia.org/wiki/Bootstrapping); it is developed with Literary 🤯.
1922

2023
This package is an exploration of the [literate programming](http://www.literateprogramming.com) idea [pioneered by
@@ -37,3 +40,5 @@ notebooks
3740
be generated from the notebooks, and it must use the conventional import model. For
3841
this reason, `literary` should only exist as a development dependency of
3942
the package.
43+
44+
[the wiki]: https://github.com/agoose77/literary/wiki

flake.lock

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# code-owner: @agoose77
2+
# This flake sets up an FSH dev-shell that installs all the required
3+
# packages for running deployer, and then installs the tool in the virtual environment
4+
# It is not best-practice for the nix-way of distributing this code,
5+
# but its purpose is to get an environment up and running.
6+
{
7+
inputs = {
8+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
9+
flake-utils.url = "github:numtide/flake-utils";
10+
};
11+
outputs = {
12+
self,
13+
nixpkgs,
14+
flake-utils,
15+
}:
16+
flake-utils.lib.eachDefaultSystem (system: let
17+
pkgs = nixpkgs.legacyPackages.${system};
18+
inherit (pkgs) lib;
19+
20+
python = pkgs.python313;
21+
packages =
22+
[
23+
python
24+
]
25+
++ (with pkgs; [
26+
cmake
27+
ninja
28+
gcc
29+
pre-commit
30+
# Infra packages
31+
nodejs
32+
]);
33+
shellHook = ''
34+
# Unset leaky PYTHONPATH
35+
unset PYTHONPATH
36+
37+
__hash=$(echo ${python.interpreter} | sha256sum)
38+
39+
# Setup if not defined ####
40+
if [[ ! -f ".venv/$__hash" ]]; then
41+
__setup_env() {
42+
# Remove existing venv
43+
if [[ -d .venv ]]; then
44+
rm -r .venv
45+
fi
46+
47+
# Stand up new venv
48+
${python.interpreter} -m venv .venv
49+
50+
".venv/bin/python" -m pip install --group develop
51+
52+
# Add a marker that marks this venv as "ready"
53+
touch ".venv/$__hash"
54+
}
55+
56+
__setup_env
57+
fi
58+
###########################
59+
60+
export PYTHONPATH="$(git rev-parse --show-toplevel)/lib/"
61+
62+
# Activate venv
63+
source .venv/bin/activate
64+
'';
65+
env = lib.optionalAttrs pkgs.stdenv.isLinux {
66+
# Python uses dynamic loading for certain libraries.
67+
# We'll set the linker path instead of patching RPATH
68+
LD_LIBRARY_PATH = lib.makeLibraryPath pkgs.pythonManylinuxPackages.manylinux2014;
69+
};
70+
in {
71+
devShell = pkgs.mkShell {
72+
inherit env packages shellHook;
73+
};
74+
});
75+
}

pyproject.toml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,15 @@ authors = [
66
{name = "Angus Hollands", email = "goosey15@gmail.com"},
77
]
88
dependencies = [
9-
"nbformat[fast]>=5",
9+
"nbformat>=5.10",
1010
"nbclient>=0.5.12",
1111
"nbconvert>=6.0",
1212
"traitlets>=5",
13-
"astunparse>=1.6; python_version < \"3.9\"",
14-
"ipython>=7.33.0",
13+
"ipython>=7.33",
1514
"typing-extensions>=3.10",
1615
"jupyter-core>=4.7",
1716
]
18-
requires-python = ">=3.7"
17+
requires-python = ">=3.9"
1918
readme = "README.md"
2019
license = {file = "LICENSE"}
2120
classifiers = [
@@ -27,9 +26,11 @@ classifiers = [
2726
"Programming Language :: Python",
2827
"Programming Language :: Python :: 3",
2928
"Programming Language :: Python :: 3 :: Only",
30-
"Programming Language :: Python :: 3.7",
31-
"Programming Language :: Python :: 3.8",
32-
"Programming Language :: Python :: 3.9"]
29+
"Programming Language :: Python :: 3.9",
30+
"Programming Language :: Python :: 3.10",
31+
"Programming Language :: Python :: 3.11",
32+
"Programming Language :: Python :: 3.12",
33+
"Programming Language :: Python :: 3.13"]
3334
keywords = [
3435
"literate-programming",
3536
"jupyter",
@@ -49,16 +50,15 @@ literary = "literary.transpile.exporter:LiteraryExporter"
4950

5051
[project.optional-dependencies]
5152

52-
[tool]
53-
[tool.pdm]
54-
[tool.pdm.dev-dependencies]
55-
dev = [
53+
[dependency-groups]
54+
develop = [
5655
"jupyterlab>=3.4.0",
5756
"pytest>=7.1.2",
58-
"literary>=4.0.0",
5957
"jupyterlab-code-formatter>=1.4.11",
6058
"black>=22.3.0",
6159
"isort>=5.10.1",
60+
# Needed for building literary live!
61+
"literary>=4.0.1"
6262
]
6363

6464
[tool.hatch.build]

src/literary/__init__.ipynb

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"id": "9a348033-a307-4274-968d-680c360978c7",
7+
"metadata": {},
8+
"outputs": [],
9+
"source": []
10+
}
11+
],
12+
"metadata": {
13+
"kernelspec": {
14+
"display_name": "Python 3 (ipykernel)",
15+
"language": "python",
16+
"name": "python3"
17+
},
18+
"language_info": {
19+
"codemirror_mode": {
20+
"name": "ipython",
21+
"version": 3
22+
},
23+
"file_extension": ".py",
24+
"mimetype": "text/x-python",
25+
"name": "python",
26+
"nbconvert_exporter": "python",
27+
"pygments_lexer": "ipython3",
28+
"version": "3.13.5"
29+
}
30+
},
31+
"nbformat": 4,
32+
"nbformat_minor": 5
33+
}

0 commit comments

Comments
 (0)