Skip to content

timparenti/calcombine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

calcombine

iCalendar file combiner, built to combine RFC 5545–compatible iCalendar data from multiple calendars and re-present it in a single calendar file for public consumption.

Requirements

  • Python >= 3.11
  • python3-venv (for pip and ensurepip)

Setting up environments

This project uses pyproject.toml to establish dependencies for its build environment. The overall build process is described in general terms here.

Build environment

Clone the repo and create a Python venv for the build environment:

git clone git@github.com:timparenti/calcombine.git
cd ~/calcombine
python3 -m venv .venv/ --prompt calcombine-build

Install pip dependencies to the build environment:

source .venv/bin/activate
pip install --upgrade pip
pip install build

Install the package and its dependencies to the build environment in "editable" mode:

pip install -e .

Test and production environments

Create a user, calcombine, which will run calcombine in production, and establish a Python venv for each environment in which it will run, e.g.:

sudo adduser --disabled-password calcombine
sudo -s
python3 -m venv /opt/calcombine-test/ --prompt calcombine-test
python3 -m venv /opt/calcombine-prod/ --prompt calcombine-prod
chown -R calcombine:calcombine /opt/calcombine-test/
chown -R calcombine:calcombine /opt/calcombine-prod/

Then su as the new user and install pip dependencies to each environment $ENV:

sudo su calcombine
source /opt/$ENV/bin/activate
pip install --upgrade pip
pip install build

Deployment

Build environment

If not already active, activate the build environment:

cd ~/calcombine
source .venv/bin/activate

Reinstall the updated package and its dependencies to the build environment in "editable" mode:

pip install -e .

Test and production environments

From the build directory and environment, build a wheel:

cd ~/calcombine
source .venv/bin/activate
# Bump the project version and update any other dependencies
edit pyproject.toml
python3 -m build --wheel

This creates a wheel in the dist subdirectory. If needed, copy it to the target environment's host.

Using the target environment's pip, install the application from the latest wheel created in the build environment's dist subdirectory, e.g.:

sudo /opt/$ENV/bin/pip install ~/calcombine/dist/calcombine-x.y.z-py3-none-any.whl

where x.y.z is the project version.

Usage

Running from build

If not already active, activate the build environment:

cd ~/calcombine
source .venv/bin/activate

Run python3 -m calcombine with the desired options. See python3 -m calcombine --help for options.

Running from test or production

Using the target environment's python3, run the application with the desired options, e.g.:

sudo su calcombine
cd /opt/$ENV
./bin/python3 -m calcombine [options]

For production cron, this is generally best invoked under the calcombine user as:

cd /opt/calcombine-prod && ./bin/python3 -m calcombine [options]

or, equivalently, if an unscheduled production run is required:

sudo su calcombine -c "cd /opt/calcombine-prod && ./bin/python3 -m calcombine [options]"

About

iCalendar file combiner

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages