Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,26 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Python Poetry Action
uses: abatilo/actions-poetry@v2.1.3
with:
poetry-version: "1.6.1"
- uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "poetry"
python-version: "3.11"
- uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- name: Install prerequisites
run: |
poetry install --all-extras
uv sync --all-extras --group dev
sudo ./scripts/install-taskwarrior.sh
task --version
- name: Coverage
run: |
poetry run coverage run -m pytest --doctest-modules
poetry run coverage report
uv run coverage run -m pytest --doctest-modules
uv run coverage report
# Using --service=github + secrets.GITHUB_TOKEN for builds originating from PRs to work
# Not sure if both are required
# https://github.com/TheKevJames/coveralls-python/issues/252
- name: Coveralls
run: poetry run coveralls --service=github || poetry run coveralls
run: uv run coveralls --service=github || uv run coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19 changes: 12 additions & 7 deletions .github/workflows/install-software.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,27 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.10", "3.11", "3.12"]
python-version: ["3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- name: Install with pip3 - no extras
run: |
pip3 install .
pip3 show syncall
uv run pip install .
uv run pip show syncall

install_extras_with_pip3:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
python-version: ["3.10", "3.11", "3.12"]
python-version: ["3.11", "3.12", "3.13", "3.14"]
# use python-extra AND executable to tests its imports
# https://stackoverflow.com/questions/66025220/paired-values-in-github-actions-matrix
python-extra:
Expand All @@ -45,7 +47,10 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- name: Install with pip3 - with ${{ matrix.python-extra }}
run: |
pip install .[${{ matrix.python-extra }}]
pip3 show syncall
uv run pip install ".[${{ matrix.python-extra }}]"
uv run pip show syncall
21 changes: 7 additions & 14 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,13 @@ jobs:
style_and_linters:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Python Poetry Action
uses: abatilo/actions-poetry@v3
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v8.1.0
with:
poetry-version: "1.6.1"
- uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "poetry"
python-version: "3.11"
- name: Install just
uses: extractions/setup-just@v3
- name: Install prerequisites
run: |
poetry install --all-extras
poetry self add "poetry-dynamic-versioning[plugin]"
run: uv sync --all-extras --group dev
- name: "Run pre-commit hooks"
uses: slamcore/pre-commit-action@v0.2.0
with:
command_prefix: "poetry run"
run: uv run pre-commit run --show-diff-on-failure --color=always --all-files
17 changes: 13 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Publish package to pypi
uses: JRubics/poetry-publish@v1.16
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install build tools
run: |
python -m pip install --upgrade pip build
- name: Build distributions
run: |
python -m build
- name: Publish package to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
pypi_token: ${{ secrets.PYPI_API_TOKEN }}
plugins: "poetry-dynamic-versioning[plugin]"
password: ${{ secrets.PYPI_API_TOKEN }}
14 changes: 6 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,19 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v4
- name: Python Poetry Action
uses: abatilo/actions-poetry@v2.1.3
with:
poetry-version: "1.6.1"
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "poetry"
- uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- name: Install prerequisites
run: |
poetry install --all-extras
uv sync --all-extras --group dev
sudo ./scripts/install-taskwarrior.sh
task --version
- name: Run tests
run: poetry run pytest
run: uv run pytest
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,5 @@ test-tw-gcal-sync.json
.tool-versions
.lvimrc
a
syncall/__vf
syncall/__version__.py
44 changes: 25 additions & 19 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,27 @@ repos:
- id: markdownlint
exclude: ^.github/
entry: mdl -r ~MD033,~MD013,~MD034,~MD029,~MD007
- repo: local
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: "0.37.2"
hooks:
- id: check-github-workflows
name: Validate GitHub Workflows
description: "Validate GitHub Workflows against the schema provided by SchemaStore"
entry: check-jsonschema --builtin-schema vendor.github-workflows
language: python
files: ^\.github/workflows/
types: [yaml]
- id: black
name: Black formatter
description: "Black: The uncompromising Python code formatter"
entry: black

- repo: local
hooks:
- id: just-format
name: just format
description: "Make sure that the justfile is formatted"
entry: just self-fmt
language: system
minimum_pre_commit_version: 2.9.2
require_serial: true
types_or: [python, pyi]
pass_filenames: false

- id: _check-devbox-activated
name: check devbox is activated
description: "Make sure that the devbox is activated before attempting to commit"
entry: bootstrap/pre-commit/check-devbox-activated.py
language: system
pass_filenames: false


- id: pyupgrade
name: Pyupgrade
Expand Down Expand Up @@ -82,13 +86,15 @@ repos:
args: ["check", "--fix"]
language: system
types_or: [python, pyi]
require_serial: true

- id: poetry-check
name: Poetry check
entry: poetry check
- id: ruff
name: Ruff Format
entry: ruff
args: ["format", "--force-exclude"]
language: system
pass_filenames: false
files: "pyproject.toml|poetry.lock"
types_or: [python, pyi]
require_serial: true

- repo: meta
hooks:
Expand Down
22 changes: 10 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

## Development

- We're using [poetry](https://python-poetry.org/docs/) for building and
packaging of this Python project. You can find installation instructions
[here](https://python-poetry.org/docs/#installation).
- Use a virtual environment and pip for building and packaging of this Python project. For local development, create and activate a venv, then install the extras with pip.

- We're using `pytest` for testing the code and a variety of plugins for linting
and checking for bugs, including:
Expand All @@ -15,22 +13,22 @@
- [isort](https://pypi.org/project/isort/)
- [pre-commit](https://pre-commit.com/)

All these development dependencies will be available inside the virtual
environment that poetry sets up. You can get a prompt inside the said virtual
environment by running `poetry shell` while at the root of this repo.
All these development dependencies will be available inside a virtual
environment. Recommended steps:

```sh
# install dependencies and all extras - which are required for running the
# tests.
poetry install -E google -E gkeep -E notion
# create and activate a venv (example)
python -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip

# get a shell inside the virtualenv
poetry shell
# install development and optional extras for testing
python -m pip install -e ".[all]"
```

To run all the linters in one go you can use `pre-commit`. To do this:

1. Setup the `virtulenv` with `poetry` as described above.
1. Setup the `virtualenv` as described above.
1. Get a shell inside the virtualenv. Install the `pre-commit` hook.

```sh
Expand Down
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
<img src="https://badge.fury.io/py/syncall.svg" alt="PyPI version" height="18"></a>
<a href="https://pepy.tech/project/syncall">
<img alt="Downloads" src="https://pepy.tech/badge/syncall"></a>
<a href="https://github.com/psf/black">
<img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>

## Description

Expand Down Expand Up @@ -168,14 +166,14 @@ Here's some of the available options for installing it:
pip3 install --user --upgrade .[gkeep,fs,google,tw,caldav,asana]
```

- Setup using [poetry](https://python-poetry.org/) - handy for local
development and for isolation of dependencies:
- Setup using a virtualenv and pip - handy for local development and for isolation of dependencies:

```sh
git clone https://github.com/bergercookie/syncall
poetry install --all-extras
# get an interactive shell
poetry shell
python -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -e ".[all]"

# now the executables of all the services should be in your PATH for the
# current shell and you can also edit the source code without further
Expand Down
6 changes: 6 additions & 0 deletions bootstrap/bin/install-devbox.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

# `devbox` is the tool of choice for creating and managing the environments for
# development, in a reproducible, and isolated fashion
set -ex
curl -fsSL https://get.jetify.com/devbox | bash
9 changes: 9 additions & 0 deletions bootstrap/devbox/login
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# tiny script to activate the virtualenv correctly regardless of the shell
# this syntax has to be compatible with all shells
test -n "$FISH_VERSION" && source bootstrap/devbox/login.fish
test -z "$FISH_VERSION" && source bootstrap/devbox/login.sh
test -n "$USER_LOGIN_SCRIPT" && echo "Attempting to source $USER_LOGIN_SCRIPT" && source "$USER_LOGIN_SCRIPT"

export PATH="$PATH:$PWD/bootstrap/bin:$KREW_ROOT/bin/"

# vim: ft=sh
2 changes: 2 additions & 0 deletions bootstrap/devbox/login.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
echo "Using login.fish ..."
source .venv/bin/activate.fish
2 changes: 2 additions & 0 deletions bootstrap/devbox/login.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
echo "Using login.sh ..."
source .venv/bin/activate
Loading
Loading