Skip to content

Commit

Permalink
Release v0.3.0: Migrate essential logic to V9 (#68)
Browse files Browse the repository at this point in the history
* Allow to fetch, update, change password, manage preferences and fetch features list for CurrentUser
* Allow to fetch and list Workspaces
* Allow to fetch, create, update, bulk edit, delete and stop TimeEntry
* Implement searching for ReportTimeEntries
* Allow to fetch and list Projects

* Add integration tests, pytest and nox tests
* Setup GitHub actions for pr check and publishing package on Test Pypi
* Add pre-commit with pre-commit.ci
* Update dependencies
* Update README and ReadTheDocs documentation
* Add Ruff with adopted company guidelines
* Change authors to company, add maintainer
* Remove irrelevant config options, set line length to 100
* Change LICENSE owner to company
  • Loading branch information
nifadyev authored Sep 23, 2024
1 parent 12f8b0c commit c8c0f74
Show file tree
Hide file tree
Showing 57 changed files with 4,206 additions and 1,667 deletions.
12 changes: 2 additions & 10 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,15 @@ root = true
[Makefile]
indent_style = tab

[*.{html,py,js,yml}]
[*.{py,yml}]
charset = utf-8

[*.js]
indent_style = space
indent_size = 2

[*.yml]
indent_style = space
indent_size = 2

[*.html]
indent_style = space
indent_size = 4

[*.py]
indent_style = space
indent_size = 4
line_length = 79
line_length = 100
multi_line_output = 3
73 changes: 73 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: pr

on:
- pull_request

permissions:
contents: read
pull-requests: read
checks: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
PYTHON_VERSION: "3.8"
POETRY_VERSION: "1.8.3"
RUFF_VERSION: "0.6.7"

jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4

- name: Install python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install dependencies
run: |
pip install --upgrade pip
pip install ruff==${{ env.RUFF_VERSION }}
- name: Run Ruff
run: ruff check --output-format=github .

test:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: 'pip'

- name: Install Poetry
run: pip install poetry==${{ env.POETRY_VERSION }}

- name: Restore dependencies from cache
uses: actions/cache@v4
with:
path: ~/.cache/pypoetry
key: dependencies-cache-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ env.POETRY_VERSION }}
restore-keys: |
dependencies-cache-${{ runner.os }}-${{ env.PYTHON_VERSION }}-
- name: Install dependencies
if: steps.setup-python.outputs.cache-hit != 'true'
run: |
poetry config virtualenvs.create false
poetry install --no-root --no-interaction
- name: Run Pytest on Python ${{ matrix.python }}
run: poetry run pytest -m "not integration"
60 changes: 60 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Upload Python Package

on:
release:
types: [published]

permissions:
contents: read

env:
PYTHON_VERSION: "3.8"
POETRY_CORE_VERSION: "1.9.0"

jobs:
release-build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Build release distributions
run: |
python -m pip install build poetry-core==${{ env.POETRY_CORE_VERSION }}
python -m build
- name: Upload distributions
uses: actions/upload-artifact@v4
with:
name: release-dists
path: dist/

pypi-publish:
runs-on: ubuntu-latest

needs:
- release-build

permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write

environment:
name: test_pypi
url: https://test.pypi.org/p/toggl_python

steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v4
with:
name: release-dists
path: dist/

- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
46 changes: 3 additions & 43 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,39 +47,9 @@ coverage.xml
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# dotenv
.env

Expand All @@ -88,23 +58,13 @@ celerybeat-schedule
venv/
ENV/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/

.ruff_cache

# IDE settings
.vscode/
local_*.py
.idea/

# readthedocs sphinx generated documentation
_build/
pyrightconfig.json
44 changes: 35 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,43 @@
default_language_version:
python: python3.8

default_install_hook_types:
- pre-commit
- pre-push

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: mixed-line-ending
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.7
hooks:
- id: ruff
args: [ --fix ]
# Spell Checker
- repo: https://github.com/crate-ci/typos
rev: v1.24.6
hooks:
- id: typos
# Git commit linter
- repo: https://github.com/jorisroovers/gitlint
rev: v0.19.1
hooks:
- id: gitlint
# Detect hardcoded secrets
- repo: https://github.com/zricethezav/gitleaks
rev: v8.19.2
hooks:
- id: gitleaks
- repo: local
hooks:
- id: black
name: black
entry: poetry run black .
language: python
types: [python]

- id: isort
name: isort
entry: poetry run isort .
- id: test
name: test
entry: poetry run nox
pass_filenames: false
stages: [pre-push]
language: python
types: [python]
3 changes: 1 addition & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020, Ivlev Denis
Copyright (c) 2024, Evrone.com Inc

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Loading

0 comments on commit c8c0f74

Please sign in to comment.