Skip to main content

A package for authoring and building PreTeXt documents.

Project description

PreTeXt-CLI

A package for authoring and building PreTeXt documents.

Installation

Installing Python

PreTeXt-CLI requires the Python version specified in .python-version.

To check your version, type this into your terminal or command prompt:

python -V

If your version is 2.x, try this instead (and if so, either replace all future references to python in these instructions with python3).

python3 -V

If you don't have a compatible Python available, try one of these:

Installing PreTeXt-CLI

Once you've confirmed that you're using a valid version of Python, just run (replacing python with python3 if necessary):

python -m pip install --user pretextbook

(It's also possible you may get an error like error: invalid command 'bdist_wheel' — good news, you can ignore it!)

After installation, try to run:

pretext --help

If that works, great! Otherwise, it likely means that Python packages aren't available on your “PATH”. In that case, replace all pretext commands with python -m pretext instead:

python -m pretext --help

Either way, the --help option will explain how to use all the different subcommands like pretext new and pretext build. Happy authoring!

Development

From the "Clone or Download" button on GitHub, copy the REPO_URL into the below command to clone the project.

git clone [REPO_URL]
cd pretext-cli

Using a valid Python installation

Developers and contributors are highly encouraged to install the exact version of Python that is specified in .python-version. All instructions assume that the Python on your path (e.g. the result of python -V) matches this version.

Using pyenv (Mac/Linux)

The pyenv tool for Linux automates the process of running the correct version of Python when working on this project (even if you have other versions of Python installed on your system).

$ pyenv install "$(cat .python-version)"
    # installs version set in `.python-version`
$ which python
/home/user/.pyenv/shims/python
$ python -V
Python (version set in `.python-version`)

Steps on Windows

In windows, you can either use the bash shell and follow the directions above, or try pyenv-win. In the latter case, make sure to follow all the installation instructions, including the Finish the installation. Then proceed to follow the directions above to install the version of python in .python-version. Finally, you may then need to manually add that version of python to your path.

Managing packages and virtual environments

Install pipenv to manage your Python packages:

python -m pip install --upgrade pip
python -m pip install pipenv

Then all additional dependencies can be installed into a virtual environment as follows:

$ python -m pipenv --rm
    # destroy any outdated environment
$ git pull
    # ensures your build versions locked by Pipfile.lock
$ python -m pipenv install --dev
    # creates virtual environment and installs dependencies

Then use python -m pipenv shell to enter the virtual environment directly.

$ python -m pipenv shell
Launching subshell in virtual environment…
$ cd
$ pretext new
Generating new PreTeXt project in `/home/user/new-pretext-project` using `book` template.

You can also use python -m pipenv run [CMD] for quick runs outside the virtual environment, e.g.:

$ python -m pipenv run pretext new

Updating dependencies

To add dependencies for the package, edit setup.py. then run

python -m pipenv update

To add dependencies for the development environment (those not needed to use the packaged CLI), use

python -m pipenv install [package] --dev

To update dependencies added by other contributors, use

python -m pipenv sync

Syncing untracked updates

Updates to certain files tracked to the repository will need to be rebuilt by each user when pulled from GitHub.

The file pretext/static/CORE_COMMIT tracks the upstream commit of core PreTeXt XSL/Python code we're developing against (from rbeezer/mathbook). To grab these updates from upstream, run:

python scripts/update_core.py

Updates to templates/ must be zipped and moved into pretext/static/templates. This is done automatically by running:

python scripts/zip_templates.py

Packaging

See https://packaging.python.org/tutorials/packaging-projects/. Inside a virtual environment:

python scripts/build_release.py

Versioning

See VERSIONING.md.

About

Lead Contributors

About PreTeXt

The development of PreTeXt's core is led by Rob Beezer.

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 Distribution

pretextbook-0.3rc4.tar.gz (898.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pretextbook-0.3rc4-py3-none-any.whl (981.2 kB view details)

Uploaded Python 3

File details

Details for the file pretextbook-0.3rc4.tar.gz.

File metadata

  • Download URL: pretextbook-0.3rc4.tar.gz
  • Upload date:
  • Size: 898.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.5

File hashes

Hashes for pretextbook-0.3rc4.tar.gz
Algorithm Hash digest
SHA256 f389f8ab882799aa71558200612aa45d357a65964eda284f36d5713c391c3239
MD5 2a71db6a4bdb1b0ee306e64d44f78ba9
BLAKE2b-256 9958bcb2a801516f01e6c11aebf3a161812651d4f64638889a468d8b3282df96

See more details on using hashes here.

File details

Details for the file pretextbook-0.3rc4-py3-none-any.whl.

File metadata

  • Download URL: pretextbook-0.3rc4-py3-none-any.whl
  • Upload date:
  • Size: 981.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.5

File hashes

Hashes for pretextbook-0.3rc4-py3-none-any.whl
Algorithm Hash digest
SHA256 f17dceaf01f9af6f911f776cbfb670f789d5e4b801203fa97aa5108bdb83af99
MD5 4acb69aa4cadf4c223b3b2328142f13e
BLAKE2b-256 5efcdf5c72438f004a8ceae45696fad029db985432bbb04bd2e2538f9ea3ff45

See more details on using hashes here.

Supported by

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