Skip to main content

No project description provided

Project description

dotrun

A tool for developing Node.js and Python projects

dotrun

dotrun makes use of a Docker image to provide a predictable sandbox for running Node and Python projects.

Features:

  • Make use of standard package.json script entrypoints:
    • dotrun runs yarn run start within the snap confinement
    • dotrun foo runs yarn run foo within the snap confinement
  • Detect changes in package.json and only run yarn install when needed
  • Detect changes in requirements.txt and only run pip3 install when needed
  • Run scripts using environment variables from .env and .env.local files
  • Keep python dependencies in .venv in the project folder for easy access

Usage

$ dotrun          # Install dependencies and run the `start` script from package.json
$ dotrun clean    # Delete `node_modules`, `.venv`, `.dotrun.json`, and run `yarn run clean`
$ dotrun install  # Force install node and python dependencies
$ dotrun exec     # Start a shell inside the dotrun environment
$ dotrun exec {command}          # Run {command} inside the dotrun environment
$ dotrun {script-name}           # Install dependencies and run `yarn run {script-name}`
$ dotrun -s {script}             # Run {script} but skip installing dependencies
$ dotrun --env FOO=bar {script}  # Run {script} with FOO environment variable

Installation

Requirements

  • Linux / macOS
  • Docker (Get Docker)
  • Python > 3.6 and PIP

macOS performance

For optimal performance on Docker we recommend enabling a new experimental file sharing implementation called virtiofs. Virtiofs is only available to users of the following macOS versions:

  • macOS 12.2 and above (for Apple Silicon)
  • macOS 12.3 and above (for Intel)

How to enable virtiofs

Add dotrun on new projects

To fully support dotrun in a new project you should do the following:

  • For Python projects, ensure Talisker is at 0.16.0 or greater in requirements.txt
  • Add .dotrun.json and .venv to .gitignore
  • Create a start script in package.json to do everything needed to set up local development. E.g.: "start": "concurrently --raw 'yarn run watch' 'yarn run serve'"
    • The above command makes use of concurrently - you might want to consider this
  • Older versions of Gunicorn are incompatible with strict confinement so we need Gunicorn >= 20
    • The update landed in Talisker but at the time of writing hasn't made it into a new version
    • If there's no new version of Talisker, simply add gunicorn==20.0.4 to the bottom of requirements.txt

However, once you're ready to completely switch over to dotrun, simply go ahead and remove the run script.

Testing

The test folder contains a bunch of tests, written in Python, against the dotrun binary, using example projects in the test/fixtures folder.

These tests can be run against the current codebase:

python3 -m venv .venv  # Create a python environment for testing
source .venv/bin/activate
pip3 install -e .  # Install the dotrun module as a python package
python3 -m unittest discover --start-directory tests  # Run the tests against the installed python package

Automated tests of pull requests

The "PR" action builds the Python package and runs the tests, similar to the solution above. This will run against every pull request.

Publish

All the changes made to the main branch will be automatically published as a new version on PyPI.

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

dotrun-2.0.0a0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

dotrun-2.0.0a0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file dotrun-2.0.0a0.tar.gz.

File metadata

  • Download URL: dotrun-2.0.0a0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for dotrun-2.0.0a0.tar.gz
Algorithm Hash digest
SHA256 2de70b34c9bfd627235ddd48019f5217ac7f389ed5e8afdf4c8b7ed4f1948515
MD5 f8e63a2d2434b2345d38d385755fda66
BLAKE2b-256 1931b743848254b13f0a869cc0353268e8ec2192b9028699f0a508ae9884f817

See more details on using hashes here.

File details

Details for the file dotrun-2.0.0a0-py3-none-any.whl.

File metadata

  • Download URL: dotrun-2.0.0a0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for dotrun-2.0.0a0-py3-none-any.whl
Algorithm Hash digest
SHA256 d0d5234763b84474f65a4eadcf3547fa63d412ff963d8ac5d6376ea450c791d0
MD5 c00585809377539300624bfb15272d56
BLAKE2b-256 8fdd9596ae5e6a38ea7882851cd5d53e4b0c3c34bad2e1ed6be49cb81a03b0a0

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