Converts course material to naucse.python.cz API
Project description
naucse_render
Helper for converting course material in YAML/Markdown/Jupyter to naucse.python.cz JSON API.
Entrypoints
There are two public entrypoints: one for getting general course information; the other for a subset of lessons.
(This separation means the content doesn't need to be rendered to get course info.)
naucse_render.get_course(course_slug, *, path='.', version=None)
naucse_render.get_lessons(lesson_slugs, vars=None, path='.')
The path specifies the local filesystem path to the root of the repository
(i.e. parent directory of courses, runs and lessons).
Installation & Usage
Install the latest released version from PyPI. With an activated virtualenv, do:
(venv)$ pip install naucse_render
For development, you can instead install in editable mode
with dev dependencies:
(venv)$ pip install -e.[dev]
You can run naucse_render from the command line. To “compile” a course to a directory of JSON metadata and static files:
(venv)$ python -m naucse_render compile _built/
To output metadata for a course or individual lesson(s):
(venv)$ python -m naucse_render get-course
(venv)$ python -m naucse_render get-lessons beginners/install beginners/venv-setup
By default, data is retreived from the current working directory.
Use the --path option to point naucse_render elsewhere.
Tests
To run tests, install this package with development dependencies:
(venv)$ pip install -e.[dev]
then run the tests with pytest:
(venv)$ python -m pytest
License
The code is licensed under the terms of the MIT license, see LICENSE.MIT file for full text. By contributing code to this repository, you agree to have it licensed under the same license.
Changelog
naucse_render 1.5
-
A new subcommand,
compile, creates a directory with course data and supporting files. -
API version 0.3
- A course may have information about "edit info", specifying where the course's sources can be edited. (This is only set when compiling courses; in other cases, the caller should know where the code lives.)
-
The
slugis now optional; if not given (or None), the data is loaded fromcourse.yml(in the givenpath, by default the current directory) rather than a file inruns/orcourses/.
naucse_render 1.4
Compatible with nbconvert 6.0.
naucse_render 1.3
- Lesson directories without data are ignored (https://github.com/pyvec/naucse_render/issues/15)
- API version 0.2
- Subpages now have subtitles
- Non-
indexsubpages may optionally have asubtitle. For example, a lesson named "Installation" might have a OS-specific subpage with the subtitle "Linux". - If the
titleof a non-indexsubpage may now be missing in the input. In that case, thesubtitlemust be present, and thetitleis generated as"{lesson title} – {page subtitle}".
- Non-
- Timezone information is passed through
- Mappings read from YAML must have unique keys.
- Subpages may now be linked with relative URLs:
./page, just like other lessons can be linked with../lessonor../../category/lesson. ("Short" linking to subpages of other lessons, like, still doesn't work.)../lesson/page
naucse_render 1.2
- API version 0.1
- Serial "numbers" are now generated for sessions.
- Serials are strings (or None). Usually they are numeric (like
'1'), and in the source YAML they may be specified as int. But, for example, an appendix could use Roman numerals:i,ii,iii. - When a serial is not given in the source YAML explicitly, it is
auto-generated as the previous serial plus 1 (or from
1at the start). Serials specified as str (or None) prevent this auto-generation. - For courses with only one session, the serial is not auto-generated.
- Serials are strings (or None). Usually they are numeric (like
naucse_render 1.1
- Make it possible to use data from a YAML file in lesson content
- Make output the same on Windows as on "Unixy" systems
naucse_render 1.0
- Source files are always reported as relative paths
- YAML files are reloaded when they change
- Added integration tests
naucse_render 0.x
0.x should successfully render courses hosted on naucse.python.cz prior to 2019.
The format of the source files grew organically, so there is no attempt here to document it.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file naucse_render-1.5-py3-none-any.whl.
File metadata
- Download URL: naucse_render-1.5-py3-none-any.whl
- Upload date:
- Size: 19.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.5.0.1 requests/2.25.1 setuptools/58.0.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62cc3391babb34f5b33aa4bd71f070e6fa491c3de441471a80d49a6d4fda9e72
|
|
| MD5 |
2a1f5743af8558796b58f504c2663dd6
|
|
| BLAKE2b-256 |
c2193c79929d805f375a4f8c59eb0be12486f45131fb143f5e845f1077762907
|