-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use virtual environments for development #181
base: master
Are you sure you want to change the base?
Changes from all commits
1535486
6d84461
7cd8559
cf40e1f
f282d3c
7ba9ce1
5713820
3f18231
c172aaf
9ac202d
6642c68
aed4fa1
71c42e1
e7d26e9
ebb9762
12a77b1
d44598c
cbc39a7
548add8
7f68078
ecc3bc8
be7b0c1
5161d44
4e346e3
d2393e3
eb139cd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,96 @@ | ||
version: 2 | ||
version: 2.1 | ||
|
||
commands: | ||
install-and-check: | ||
parameters: | ||
python: | ||
type: string | ||
|
||
steps: | ||
- run: | ||
name: upgrade pip and friends | ||
command: | | ||
<< parameters.python >> -m pip install \ | ||
pip==22.3 \ | ||
setuptools==65.5.0 \ | ||
wheel==0.38.0 | ||
|
||
- run: | ||
name: install ultratrace | ||
command: | | ||
<< parameters.python >> -m pip install \ | ||
--requirement ./requirements-dev.txt | ||
|
||
- run: nox | ||
|
||
jobs: | ||
build: | ||
ubuntu: | ||
docker: | ||
- image: circleci/python:3.7.2 | ||
- image: ubuntu:18.04 | ||
steps: | ||
- checkout | ||
- run: ./install.sh | ||
- run: sudo pip install boto3 mypy_boto3_s3 nox | ||
- run: ./scripts/download-test-data | ||
- run: nox | ||
|
||
- run: | ||
name: install system packages | ||
command: | | ||
export DEBIAN_FRONTEND=noninteractive | ||
apt-get update | ||
apt-get install --yes \ | ||
portaudio19-dev \ | ||
python3.8 \ | ||
python3.8-dev \ | ||
python3.8-venv \ | ||
python3-pip \ | ||
python3-tk | ||
|
||
- install-and-check: | ||
python: python3.8 | ||
|
||
fedora: | ||
docker: | ||
- image: fedora:35 | ||
steps: | ||
- checkout | ||
|
||
- run: | ||
name: install system packages | ||
command: | | ||
dnf --assumeyes install \ | ||
https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm \ | ||
https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm | ||
dnf --assumeyes update | ||
dnf --assumeyes install \ | ||
gcc \ | ||
portaudio-devel \ | ||
python3-devel \ | ||
python3-tkinter \ | ||
python3-pip | ||
|
||
- install-and-check: | ||
python: python3.10 | ||
|
||
macos: | ||
macos: | ||
xcode: 13.2.1 # latest for Big Sur | ||
environment: | ||
# https://circleci.com/docs/using-macos/#optimizing-homebrew | ||
HOMEBREW_NO_AUTO_UPDATE: 1 | ||
steps: | ||
- checkout | ||
|
||
- run: | ||
name: install system packages | ||
command: | | ||
brew install \ | ||
portaudio \ | ||
[email protected] | ||
|
||
- install-and-check: | ||
python: python3.9 | ||
|
||
workflows: | ||
main: | ||
jobs: | ||
- ubuntu | ||
- fedora | ||
- macos |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# UltraTrace | ||
|
||
This is a tool for [currently] manual annotation of 2D UTI (Ultrasound Tongue Imaging) data. | ||
|
||
You can have a look at our [UltraFest IX presentation](https://swatphonlab.github.io/2020-UltraTrace-presentation/presentation.html) for some details on featureset and functionality as of October, 2020. | ||
|
@@ -8,39 +9,89 @@ You can have a look at our [UltraFest IX presentation](https://swatphonlab.githu | |
|
||
## Installation | ||
|
||
### Linux (apt or dnf) | ||
This tool requires the following system packages to be installed: | ||
|
||
* [`portaudio`](http://www.portaudio.com/) | ||
* [`python3`](https://www.python.org/) (3.7 or later) | ||
|
||
Additionally, you'll need the following Python components (which are sometimes distributed separately): | ||
|
||
* [Python development headers](https://devguide.python.org/getting-started/setup-building/#install-dependencies) | ||
* [`pip`](https://pypi.org/project/pip/) | ||
* [`tkinter`](https://docs.python.org/3/library/tkinter.html) | ||
* [`venv`](https://docs.python.org/3/library/venv.html) | ||
|
||
1. Download the UltraTrace source code, e.g. using `git`. | ||
2. Run setup in the UltraTrace directory: | ||
```bash | ||
$ ./install.sh | ||
$ python3 setup.py install | ||
See below for platform-specific installation instructions: | ||
* [Ubuntu](#ubuntu) | ||
* [Fedora](#fedora) | ||
* [macOS](#macos) | ||
* [Windows](#windows) | ||
|
||
Once these libraries are installed, you can just `pip install` the package with | ||
|
||
```sh | ||
$ python3 -m pip install -r ./requirements.txt | ||
``` | ||
|
||
### macOS | ||
NOTE: For hacking on `ultratrace` itself, see [Development](#development) below. | ||
|
||
1. Install [Homebrew](https://brew.sh). | ||
2. Download the UltraTrace source code, e.g. using `git`. | ||
3. Use Homebrew to install python3: | ||
```bash | ||
$ brew install python3 | ||
NOTE: You probably want to install into a [virtual environment](https://docs.python.org/3/tutorial/venv.html) to avoid conflicts with system packages. Alternatively, you can do a [`--user` installation](https://pip.pypa.io/en/latest/user_guide/#user-installs). | ||
|
||
### Ubuntu | ||
|
||
Supported versions: 18.04, 20.04 | ||
|
||
```sh | ||
$ apt-get update | ||
$ apt-get install --yes \ | ||
portaudio19-dev \ | ||
python3.8 \ | ||
python3.8-dev \ | ||
python3.8-venv \ | ||
python3-pip \ | ||
python3-tk | ||
``` | ||
4. Run setup in the UltraTrace directory: | ||
```bash | ||
$ python3 setup.py install | ||
|
||
### Fedora | ||
|
||
Supported versions: 35, 36, 37 | ||
|
||
```sh | ||
$ dnf --assumeyes install \ | ||
https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm \ | ||
https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm | ||
$ dnf --assumeyes update | ||
$ dnf --assumeyes install \ | ||
gcc \ | ||
portaudio-devel \ | ||
python3-devel \ | ||
python3-tkinter \ | ||
python3-pip | ||
``` | ||
|
||
### macOS | ||
|
||
Supported versions: Big Sur, Monterey | ||
|
||
These instructions use the [Homebrew](https://brew.sh) package manager. | ||
|
||
```sh | ||
$ brew update | ||
$ brew install \ | ||
portaudio \ | ||
[email protected] | ||
``` | ||
|
||
### Windows | ||
|
||
1. Install python3 | ||
2. Make sure you have pip | ||
3. Install ffmpeg and add to PATH | ||
4. Run `setup.py` | ||
TODO | ||
|
||
## Usage | ||
|
||
## Use | ||
Once [installed](#installation), you can just run | ||
|
||
```bash | ||
$ python3 -m ultratrace /path/to/data | ||
```sh | ||
$ ultratrace path/to/data | ||
``` | ||
|
||
### Data format | ||
|
@@ -72,14 +123,31 @@ The theme should just look right on Mac. | |
|
||
#### Setting the theme on linux | ||
|
||
Use pip3 to install ttkthemes. | ||
We use [`ttkthemes`](https://ttkthemes.readthedocs.io/en/latest/). | ||
|
||
Add the following line to your `~/.Xresources` file: | ||
|
||
``` | ||
*TtkTheme: arc | ||
``` | ||
|
||
You may select something other than clam for your theme. Currently, the main options are something like this: `arc`, `plastik`, `clearlooks`, `elegance`, `radiance`, `equilux`, `black`, `smog`, `scidblue`, etc. See the [ttkthemes documentation](https://ttkthemes.readthedocs.io/) for more information. | ||
|
||
Otherwise it'll fall back to `*TtkTheme`, and if that's not specified in `~/.Xresources`, it'll fall back to `clam`. | ||
|
||
## Development | ||
|
||
To hack on `ultratrace`, you should first [install all required system libraries](#installation). Then, you can set up a development environment by running | ||
|
||
```sh | ||
$ source dev/env.sh | ||
``` | ||
|
||
To lint/test `ultratrace`, use [`nox`](https://nox.thea.codes/en/stable/): | ||
```sh | ||
$ nox --help | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't say how to do anything specific. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, maybe it would be better to just say to run
There's more info if you follow that link to their docs, but basically running plain |
||
``` | ||
|
||
To exit the development environment, just run | ||
```sh | ||
$ deactivate | ||
``` |
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
# | ||
# Set up a development environment for 'ultratrace'. | ||
# | ||
# Note that since this script is meant to be "source"d, we can't use | ||
# the "set -euo pipefail" idiom (since that means that we would set | ||
# those shell options in our host environment (this would cause bash | ||
# to exit if we ran any command returning a non-zero exit code)). | ||
|
||
export ULTRATRACE_ROOT="$(git rev-parse --show-toplevel)" | ||
export ULTRATRACE_VENV="$ULTRATRACE_ROOT/venv/ultratrace" | ||
export ULTRATRACE_PYTHON="${ULTRATRACE_PYTHON:-python3}" | ||
|
||
# Create a virtual environment if we don't already have one. | ||
if [ ! -e "$ULTRATRACE_VENV/bin/activate" ]; then | ||
echo "Creating a virtual environment at '$ULTRATRACE_VENV'" >&2 | ||
rm -rf "$ULTRATRACE_VENV" | ||
"$ULTRATRACE_PYTHON" -m venv "$ULTRATRACE_VENV" | ||
fi | ||
|
||
# Activate the virtual environment. | ||
source "$ULTRATRACE_VENV/bin/activate" | ||
|
||
pip install --upgrade \ | ||
pip==22.3 \ | ||
setuptools==65.5.0 \ | ||
wheel==0.38.0 | ||
|
||
pip install \ | ||
--requirement "$ULTRATRACE_ROOT/requirements-dev.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what else to say here.. I don't know how to install system packages on Windows. Maybe we should remove this section altogether? Once the system packages are installed, everything else should be the same...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not, because of non-Python library dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this is what I mean by "system packages".