|
39 | 39 | "cell_type": "markdown", |
40 | 40 | "metadata": {}, |
41 | 41 | "source": [ |
42 | | - "# development" |
| 42 | + "## usage" |
43 | 43 | ] |
44 | 44 | }, |
45 | 45 | { |
46 | | - "cell_type": "markdown", |
| 46 | + "cell_type": "code", |
| 47 | + "execution_count": null, |
47 | 48 | "metadata": {}, |
| 49 | + "outputs": [], |
48 | 50 | "source": [ |
49 | | - "assuming you have [nix](https://nixos.org/download.html) installed and ready, make sure `nix-command` and `flake` are enabled (oneliner: run `export NIX_CONFIG=\"experimental-features = nix-command flakes\"` in the terminal), then enter the dev shell using `nix develop`\n", |
| 51 | + "from schematized_config.core import ConfigValidator" |
| 52 | + ] |
| 53 | + }, |
| 54 | + { |
| 55 | + "cell_type": "code", |
| 56 | + "execution_count": null, |
| 57 | + "metadata": {}, |
| 58 | + "outputs": [], |
| 59 | + "source": [ |
| 60 | + "import os\n", |
| 61 | + "import os.path as _p\n", |
50 | 62 | "\n", |
51 | | - "start the jupyter notebook using the provided alias or just `jupyter notebook`, and hack away" |
| 63 | + "if _p.exists('.env') and 'CONFIG_VALIDATOR_JSON_SCHEMA' in os.environ:\n", |
| 64 | + " ConfigValidator.load_dotenv() # use defaults of .env and CONFIG_VALIDATOR_JSON_SCHEMA" |
52 | 65 | ] |
53 | 66 | }, |
54 | 67 | { |
55 | 68 | "cell_type": "markdown", |
56 | 69 | "metadata": {}, |
57 | 70 | "source": [ |
58 | | - "## How to use" |
| 71 | + "# development" |
59 | 72 | ] |
60 | 73 | }, |
61 | 74 | { |
62 | | - "cell_type": "code", |
63 | | - "execution_count": null, |
| 75 | + "cell_type": "markdown", |
64 | 76 | "metadata": {}, |
65 | | - "outputs": [], |
66 | 77 | "source": [ |
67 | | - "from schematized_config.core import ConfigValidator" |
| 78 | + "<details>\n", |
| 79 | + " <summary>entering the development environment</summary>\n", |
| 80 | + "assuming you have [nix](https://nixos.org/download.html) installed and ready, make sure `nix-command` and `flake` are enabled (oneliner: run `export NIX_CONFIG=\"experimental-features = nix-command flakes\"` in the terminal), then enter the dev shell using `nix develop`\n", |
| 81 | + "\n", |
| 82 | + "start the jupyter notebook using the provided alias or just `jupyter notebook`, and hack away\n", |
| 83 | + "</details>" |
68 | 84 | ] |
69 | 85 | }, |
70 | 86 | { |
71 | | - "cell_type": "code", |
72 | | - "execution_count": null, |
| 87 | + "cell_type": "markdown", |
73 | 88 | "metadata": {}, |
74 | | - "outputs": [], |
75 | 89 | "source": [ |
76 | | - "import os\n", |
77 | | - "import os.path as _p\n", |
| 90 | + "## nbdev\n", |
78 | 91 | "\n", |
79 | | - "if _p.exists('.env') and 'CONFIG_VALIDATOR_JSON_SCHEMA' in os.environ:\n", |
80 | | - " ConfigValidator.load_dotenv() # use defaults of .env and CONFIG_VALIDATOR_JSON_SCHEMA" |
| 92 | + "this package is developed using [nbdev](https://nbdev.fast.ai/), so we use an nbdev-centric development flow. For a quick guide, we recommend checking out the [end-to-end walkthrough](https://nbdev.fast.ai/tutorials/tutorial.html). But in short: edit notebooks, then run the `nbdev_*` management commands. The most essential flow is as follows:\n", |
| 93 | + "\n", |
| 94 | + "1. edit the notebook files (core fore core, and cli for the command line interface)\n", |
| 95 | + "1. `python setup.py install` # note we don't use `nbdev_install` because we manage `quarto` using `nix`\n", |
| 96 | + "1. `nbdev_prepare`\n", |
| 97 | + "1. run code using the package\n", |
| 98 | + "1. `nbdev_release`\n", |
| 99 | + "1. `nbdev_pypi`\n", |
| 100 | + "\n", |
| 101 | + "### running tests\n", |
| 102 | + "\n", |
| 103 | + "if you share variables between cells in your test blocks, this causes trouble during `nbdev_prepare` as it tries to run cells in isolation, leading to e.g.\n", |
| 104 | + "\n", |
| 105 | + "```\n", |
| 106 | + "NameError: name 'example_properties_schema' is not defined\n", |
| 107 | + "```\n", |
| 108 | + "\n", |
| 109 | + "to deal with this, you can merge cells that use a common variable\n", |
| 110 | + "\n", |
| 111 | + "### updating package dependencies\n", |
| 112 | + "\n", |
| 113 | + "note that package dependencies are specified in [settings.ini](./settings.ini); you shouldn't be editing `setup.py` by hand. To add a requirement, add it to the `requuirements` entry in `settings.ini`, then run `python setup.py install`" |
81 | 114 | ] |
82 | 115 | } |
83 | 116 | ], |
|
0 commit comments