Skip to main content

HTML landing page generator for LSST PDF documentation deployed from Git to LSST the Docs.

Project description

Python Package Index

HTML landing page generator for LSST PDF documentation deployed from Git to LSST the Docs.

Installation

Lander works with Python 3.5 or above. You can install it from PyPI:

pip install lander

Run lander -h for command line help.

Usage

Basic usage

To create a landing page website, run lander with the local PDF file’s path:

lander --pdf <path>

The built PDF landing page site is available, by default, from the _build directory. View the site in a browser by running a Python web server:

cd _build && python -m http.server 8000 --bind 127.0.0.1

Get metadata from an lsstdoc document

With the --lsstdoc <tex path> argument, Lander will attempt to scrape metadata from the source of a lsstdoc-class LaTeX file, including:

  • abstract

  • authors

  • document handle

  • title

Note that Lander does not convert LaTeX commands to HTML. In these cases, the metadata needs to be added explicitly. We plan to address this in future releases.

See https://lsst-texmf.lsst.io for information about the lsstdoc class.

Get metadata from the Travis environment

If you’re running on Travis CI, set the --env=travis to get metadata from Travis’s environment variables:

  • $TRAVIS_COMMIT

  • $TRAVIS_BRANCH

  • $TRAVIS_TAG

  • $TRAVIS_REPO_SLUG

  • $TRAVIS_JOB_NUMBER

Overriding metadata

Lander tries to get as much metadata from the environment as possible, but sometimes this isn’t possible or usable. For example, Lander can’t (yet) convert LaTeX expressions into HTML. In this case you can explicitly set metadata with these flags (see lander -h for more information):

  • --abstract

  • --authors

  • --title

  • --handle (such as LDM-151)

  • --repo-url (such as https://github.com/lsst/ldm-151)

  • --repo-branch (such as master)

  • --date (such as 2017-05-22)

  • --docushare-url (prefer the multi-version form, https://ls.st/ldm-151*)

--authors should be a JSON-formatted array, even for a single author. For example:

--authors "[\"First Author\", \"Second Author\"]"

Distributing extra files from the landing page

To include ancillary files with the main PDF document, provide their file paths with the --extra-downloads path. These extra files are listed in the Downloads section of the landing page. The main PDF is always included first in this list.

--extra-downloads should be a JSON-formatted array, even for a single item. For example:

--extra-downloads "[\"demo.ipynb\"]"

Uploading to LSST the Docs

Lander works well with LSST the Docs. Lander can upload pages directly to LSST the Docs for you with these configurations:

  • --upload — provide this flag to indicate a build should be uploaded.

  • --ltd-product — Name of the product on LSST the Docs.

  • --keeper-url or $LTD_KEEPER_URL.

  • --keeper-user or $LTD_KEEPER_USER.

  • --keeper-password or $LTD_KEEPER_PASSWORD.

  • --aws-id or $LTD_AWS_ID.

  • --aws-secret or $LTD_AWS_SECRET.

Note: these are advanced configurations and are typically added to a CI configuration automatically or by a Documentation Engineer. Reach out to #dm-docs on Slack for help.

Development workflow

You need both Python 3.5+ and node.js to develop Lander.

Initial set up

Clone and install dependencies (use a Python virtual environment of your choice):

git clone https://github.com/lsst-sqre/lander
cd lander
npm install
gulp assets
pip install -r requirements.txt
python setup.py develop

Run Python tests and linting

We use pytest:

pytest

Build a test site

The default gulp workflow create website assets and generates a test website:

gulp

This gulp task runs a browsersync server and refreshes the page whenever CSS, JavaScript, or HTML assets change.

Only build assets

If you want to only build CSS, icon, and JavaScript assets, run this task:

gulp assets --env=deploy

This is how assets are built on CI for releases of Lander.

Developing CSS/Sass with squared

Lander uses squared for visual design. All Lander CSS should be committed to the squared repo so that LSST SQuaRE web projects share a common visual language.

To make it easier to write Sass in squared while developing landing pages in Lander, we recommend linking a clone of squared to Lander’s node_modules. Assuming you’re starting from the lander/ root directory:

git clone https://github.com/lsst-sqre/squared ../squared
npm link ../squared

Some patterns:

  • If you’re working on a branch in squared, then update squared’s version in package.json to that branch. For example: "squared": "lsst-sqre/squared#tickets/DM-10503". This allows Travis to install the development version of squared when testing Lander. Remember to make a release of squared before releasing a new version of Lander, see below.

  • scss/app.scss in the lander repo imports Sass partials from squared and other packages (including inuitcss).

Release workflow

  1. If squared was modified, create a squared release first.

  2. Update package.json with the released version of squared. Using tagged npm releases is preferred to GitHub branches to make builds of releases repeatable.

  3. Create a signed tag: git tag -s 0.1.0 -m "v0.1.0". Use the PEP 440 schema.

  4. Push the tag: git push --tags. This will automatically create a Lander release on PyPI.

  5. Merge the development branch as necessary.

License

This project is open sourced under the MIT license. See LICENSE for details.

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

lander-0.1.0b5.tar.gz (45.1 kB view details)

Uploaded Source

Built Distribution

lander-0.1.0b5-py3-none-any.whl (32.6 kB view details)

Uploaded Python 3

File details

Details for the file lander-0.1.0b5.tar.gz.

File metadata

  • Download URL: lander-0.1.0b5.tar.gz
  • Upload date:
  • Size: 45.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for lander-0.1.0b5.tar.gz
Algorithm Hash digest
SHA256 cbced5d3e4339803f8532bdbdaf926621e4e714230dcb81c0296e3d4694117a3
MD5 8db2ce5b44d6ec3b760d6a1ebe87aecd
BLAKE2b-256 8183073089f54fe76ed9be77ce0cede1d487e4c4bb38158a2fd957a729541492

See more details on using hashes here.

File details

Details for the file lander-0.1.0b5-py3-none-any.whl.

File metadata

File hashes

Hashes for lander-0.1.0b5-py3-none-any.whl
Algorithm Hash digest
SHA256 ee57fd41c76eac64f15183cc3f04bab8c085ce415eed216176c30e76d3be62ae
MD5 6c1168f7e44c028232da06c5ff9648de
BLAKE2b-256 5df923cb6699ed81559fa0a7cc1836a2017e6153f9d2e8790a54e72b3b8ba6a2

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