Skip to content

Commit

Permalink
chore(release): version 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ddkasa committed Oct 15, 2024
2 parents 4d42e55 + cbc352e commit 7452ddf
Show file tree
Hide file tree
Showing 80 changed files with 2,267 additions and 1,372 deletions.
11 changes: 3 additions & 8 deletions .github/workflows/documentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,9 @@ env:

on:
push:
branches:
- main
paths:
- ".github/workflows/documentation.ya?ml"
- "mkdocs.ya?ml"
- "poetry.lock"
- "pyproject.toml"
- "docs/**"
tags:
- "v*.*.*"
workflow_dispatch:

jobs:
publish:
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
tags:
- "v*.*.*"
workflow_dispatch:

jobs:
lint:
runs-on: ubuntu-latest
Expand All @@ -21,6 +23,14 @@ jobs:
python -m pip install --upgrade pip
pip install ruff mypy
- name: Type Check
run: |
mypy toggl_api
- name: Lint
run: |
ruff check toggl_api
test:
needs: lint
runs-on: ${{ matrix.os }}
Expand All @@ -29,7 +39,7 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12", "3.13"]

env:
TOGGL_WORKSPACE_ID: ${{ secrets.TOGGL_WORKSPACE_ID }}
Expand Down Expand Up @@ -61,6 +71,7 @@ jobs:
build:
needs: test
runs-on: ubuntu-latest
if: github.ref_type == 'tag'
steps:
- uses: actions/checkout@v4

Expand Down
48 changes: 8 additions & 40 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,48 +1,16 @@
name: Changelog
name: Release

on:
push:
tags:
- "v*.*.*"

workflow_dispatch:
jobs:
changelog:
name: Generate changelog
release:
name: Upload the release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Generate a changelog
uses: orhun/git-cliff-action@v4
id: git-cliff
with:
config: cliff.toml
args: --verbose
env:
OUTPUT: docs/CHANGELOG.md
GITHUB_REPO: ${{ github.repository }}

- name: Commit
run: |
git checkout main
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
set +e
git add docs/CHANGELOG.md
git commit -m "docs(changelog): update changelog"
git push https://${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git main
upload:
name: Upload the release
runs-on: ubuntu-latest
needs: changelog
if: github.ref_type == 'tag'
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -59,9 +27,9 @@ jobs:
OUTPUT: CHANGES.md
GITHUB_REPO: ${{ github.repository }}

- name: Upload the binary releases
uses: svenstaro/upload-release-action@v2
- name: Release
uses: softprops/action-gh-release@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
body: ${{ steps.git-cliff.outputs.content }}
body_path: CHANGES.md
repository: ${{ github.repository }}
token: ${{ secrets.GITHUB_TOKEN }}
9 changes: 8 additions & 1 deletion .nvim.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,12 @@ table.insert(require("dap").configurations.python, {
request = "launch",
name = "debug file",
program = "${file}",
-- ... more options, see https://github.com/microsoft/debugpy/wiki/debug-configuration-settings
})

function paste_in_official_docs()
local pos = vim.api.nvim_win_get_cursor(0)[2]
local line = vim.api.nvim_get_current_line()
local clipboard_content = vim.fn.getreg("+")
local nline = line:sub(0, pos) .. "[Official Documentation](" .. clipboard_content .. ")" .. line:sub(pos + 1)
vim.api.nvim_set_current_line(nline)
end
8 changes: 5 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ default_language_version:
python: python3.12

repos:
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.1
hooks:
- id: mypy

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.6.9
hooks:
# Run the linter.
- id: ruff
args: [--fix]
# Run the formatter.
- id: ruff-format

- repo: https://github.com/mpalmer/action-validator
Expand Down
4 changes: 2 additions & 2 deletions .python-version
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
3.10.14
3.11.9
3.12.3
3.13.0b1
3.12.5
3.13.0
79 changes: 79 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,85 @@

All notable changes to this project will be documented in this file.

## [1.0.0] - 2024-10-15

### 🚀 Features

- *(utility)* Requires decorator
- Python 3.13 support
- *(cache)* Comparison enumeration
- *(cache)* Toggl query dataclass

### 🐛 Bug Fixes

- *(tracker)* Adjust error type
- *(utility)* Swap datetime conditional
- *(endpoint)* Refactor server error retry logic
- *(endpoints)* Return none on 404
- *(cache)* Sqlite delete method
- *(user)* Collect method not correctly formatting time arguments

### 🚜 Refactor

- [**breaking**] Merge modules with toggl_api
- *(endpoints)* [**breaking**] Remove deprecated methods
- *(body)* [**breaking**] Remove deprecated workspace_id parameter
- *(deps)* [**breaking**] Convert sqlalchemy to optional dependency
- *(workspace)* Improved get endpoint
- *(client)* Use literal for typing status strings
- *(tag)* Delete endpoint typing
- *(reports)* Make pagination options optional
- *(cache)* [**breaking**] Remove inverse flag
- *(cache)* Abstract class query method
- *(cache)* Json query method
- *(cache)* Sqlite query method
- *(user)* Fully implement collect method cache retrieval
- *(endpoints)* Logging for caught exceptions
- Additional debug logging
- *(models)* Remove optional type from timestamp
- *(cache)* Fix typing issues

### 📚 Documentation

- *(changelog)* Update changelog
- *(readme)* Update readme
- *(api)* Update docs to new directory structure
- Update examples
- *(mermaid)* Update diagrams
- *(cache)* Improved metaclass
- *(panzoom)* Full screen enabled
- *(endpoints)* Add official api links
- Show source on endpoints
- *(example)* Reports example
- *(readme)* Add examples
- *(cache)* Query docstrings added
- *(example)* Logging example
- *(contributing)* Additional instructions

### 🎨 Styling

- *(cache)* Remove optional type annotation as return

### ⚙️ Miscellaneous Tasks

- Update coverage config
- *(precommit)* Added mypy
- *(nvim)* Function for generating official docstrings
- *(actions)* Simplify workflows
- *(typing)* Add py.typed file

### 🧪 Testing

- *(user)* Additional status code tests
- *(endpoints)* Additional argument types
- *(reports)* Validate extensions
- *(tracker)* Mock http status code logic
- *(sqlite)* Additional tests
- *(conftest)* Only delay on integration tests
- *(tracker)* Verify creation dates logic
- More coverage
- *(cache)* Query conversion

## [0.5.1] - 2024-10-07

### 🐛 Bug Fixes
Expand Down
4 changes: 3 additions & 1 deletion docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

- Lint with `ruff toggl_api`
- Check typing with `mypy toggl_api`
- Make sure to install pre-commit hook with `pre-commit install`.

## Testing

Expand All @@ -30,4 +31,5 @@

## Documentation

- Run `mkdocs serve --strict` to preview documentation
- Run `mkdocs serve --strict` to build and preview documentation
- Run `git cliff -o docs/CHANGELOG.md` to generate new changelog. _Requires git-cliff to be installed._
104 changes: 92 additions & 12 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,116 @@

> Simple Toggl API wrapper for non-premium features primarily focused on creating a cached framework for developing custom commands.
> [!WARNING]
> _Alpha Stage: Anything might change without notice at any moment._
---

## Installation

### Poetry
Install with pip:

```
poetry add toggl-api-wrapper
```bash
pip install toggl-api-wrapper
```

### Pip
Or if using SQLite cache:

```
pip install toggl-api-wrapper
```bash
pip install "toggl-api-wrapper[sqlite]"
```

## Usage

- Currently supports interacting with Trackers, Projects, Clients & Tags and some extras.
- Currently supports interacting with Trackers, Projects, Clients, Tags, Reports and some extras.
- Designed to be rudimentary to allow simple development of custom commands.

## Examples

<details>
<summary>Tracker Endpoint</summary>

```python
from datetime import timedelta
from pathlib import Path

from toggl_api import (
TrackerBody,
TrackerEndpoint,
generate_authentication,
JSONCache
)

WORKSPACE_ID = 2313123123
AUTH = generate_authentication()
cache = JSONCache(Path("cache"), timedelta(hours=24))
endpoint = TrackerEndpoint(WORKSPACE_ID, AUTH, cache)

body = TrackerBody("My First Tracker", tags=["My First Tag"])
tracker = endpoint.add(body)
print(tracker)
```

<strong>Outputs:</strong>

```python
>>> TogglTracker(
id=3482231563,
name="My First Tracker",
workspace=2313123123,
start=datetime.datetime(2024, 6, 10, 14, 59, 20, tzinfo=datetime.timezone.utc),
duration=datetime.timedelta(seconds=1, microseconds=179158),
stop=None,
project=None,
tags=[],
)
```

</details>

<details>
<summary>User Endpoint</summary>

```python
from datetime import timedelta
from pathlib import Path

from toggl_api import (
UserEndpoint,
generate_authentication,
JSONCache,
)

WORKSPACE_ID = 2313123123
AUTH = generate_authentication()
cache = JSONCache(Path("cache"), timedelta(weeks=1))
endpoint = UserEndpoint(workspace_id, AUTH, CACHE)

tracker = endpoint.get(3482231563, refresh=True)
print(tracker)
```

<strong>Outputs:</strong>

```python
>>> TogglTracker(
id=3482231563,
name="My First Tracker",
workspace=2313123123,
start=datetime.datetime(2024, 6, 10, 14, 59, 20, tzinfo=datetime.timezone.utc),
duration=datetime.timedelta(seconds=1, microseconds=179158),
stop=None,
project=None,
tags=[],
)
```

</details>

## Documentation

- [Examples](https://ddkasa.github.io/toggl-api-wrapper/user-guide/examples.html)
- [API Documentation](https://ddkasa.github.io/toggl-api-wrapper/api-guide/)
- [User Guide](https://ddkasa.github.io/toggl-api-wrapper/user-guide/)
- [User Guide](https://ddkasa.github.io/toggl-api-wrapper/index.html)

## Development
## Contributing

See [CONTRIBUTING](CONTRIBUTING.md).

Expand Down
Loading

0 comments on commit 7452ddf

Please sign in to comment.