Skip to content

Commit

Permalink
Allow import directly from base package
Browse files Browse the repository at this point in the history
  • Loading branch information
rkhwaja committed Oct 10, 2024
1 parent 9a6cfe3 commit 5fc31f8
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 14 deletions.
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ Python wrapper for "Remember the Milk" [API](https://www.rememberthemilk.com/ser

# Usage of client
```python
from rtmilk.client import CreateClient, CreateClientAsync
from rtmmilk.models import APIError
from rtmilk import APIError, CreateClient, CreateClientAsync

# These are the equivalent objects, created differently
client = CreateClient(API_KEY, SHARED_SECRET, TOKEN)
Expand All @@ -28,8 +27,7 @@ except APIError as e:

# Usage of API functions directly
```python
from rtmilk.api_sync import API
from rtmmilk.models import FailStat
from rtmilk import API, FailStat

api = API(API_KEY, SHARED_SECRET, TOKEN)

Expand All @@ -40,8 +38,7 @@ if isinstance(result, FailStat):
```

```python
from rtmilk.api_async import APIAsync
from rtmmilk.models import FailStat
from rtmilk import APIAsync, FailStat

apiAsync = APIAsync(API_KEY, SHARED_SECRET, TOKEN)

Expand All @@ -53,7 +50,7 @@ if isinstance(result, FailStat):

# Authorization
```python
from rtmilk.authorization import AuthorizationSession
from rtmilk import AuthorizationSession

authenticationSession = AuthorizationSession(API_KEY, SHARED_SECRET, 'delete')
input(f'Go to {authenticationSession.url} and authorize. Then Press ENTER')
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ lint.select = ["ALL"]
target-version = "py39"

[tool.ruff.lint.extend-per-file-ignores]
"__init__.py" = ["F403"]
"tests/*" = ["ANN201", "D103", "INP001", "PT006"]
"_properties.py" = ["SLF001"]
"client.py" = ["SLF001"]
Expand Down
8 changes: 8 additions & 0 deletions src/rtmilk/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
from logging import getLogger, NullHandler

from .api_async import *
from .api_sync import *
from .authorization import *
from .client import *
from .filter import *
from .mirror import *
from .models import *

getLogger(__name__).addHandler(NullHandler())
4 changes: 1 addition & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@

from pytest import fixture

from rtmilk.api_sync import API
from rtmilk.api_async import APIAsync
from rtmilk.client import CreateClient
from rtmilk import API, APIAsync, CreateClient

try:
from dotenv import load_dotenv
Expand Down
2 changes: 1 addition & 1 deletion tests/generate_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from contextlib import suppress
from os import environ

from rtmilk.authorization import AuthorizationSession
from rtmilk import AuthorizationSession

try:
from dotenv import load_dotenv
Expand Down
2 changes: 1 addition & 1 deletion tests/test_api_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from pydantic import ValidationError
from pytest import mark, raises

from rtmilk.models import AuthResponse, EchoResponse, FailStat, NotePayload, PriorityDirectionEnum, PriorityEnum, RTMList, RTMSmartList, Tags, TaskResponse, TaskSeries
from rtmilk import AuthResponse, EchoResponse, FailStat, NotePayload, PriorityDirectionEnum, PriorityEnum, RTMList, RTMSmartList, Tags, TaskResponse, TaskSeries
from rtmilk._sansio import TasksGetList

def test_validation(api, timeline):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_filter.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from datetime import date
from uuid import uuid4

from rtmilk.filter import And, Due, NameIs, Or, Priority, PriorityEnum, Status
from rtmilk import And, Due, NameIs, Or, Priority, PriorityEnum, Status

def testFilterString():
assert And(NameIs('the-name'), Status(True)).Text() == '(name:"the-name") AND (status:completed)'
Expand Down
2 changes: 1 addition & 1 deletion tests/test_mirror.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from datetime import datetime, timedelta

from rtmilk.mirror import Mirror, TaskData
from rtmilk import Mirror, TaskData

def testMirror(mockClient):
Mirror(mockClient, [], [TaskData('name')])
Expand Down

0 comments on commit 5fc31f8

Please sign in to comment.