Skip to main content

seamless conversion between Desmos LaTeX equations and executable Python code.

Project description

convert Desmos equations to executable Python code

Dependencies

Build/Dev

  • GNU Make

  • docker

Libraries

required

  • pandoc (e.g. apt-get install pandoc for Debian-based, or pacman -S pandoc for Arch Linux)

(optional) For headless browser functionality (uses ``selenium``):

  • pyenv

  • libxext6

  • libxt6

  • geckodriver and firefox

Compatibility

  • python3.10

  • NOTE: working on expanding compatibility…

  • NOTE: still a work in progress for sure.

Helpful tips

…definitely recommend using a virtual environment, e.g. via docker or conda.

Install

From PyPi:

python3 -m pip install desmos2python

Examples

DesmosLatexParser API Example:

import desmos2python as d2p

# `file` contains a JSON-formatted list of latex equations
# loads the example defined in 'resources/latex_json/ex.json'
dlp = d2p.DesmosLatexParser(file='ex.json')

# `pycode_string` contains the ready-to-eval Desmos model namespace
print(dlp.pycode_string)

# Instantiate a model namespace
# The attributes define any formulas, parameters from the specified Desmos graph
dmn = dlp.DesmosModelNS()

# for example, evaluate the function E(x) over the domain x=(1, 2, 3)
result = dmn.E([1, 2, 3])
print(result)

# see ./tests for more examples!

Development

  • Build locally: make build

  • Testing: pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

desmos2python-0.3.4.tar.gz (2.3 MB view details)

Uploaded Source

Built Distribution

desmos2python-0.3.4-py2.py3-none-any.whl (299.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file desmos2python-0.3.4.tar.gz.

File metadata

  • Download URL: desmos2python-0.3.4.tar.gz
  • Upload date:
  • Size: 2.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for desmos2python-0.3.4.tar.gz
Algorithm Hash digest
SHA256 36803b3d9f1fde20964405c63bec0bd062a58109bd8cdc60bf67016c0a7d7654
MD5 c7f7768e86b457523488d00cbee0e5d4
BLAKE2b-256 f7d3ce821fd255a22c6848a59b67d49f5680a50979c0c32ade517cef60829cc2

See more details on using hashes here.

File details

Details for the file desmos2python-0.3.4-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for desmos2python-0.3.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 13ef67c7eb9212b71349aaa35527a1bfd217cf4be9b8a2b5d786d810b752f73a
MD5 9407484de9a78d1cdea8a8f1608a9dd7
BLAKE2b-256 5f9e533a3aa3fe7acca2c7d9573d4aa86583fc2dd51649c53e4fd4bb0e7b2f38

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page