Skip to main content

A tool for test-driven teaching.

Project description

tanco

A test-driven teaching environment for programmers.

This is a work in progress. There are videos about it on:

https://www.youtube.com/@tangentstream

If your goal is to work through a coding challenge, detailed setup instructions are here:

https://tangentcode.com/setup

Installation

There are two main ways to install Tanco:

1. From PyPI (Recommended for users):

If you just want to use Tanco to follow a course or run tests, you can install it directly from the Python Package Index (PyPI):

pip install tanco

You can find the package details on PyPI.

2. Editable Install (Recommended for developers):

If you plan to contribute to Tanco development or want the latest changes, clone the repository and install it in editable mode:

git clone https://github.com/tangentcode/tanco.git
cd tanco
pip install -e .

This command links the installed package to your local source code, so any changes you make are immediately effective.

Using the Client

tanco login
cd /path/to/your/project
tanco init
tanco test     # keep doing this until it passes
git commit    # once the test passes
tanco next     # to fetch the next test

inspecting the database

Tanco (both the client and server) creates a sqlite database in ~/.tanco.sdb.

You can override this location by setting the TANCO_SDB environment variable to a different path.

You can inspect the database with the sqlite3 command-line tool.

sqlite3 ~/.tanco.sdb
.schema

Running the Server

First set up a private key, then run quart or hypercorn.

Private Key

The tanco login command lets the command-line client log into the server in a multi-user setup.

In this setup, the server uses a private key to sign a json web token.

To set up the private key, do this:

cd /path/to/tanco-server
ssh-keygen -t rsa -b 4096 -m PEM -f tanco_auth_key.pem

This will also create a public key in tanco_auth_key.pem.pub. This is not currently used for anything.

Running the server

You can run the development server like so:

bash QUART_APP=tanco.app:app quart run # --reload

Or (on platforms that support it) use hypercorn:

hypercorn tanco.app:app # --reload

Local Usage

Tanco is primarily used via its command-line interface.

Running Local Tests from Org Files:

Tanco can now run tests defined directly within an .org file, independent of the server. This is useful for local development, testing, and creating new challenges.

Use the run command with the --tests flag:

tanco run --tests path/to/your/tests.org [program_and_args...]
  • --tests path/to/your/tests.org: Specifies the org file containing the test definitions (using #+name:, #+begin_src, etc.).
  • [program_and_args...]: The command and arguments needed to execute the program being tested.
    • If your program needs to be run via the shell (e.g., using interpreters like node or python), prefix the command with -c. For example:
      tanco run --tests tests.org -c 'node your_script.js'
      tanco run --tests tests.org -c 'python your_script.py arg1'
      
    • If your program is a direct executable (like myprogram.exe on Windows or ./myprogram on Linux), just provide the path and arguments:
      tanco run --tests tests.org path/to/your_program arg1 arg2
      

Verbose Output:

You can add the -v or --verbose flag to the run command to print the configuration Tanco is using before executing the tests. This is helpful for debugging paths and arguments:

tanco run -v --tests tests.org ...

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

tanco-0.2.0.tar.gz (88.3 kB view details)

Uploaded Source

Built Distribution

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

tanco-0.2.0-py3-none-any.whl (88.8 kB view details)

Uploaded Python 3

File details

Details for the file tanco-0.2.0.tar.gz.

File metadata

  • Download URL: tanco-0.2.0.tar.gz
  • Upload date:
  • Size: 88.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.0

File hashes

Hashes for tanco-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c005a53abd2b33d3dbc4dfd76fb2405fad85fe3e8209358d474185bf3b761d6c
MD5 f8979ae465905fd2a4f8a9cc1055becc
BLAKE2b-256 52bc4aa83faddbe7b59984eda7e7acfc0bc487d06f0f0288b74e58ef033a39bc

See more details on using hashes here.

File details

Details for the file tanco-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: tanco-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 88.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.0

File hashes

Hashes for tanco-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d5139d0de5efcd89a426e700bac2a92a0bb0385e2dd5a57fe13e160d66ef9a7d
MD5 8769f909fc96507b7b19fb1ed5eb3937
BLAKE2b-256 ff23f5ca8fa0335572bcee22a35979779a5ba943851884db0e63ae6964e09861

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