Skip to content

Commit

Permalink
chore: Package ksef-utils
Browse files Browse the repository at this point in the history
  • Loading branch information
pprzetacznik committed Dec 19, 2023
1 parent a7a68db commit 8cd8ae3
Show file tree
Hide file tree
Showing 16 changed files with 84 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
__pycache__
.pytest_cache
2 changes: 2 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
All rights reserved by Piotr Przetacznik
MIT License
8 changes: 8 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
recursive-include resources *
include templates/InitSession.xml
include templates/invoice_example.xml
include MANIFEST.in
include README.md
include LICENSE.txt
include requirements.txt
include pytest.ini
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# KSEF utils

## Installing package from source

```Bash
$ cd ksef-utils
$ pip install -e .
```

## Run tests

```Bash
Expand Down Expand Up @@ -32,7 +39,8 @@ export KSEF_NIP="..."

Run all e2e/functional/current tests
```
$ pytest -svvv test_ksef.py -m "e2e and not ignore"
$ pytest -svvv test_ksef.py -m "functional and not ignore"
$ pytest -svvv test_ksef.py -m "current and not ignore"
$ pytest -svvv tests/test_ksef.py -m "e2e and not ignore"
$ pytest -svvv tests/test_ksef.py -m "functional and not ignore"
$ pytest -svvv tests/test_ksef.py -m "current and not ignore"
$ ./run_tests.sh
```
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0
Empty file added ksef_utils/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion config.py → ksef_utils/config.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from os import getenv
from os.path import join
import pytz
from utils import readfile
from ksef_utils.utils import readfile


class Config:
Expand Down
2 changes: 1 addition & 1 deletion server.py → ksef_utils/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import base64
import hashlib
import requests
from utils import (
from ksef_utils.utils import (
render_template,
encrypt,
iso_to_milliseconds,
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
requests
pytest
pytest-cov
Jinja2
pycryptodome
lxml
15 changes: 15 additions & 0 deletions run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

set -xe

# export TESTS_MARKERS="e2e and not ignore"
# export TESTS_MARKERS="functional and not ignore"
export TESTS_MARKERS="current and not ignore"

python \
-m pytest \
tests \
-m "$TESTS_MARKERS" \
--cov-report term \
--cov=ksef_utils \
-svvv
25 changes: 25 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[metadata]
name = ksef-utils
version = file:VERSION
author = Piotr Przetacznik
author_email = "piotr.przetacznik+ksef@gmail.com",
long_description = file:README.md
url = https://github.com/pprzetacznik/ksef-utils
keywords =
invoices
ksef
classifiers =
Development Status :: 5 - Production/Stable
Environment :: Console
Intended Audience :: Developers
Intended Audience :: System Administrators
Intended Audience :: Financial and Insurance Industry
Intended Audience :: End Users/Desktop
Intended Audience :: Customer Service
License :: Other/Proprietary License
Programming Language :: Python :: 3.11
license_files =
LICENSE

[bdist_wheel]
universal = 0
14 changes: 14 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from os.path import join, dirname
from setuptools import setup, find_packages


def read(fname):
with open(join(dirname(__file__), fname)) as f:
return f.read()


setup(
packages=find_packages(),
package_data={"": ["*.txt"]},
install_requires=read("requirements.txt").splitlines(),
)
Empty file added tests/__init__.py
Empty file.
4 changes: 2 additions & 2 deletions conftest.py → tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import logging
from os import getenv
from pytest import fixture
from server import KSEFServer, KSEFService
from config import TestConfig, DemoConfig, ProdConfig
from ksef_utils.server import KSEFServer, KSEFService
from ksef_utils.config import TestConfig, DemoConfig, ProdConfig


@fixture
Expand Down
3 changes: 1 addition & 2 deletions test_ksef.py → tests/test_ksef.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from datetime import datetime
from time import sleep
from json import dumps
from pytest import mark, fixture
from utils import format_xml
from ksef_utils.utils import format_xml


@mark.current
Expand Down

0 comments on commit 8cd8ae3

Please sign in to comment.