AMY is a web-based workshop administration application for The Carpentries and related projects. Its target audience is workshop coordinators, most of whom are non-programmers, who need to keep track of what workshops are being arranged, when they're supposed to occur, who's teaching what, and so on.
AMY is built using Django with Python 3, with a bit of Javascript and other things thrown in. If you would like to help, please read:
the setup instructions below,
the contributor guidelines, and
Please check with us or open an issue before starting work on new features.
You will need the python3 and libpq development header libraries installed on your system. For an example with Debian-based (Ubuntu, etc) distributions of Linux, you can install them with:
sudo apt-get update
sudo apt-get install python3-dev libpq-dev
Clone the repository:
git clone https://github.com/carpentries/amy.git
cd amy
Configure git to automatically ignore revisions in the .git-blame-ignore-revs
:
git config blame.ignoreRevsFile .git-blame-ignore-revs
Install Pipenv:
python -m pip install --user pipenv
Install Python dependencies:
pipenv sync --dev
Note:
Pipenv will create a new virtual environment for this installation, so you don't
have to create one yourself.
The --dev
flag installs development dependencies, required e.g. for testing.
Install node for front-end packages management.
Install CSS, JS dependencies with (npm
was installed in previous step when you
installed node
):
npm install
Start running a local instance of Postgres and Redis. This requires Docker to be installed locally. Redis is required to have certain features (like creating a new person and viewing a workshop request) work correctly.
docker compose -f docker/docker-compose.yml -p amy up -d database redis
Set up your local database with fake (development-ready) data. This will create a superuser with "admin" as both the username and password.
pipenv run make dev_database
Start a local Django development server by running:
pipenv run make serve
Note: this also installs front-end dependencies for AMY, including jQuery and Bootstrap (full list here).
Open http://127.0.0.1:8000/workshops/ in your browser and start clicking. Use the default "admin" as username and password.
Shut down the local server by typing Ctrl-C
. Shut down the Docker Redis instance with:
docker compose -f docker/docker-compose.yml -p amy down
LAST_COMMIT=`git rev-parse --short HEAD`
docker build -t amy:latest -t amy:${LAST_COMMIT} --label commit=${LAST_COMMIT} -f docker/Dockerfile .
First command sets LAST_COMMIT
environment variable to short commit hash of the
last commit in the repository.
Second command builds docker/Dockerfile
in .
as a context (should be your repository
directory) with tags amy:latest
and amy:LAST_COMMIT
.
Update the code:
Get the list of changes:
git fetch
Look for the newest tag:
git tag -n
Get the code from the newest tag:
git checkout tags/<tag_name>
Update dependencies front-end and back-end dependencies:
pipenv run make upgrade
(Optional) make fresh development-ready database:
pipenv run make dev_database
Run database migrations:
pipenv run python manage.py migrate
Enjoy your new version of AMY:
pipenv run make serve
Make sure you have Redis running. See instructions above.
Create dev database (it will add a super user and predefined database entries, too!):
pipenv run make dev_database
Run the server:
pipenv run python manage.py runserver
Run the RQ worker and scheduler (use separate terminals or processes for each command):
pipenv run python manage.py rqworker
pipenv run python manage.py rqscheduler
Accessibility tests are run with Pa11y and optionally Google Lighthouse as part of the CI process. It's sometimes helpful to run these programs locally to debug or test changes. For more information on the tests, see the accessibility tests documentation
For both Lighthouse and pa11y tests, Google Chrome or Chromium must be installed. On Ubuntu:
sudo apt install google-chrome-stable
Uses lighthouse-ci with configuration defined in lighthouserc.js.
Ensure Chrome is on the path by setting the CHROME_PATH
environment variable.
npm install -g @lhci/cli@0.12.x puppeteer
export CHROME_PATH=/path/to/chrome
lhci autorun
Lighthouse will exit with a failure code if accessibility failures are found. Reports are stored in the lighthouse-ci-report/
folder.
Uses pa11y-ci with configuration defined in .pa11yci.
Change executablePath
in .pa11yci to point to your Chrome installation.
npm install -g pa11y-ci pa11y-ci-reporter-html
pa11y-ci
Pa11y will exit with a failure code if accessibility failures are found. Reports are stored in the pa11y-ci-report/
folder.
The AMY theme is primarily based on Bootstrap 4.
To update the custom CSS that sits on top of the Bootstrap theme, edit amy/static/css/amy.css
.
To override Bootstrap 4 defaults such as colors, edit the Sass file amy/static/scss/custom_bootstrap.scss
as required, then compile it to CSS:
npx sass amy/static/scss/custom_bootstrap.scss amy/static/css/custom_bootstrap.min.css --style compressed
See the Bootstrap documentation for more guidance on overriding Bootstrap defaults.