Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
eaa2f0d
changeg log level of unexpected statuses and types
loboda4450 Jun 8, 2023
313f851
changed some async methods to sync
loboda4450 Jun 8, 2023
fc05f89
CI/CD config
loboda4450 Jun 17, 2023
9bf88e8
added support for creating and sending parcels. sorted endpoints, rep…
loboda4450 Jun 24, 2023
fb4d6b9
mypy config
loboda4450 Jun 24, 2023
6ed9a55
added .gitignore, modified todos.yml
loboda4450 Jun 24, 2023
a736429
updated urls naming schema (it interfered with filenames), minor refa…
loboda4450 Jun 24, 2023
7f86979
CI hates me
loboda4450 Jun 24, 2023
f3dae76
TODOs refactor
loboda4450 Jun 24, 2023
f0cd819
Merge pull request #21 from IFOSSA/dev
loboda4450 Jun 24, 2023
80fe7b5
done some todos, update README.md, new exception
loboda4450 Jun 24, 2023
df60995
README.md update
loboda4450 Jun 24, 2023
3c417b6
Added missing docstrings
loboda4450 Jun 24, 2023
7309fd3
Add pytest module and create test case for models from statuses
Mrkazik99 Jun 24, 2023
11bf830
Remove cache files and unnecesary stuff
Mrkazik99 Jun 24, 2023
1550ee8
Add pytest to Github Actions
Mrkazik99 Jun 25, 2023
bc29288
Remove unnecessary stuff from statuses test
Mrkazik99 Jun 25, 2023
65159aa
Add pytest-results-action to surface failing pytest tests without cra…
Mrkazik99 Jun 25, 2023
f86cdf3
Fix statuses to pass the tests again
Mrkazik99 Jun 25, 2023
a619fef
Merge branch 'dev' into dev-tests
loboda4450 Jun 25, 2023
52de0d7
Add additional test case
Mrkazik99 Jun 25, 2023
3a592a1
Merge branch 'dev-tests' of https://github.com/IFOSSA/inpost-python i…
Mrkazik99 Jun 25, 2023
843ff7d
Merge pull request #25 from IFOSSA/dev-tests
loboda4450 Jun 25, 2023
9c51b50
Create tests for parcels object
Mrkazik99 Jun 25, 2023
63ee57b
Remove these stupid __pycache__ directories
Mrkazik99 Jun 25, 2023
2afc489
Fix qr_image test and add two test cases for it
Mrkazik99 Jun 25, 2023
5e495fc
Fix equation to avoid approximation error and remove test case that i…
Mrkazik99 Jun 25, 2023
600220a
Fixed wrong ParcelShipmentType log, inpost version update
loboda4450 Jul 2, 2023
35de085
Merge pull request #27 from IFOSSA/dev-tests
loboda4450 Jul 2, 2023
4405cc6
Fixed no compartment location
loboda4450 Jul 23, 2023
e6c1a0a
Fixed reopening url and log message
loboda4450 Dec 17, 2023
287824a
self to cls
loboda4450 Dec 17, 2023
4781ff3
Ready 1.5 release
loboda4450 Dec 17, 2023
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
5 changes: 5 additions & 0 deletions .darglint
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[darglint]
docstring_style=sphinx
ignore=DAR003,DAR402
strictness=full
exclude=docs
6 changes: 6 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[flake8]
max-line-length = 120
max-complexity = 12
select = B,C,E,F,W,T4,B9
ignore = E501, E731, W503, F401, F403
exclude = docs
17 changes: 17 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Code Quality

on:
pull_request:
branches: [dev]

push:
branches: [dev]

jobs:
pre-commit:
name: Linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/[email protected]
- uses: pre-commit/[email protected]
89 changes: 89 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Pytest

on: [push]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}

# Cache the installation of Poetry itself, e.g. the next step. This prevents the workflow
# from installing Poetry every time, which can be slow. Note the use of the Poetry version
# number in the cache key, and the "-0" suffix: this allows you to invalidate the cache
# manually if/when you want to upgrade Poetry, or if something goes wrong. This could be
# mildly cleaner by using an environment variable, but I don't really care.
- name: cache poetry install
uses: actions/cache@v2
with:
path: ~/.local
key: poetry-1.5.1-0

# Install Poetry. You could do this manually, or there are several actions that do this.
# `snok/install-poetry` seems to be minimal yet complete, and really just calls out to
# Poetry's default install script, which feels correct. I pin the Poetry version here
# because Poetry does occasionally change APIs between versions and I don't want my
# actions to break if it does.
#
# The key configuration value here is `virtualenvs-in-project: true`: this creates the
# venv as a `.venv` in your testing directory, which allows the next step to easily
# cache it.
- uses: snok/install-poetry@v1
with:
version: 1.5.1
virtualenvs-create: true
virtualenvs-in-project: true

# Cache your dependencies (i.e. all the stuff in your `pyproject.toml`). Note the cache
# key: if you're using multiple Python versions, or multiple OSes, you'd need to include
# them in the cache key. I'm not, so it can be simple and just depend on the poetry.lock.
- name: cache deps
id: cache-deps
uses: actions/cache@v2
with:
path: .venv
key: pydeps-${{ hashFiles('**/poetry.lock') }}

# Install dependencies. `--no-root` means "install all dependencies but not the project
# itself", which is what you want to avoid caching _your_ code. The `if` statement
# ensures this only runs on a cache miss.
- run: poetry install --no-interaction --no-root
if: steps.cache-deps.outputs.cache-hit != 'true'

# Now install _your_ project. This isn't necessary for many types of projects -- particularly
# things like Django apps don't need this. But it's a good idea since it fully-exercises the
# pyproject.toml and makes that if you add things like console-scripts at some point that
# they'll be installed and working.
- run: poetry install --no-interaction

# And finally run tests. I'm using pytest and all my pytest config is in my `pyproject.toml`
# so this line is super-simple. But it could be as complex as you need.
- run: poetry run pytest --junit-xml=test-results.xml

- name: Surface failing tests
if: always()
uses: pmeier/pytest-results-action@main
with:
# A list of JUnit XML files, directories containing the former, and wildcard
# patterns to process.
# See @actions/glob for supported patterns.
path: test-results.xml

# Add a summary of the results at the top of the report
# Default: true
summary: true

# Select which results should be included in the report.
# Follows the same syntax as
# `pytest -r`
# Default: fEX
display-options: fEX

# Fail the workflow if no JUnit XML was found.
# Default: true
fail-on-empty: false
11 changes: 11 additions & 0 deletions .github/workflows/todos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Create issues from todos

on: ["push"]

jobs:
build:
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v3"
- name: "TODO to Issue"
uses: "alstr/todo-to-issue-action@v4"
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/log
/otwarcie paczkomatu.xml
/otwarcie_paczkomatu.json
/poetry.lock
/.mypy_cache/
/dist/
/venv/
/.idea/
/tests/.pytest_cache
/tests/__pycache__/
/tests/api_tests.py
/tests/data.json
/tests/data.py
/tests/data_responses.py
/inpost/static/__pycache__/
/inpost/__pycache__/
/otwarcie paczkomatu.xml.html
12 changes: 12 additions & 0 deletions .mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[mypy]
strict = False
# misc disabled due to damn hardcoded Enum, not solved since 2021: https://github.com/python/mypy/issues/11039
# annotation-unchecked just to have clear logs
# assignment cuz i didnt find a way to disable incompatible types in specific conditions, undo before every commit
disable_error_code = misc, annotation-unchecked, assignment

[mypy-tests.*]
allow_untyped_defs = True
allow_untyped_calls = True


35 changes: 35 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
repos:
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
exclude: ^docs/
language_version: python3
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
exclude: ^docs/
additional_dependencies:
- flake8-bugbear
- flake8-comprehensions
- flake8-pytest
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.3.0
hooks:
- id: mypy
exclude: ^docs/
- repo: https://github.com/terrencepreilly/darglint
rev: v1.8.1
hooks:
- id: darglint
exclude: ^docs/
- repo: https://github.com/commitizen-tools/commitizen
rev: v3.3.0
hooks:
- id: commitizen
stages: [commit-msg]
19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
[![CodeFactor](https://www.codefactor.io/repository/github/ifossa/inpost-python/badge)](https://www.codefactor.io/repository/github/ifossa/inpost-python)
![Code Quality](https://github.com/ifossa/inpost-python/actions/workflows/lint.yml/badge.svg?barnch=main)
![Todos](https://github.com/ifossa/inpost-python/actions/workflows/todos.yml/badge.svg?barnch=main)

# Inpost Python

Fully async Inpost library using Python 3.10.




## Documentation

[Readthedocs.io](https://inpost-python.readthedocs.io/en/latest/)
Expand All @@ -17,13 +18,21 @@ Fully async Inpost library using Python 3.10.
```python
from inpost.api import Inpost

inp = await Inpost.from_phone_number('555333444')
inp = Inpost('555333444')
await inp.send_sms_code():
...
if await inp.confirm_sms_code(123321):
print('Congratulations, you initialized successfully!')
```

## Before you contribute

![Contributors](https://contrib.rocks/image?repo=ifossa/inpost-python)

Install linters and checkers, unlinted pull requests will not be approved
```commandline
poetry run pre-commit install
```

## Authors

Expand All @@ -37,3 +46,7 @@ This project is used by the following repos:

[Inpost Telegram Bot](https://github.com/loboda4450/inpost-telegram-bot)



## 😂 Here is a random joke that'll make you laugh!
![Jokes Card](https://readme-jokes.vercel.app/api)
Loading