# pythonimmediate-tex
[](https://pypi.python.org/pypi/pythonimmediate-tex/)
[](https://pythonimmediate.readthedocs.io)
[](https://ctan.org/pkg/pythonimmediate)
A library to facilitate bidirectional communication between Python and TeX,
with support of manipulating TeX tokens as Python objects.
Background: this library started as...
* I get annoyed at programming in TeX and want to use a proper programming language, and
* Almost all the current packages that allow programming in Python runs a separate Python pass from TeX,
which requires using temporary file and
* `pythontex` does not work on Overleaf.
Thus, the library name is named after the second point -- the `python` and `tex` process are run in parallel,
bidirectional communications are supported.
Since then, the library has grown considerably, although not in a particular direction, as I add features when I need it.
Occasionally (but rarely), refactors are done.
As such, I don't guarantee any particular use case for this library -- except for my own use cases.
Along the way, I added some useful features to use Python inside packages. (`\pycodekpse`)
A handful of my packages are written using this library, directly or indirectly. (`typstmathinput`, `unicode-math-input`)
------
The TeX package is available on CTAN: https://ctan.org/pkg/pythonimmediate
The Python package is available on PyPI: https://pypi.org/project/pythonimmediate-tex/
with documentation on Read the Docs: https://pythonimmediate.readthedocs.io
------
Description of the TeX package follows.
> Just like PerlTeX or PyLuaTeX (and unlike PythonTeX or lt3luabridge),
> this only requires a single run, and variables are persistent throughout the run.
>
> Unlike PerlTeX or PyLuaTeX, there's no restriction on compiler or script required to run the code.
>
> There's also debugging functionalities -- TeX errors results in Python traceback, and Python error results in TeX traceback.
> Errors in code executed with the `pycode` environment gives the correct traceback point to the Python line of code in the TeX file.
>
> For advanced users, this package allows the user to manipulate the TeX state directly from within Python,
> so you don't need to write a single line of TeX code.
------
### Internal note
`tex/` folder contains TeX-related files. The source code of the package is in `tex/pythonimmediate.sty`.
To create the documentation:
```
# sphinx-quickstart docs --sep -p pythonimmediate-tex -a user202729 -r '' -l en
rm docs/pythonimmediate.rst
SPHINX_APIDOC_OPTIONS='members,show-inheritance' sphinx-apidoc --full -o docs pythonimmediate
cd docs
make html
```
To autobuild the documentation
```
cd docs
sphinx-autobuild . /tmp/_build/ --watch ..
```
To create a tag
```
git tag 0.3.0
git push --tags
```
not that the output directory matters, just visit the documentation at `localhost:8000`.
Looks like it's not easy to write the docstrings in Markdown, see https://stackoverflow.com/q/56062402/5267751
There's some unresolved `$ is not defined` issue -- there's https://github.com/readthedocs/readthedocs.org/issues/9414 but it's unrelated
Maybe take a look at mkdocs/mkdocstrings later
Raw data
{
"_id": null,
"home_page": "https://github.com/user202729/pythonimmediate-tex",
"name": "pythonimmediate-tex",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "user202729",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/22/7c/58e9ffa2cc97bac8be7f9c9ba7f6d9b70ae5a4e88e13e62bff97ebf65c38/pythonimmediate-tex-0.6.0.zip",
"platform": null,
"description": "# pythonimmediate-tex\n\n[](https://pypi.python.org/pypi/pythonimmediate-tex/)\n[](https://pythonimmediate.readthedocs.io)\n[](https://ctan.org/pkg/pythonimmediate)\n\nA library to facilitate bidirectional communication between Python and TeX,\nwith support of manipulating TeX tokens as Python objects.\n\nBackground: this library started as...\n* I get annoyed at programming in TeX and want to use a proper programming language, and\n* Almost all the current packages that allow programming in Python runs a separate Python pass from TeX,\nwhich requires using temporary file and\n* `pythontex` does not work on Overleaf.\n\nThus, the library name is named after the second point -- the `python` and `tex` process are run in parallel,\nbidirectional communications are supported.\n\nSince then, the library has grown considerably, although not in a particular direction, as I add features when I need it.\nOccasionally (but rarely), refactors are done.\n\nAs such, I don't guarantee any particular use case for this library -- except for my own use cases.\nAlong the way, I added some useful features to use Python inside packages. (`\\pycodekpse`)\n\nA handful of my packages are written using this library, directly or indirectly. (`typstmathinput`, `unicode-math-input`)\n\n------\n\nThe TeX package is available on CTAN: https://ctan.org/pkg/pythonimmediate\n\nThe Python package is available on PyPI: https://pypi.org/project/pythonimmediate-tex/\nwith documentation on Read the Docs: https://pythonimmediate.readthedocs.io\n\n------\n\nDescription of the TeX package follows.\n\n> Just like PerlTeX or PyLuaTeX (and unlike PythonTeX or lt3luabridge),\n> this only requires a single run, and variables are persistent throughout the run.\n> \n> Unlike PerlTeX or PyLuaTeX, there's no restriction on compiler or script required to run the code.\n> \n> There's also debugging functionalities -- TeX errors results in Python traceback, and Python error results in TeX traceback.\n> Errors in code executed with the `pycode` environment gives the correct traceback point to the Python line of code in the TeX file.\n> \n> For advanced users, this package allows the user to manipulate the TeX state directly from within Python,\n> so you don't need to write a single line of TeX code.\n\n------\n\n### Internal note\n\n`tex/` folder contains TeX-related files. The source code of the package is in `tex/pythonimmediate.sty`.\n\nTo create the documentation:\n\n```\n# sphinx-quickstart docs --sep -p pythonimmediate-tex -a user202729 -r '' -l en\n\nrm docs/pythonimmediate.rst\nSPHINX_APIDOC_OPTIONS='members,show-inheritance' sphinx-apidoc --full -o docs pythonimmediate\ncd docs\nmake html\n```\n\nTo autobuild the documentation\n\n```\ncd docs\nsphinx-autobuild . /tmp/_build/ --watch ..\n```\n\nTo create a tag\n\n```\ngit tag 0.3.0\ngit push --tags\n```\n\nnot that the output directory matters, just visit the documentation at `localhost:8000`.\n\nLooks like it's not easy to write the docstrings in Markdown, see https://stackoverflow.com/q/56062402/5267751\n\nThere's some unresolved `$ is not defined` issue -- there's https://github.com/readthedocs/readthedocs.org/issues/9414 but it's unrelated\n\nMaybe take a look at mkdocs/mkdocstrings later\n",
"bugtrack_url": null,
"license": "LPPL 1.3c",
"summary": "Python helper for TeX library to run Python code",
"version": "0.6.0",
"project_urls": {
"Homepage": "https://github.com/user202729/pythonimmediate-tex"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "227c58e9ffa2cc97bac8be7f9c9ba7f6d9b70ae5a4e88e13e62bff97ebf65c38",
"md5": "c8a858853448b85fe97dd9e0463e15c2",
"sha256": "447c1ad62f17f88e64f8ca242cd4d83d58fc372b30d67663ec76453faa0ec6ec"
},
"downloads": -1,
"filename": "pythonimmediate-tex-0.6.0.zip",
"has_sig": false,
"md5_digest": "c8a858853448b85fe97dd9e0463e15c2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 108238,
"upload_time": "2024-01-17T21:12:42",
"upload_time_iso_8601": "2024-01-17T21:12:42.085290Z",
"url": "https://files.pythonhosted.org/packages/22/7c/58e9ffa2cc97bac8be7f9c9ba7f6d9b70ae5a4e88e13e62bff97ebf65c38/pythonimmediate-tex-0.6.0.zip",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-17 21:12:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "user202729",
"github_project": "pythonimmediate-tex",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pythonimmediate-tex"
}