A Python project is a folder of files whose .py scripts run on a machine of their own, once or on a schedule. It can live only in Fastero or be linked to a Git repository. Owners, Admins and Editors of a project can create Python projects in it. To run or schedule a script, your organization role must also be Editor or above.
Create a project
- Open Workbench from the top bar.
- In the Explorer, open the ⋮ menu next to Python and choose New Python Project.
- Enter a Project name and click Create.
- To add files, open the ⋮ menu next to the project and choose New File or New Folder.
To make a personal project instead, use the ⋮ menu next to Python under Personal in the Explorer.
Link a Git repository
- Open the ⋮ menu next to Python and choose Link Git repo.
- In Link Git Repository, choose how to sign in to the repository: Saved Credential, New Token or Public.
- Enter the Repo URL, such as
https://github.com/your-team/etl.git. - Pick the Credential, or paste an Access Token (optional) for a private repository.
- Enter a Name and a Branch. The branch is
mainif you leave it empty. - Click Link Repository. Fastero fetches the repository's files.
To save a credential for later, open the account menu (your avatar), choose Account Settings, then Git Credentials. Fastero sends a token only to github.com, gitlab.com or bitbucket.org, over https.
Work with Git
- Switch branch: open a file from the project and pick one in Branch.
- See what changed: open the ⋮ menu next to the project and choose View Changes. It lists the changed files and shows the diff of the one you pick.
- Commit: choose Commit in the same menu, enter a Commit message and click Commit & Push. Fastero commits your changes and pushes them to the branch. In a file's tab, the Commit & Push icon on the right does the same.
- Pull: choose Pull to fetch the latest commits. With changes not yet committed, Fastero asks first and does not merge them for you; View Changes then shows any conflicts.
- Detach: choose Detach to unlink the repository. Detach & Keep Local (recommended) keeps the files as a project in Fastero; the other choice removes the project.
Run a script
- Click a
.pyfile in the Explorer to open it. - Click Run. In a team project, it saves your edits first; Save saves them without running.
- The output panel shows what the script prints. Stop ends the run.
A requirements.txt in the project is installed before each run, and the packages are reused while the file stays the same. Your organization's and project's secrets reach the script as environment variables.
import os
import pandas as pd
token = os.environ["WAREHOUSE_TOKEN"]
df = pd.read_csv("data/orders.csv")
df.groupby("region")["amount"].sum().to_csv("outputs/revenue.csv")To run on a bigger machine, pick one in the Machine menu at the top of the file's tab. Personal projects have no Machine menu.
Put a script on a schedule
- In the Explorer, open the ⋮ menu next to the
.pyfile and choose Schedule. - In Schedule Python Entrypoint, pick one of the Quick Presets or More presets, or type a Cron Expression (minute hour day month weekday). Times are in UTC.
- Optionally, under Send the pictures (optional), enter up to 20 members of your organization in Email to, or pick a Slack channel. After each successful scheduled run, the pictures the script saved in
outputs/are sent there. A run you start yourself sends nothing. - Click Save Schedule.
A script has one schedule: saving again replaces it. A failed scheduled run is reported by email and in the app. To pause a schedule, open its ⋮ menu under Triggers in the Explorer and choose Switch off.
Read run logs
- In a file's tab, click the History (runs) icon on the right. Python runs lists each run with its status, when it was queued and finished, and the Git commit it ran. Click View output to read what it printed.
- In the Explorer, the file's ⋮ menu also has View run logs.