Skip to content

Commit cf64d91

Browse files
committed
Modernize NetLicensing python client library
1 parent cf1854d commit cf64d91

48 files changed

Lines changed: 4439 additions & 287 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/netlicensing-publish-pypi.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflows will upload a Python Package using Twine when a release is created
22
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
33

4-
name: Publish to PyPI
4+
name: Python Client - Publish to PyPI
55

66
on:
77
release:
@@ -28,5 +28,4 @@ jobs:
2828
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
2929
run: |
3030
python setup.py sdist bdist_wheel
31-
# disabled until first public version
32-
# twine upload dist/*
31+
twine upload dist/*

.github/workflows/netlicensing-publish-testpypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflows will upload a Python Package using Twine when a release is created
22
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
33

4-
name: Publish to TestPyPI
4+
name: Python Client - Publish to TestPyPI
55

66
on:
77
release:

.github/workflows/netlicensing-python-test.yml renamed to .github/workflows/netlicensing-python-ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
33

4-
name: Python Client CI
4+
name: Python Client - CI
55

66
on:
77
push:
@@ -37,3 +37,6 @@ jobs:
3737
- name: Test with pytest
3838
run: |
3939
pytest
40+
- name: Upload Codecov
41+
run: |
42+
bash <(curl -s https://codecov.io/bash)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Python Client - Dependency Test
2+
3+
on:
4+
schedule:
5+
- cron: '*/59 * * * *'
6+
7+
jobs:
8+
build:
9+
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
python-version: [3.6, 3.7, 3.8]
14+
15+
steps:
16+
- name: Set up Python ${{ matrix.python-version }}
17+
uses: actions/setup-python@v2
18+
with:
19+
python-version: ${{ matrix.python-version }}
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install netlicensing-client

.gitignore

Lines changed: 20 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -1,130 +1,39 @@
1-
# Byte-compiled / optimized / DLL files
1+
# ── Python ────────────────────────────────────────────────────────────────────
22
__pycache__/
33
*.py[cod]
4+
*.pyo
45
*$py.class
5-
6-
# C extensions
76
*.so
87

9-
# Distribution / packaging
10-
.Python
8+
# ── Build & packaging ─────────────────────────────────────────────────────────
119
build/
12-
develop-eggs/
1310
dist/
14-
downloads/
15-
eggs/
16-
.eggs/
17-
lib/
18-
lib64/
19-
parts/
20-
sdist/
21-
var/
22-
wheels/
23-
pip-wheel-metadata/
24-
share/python-wheels/
2511
*.egg-info/
26-
.installed.cfg
2712
*.egg
28-
MANIFEST
29-
30-
# PyInstaller
31-
# Usually these files are written by a python script from a template
32-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33-
*.manifest
34-
*.spec
3513

36-
# Installer logs
37-
pip-log.txt
38-
pip-delete-this-directory.txt
14+
# ── Virtual environments ──────────────────────────────────────────────────────
15+
.env
16+
.venv/
17+
venv/
3918

40-
# Unit test / coverage reports
41-
htmlcov/
42-
.tox/
43-
.nox/
19+
# ── Testing & coverage ────────────────────────────────────────────────────────
4420
.coverage
4521
.coverage.*
46-
.cache
47-
nosetests.xml
4822
coverage.xml
49-
*.cover
50-
*.py,cover
51-
.hypothesis/
23+
htmlcov/
5224
.pytest_cache/
25+
.tox/
26+
.nox/
5327

54-
# Translations
55-
*.mo
56-
*.pot
57-
58-
# Django stuff:
59-
*.log
60-
local_settings.py
61-
db.sqlite3
62-
db.sqlite3-journal
63-
64-
# Flask stuff:
65-
instance/
66-
.webassets-cache
67-
68-
# Scrapy stuff:
69-
.scrapy
70-
71-
# Sphinx documentation
72-
docs/_build/
73-
74-
# PyBuilder
75-
target/
76-
77-
# Jupyter Notebook
78-
.ipynb_checkpoints
79-
80-
# IPython
81-
profile_default/
82-
ipython_config.py
83-
84-
# pyenv
85-
.python-version
86-
87-
# pipenv
88-
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89-
# However, in case of collaboration, if having platform-specific dependencies or dependencies
90-
# having no cross-platform support, pipenv may install dependencies that don't work, or not
91-
# install all needed dependencies.
92-
#Pipfile.lock
93-
94-
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
95-
__pypackages__/
96-
97-
# Celery stuff
98-
celerybeat-schedule
99-
celerybeat.pid
100-
101-
# SageMath parsed files
102-
*.sage.py
103-
104-
# Environments
105-
.env
106-
.venv
107-
env/
108-
venv/
109-
ENV/
110-
env.bak/
111-
venv.bak/
112-
113-
# Spyder project settings
114-
.spyderproject
115-
.spyproject
116-
117-
# Rope project settings
118-
.ropeproject
119-
120-
# mkdocs documentation
121-
/site
122-
123-
# mypy
28+
# ── Type checkers ─────────────────────────────────────────────────────────────
12429
.mypy_cache/
12530
.dmypy.json
126-
dmypy.json
127-
128-
# Pyre type checker
12931
.pyre/
130-
.vscode
32+
33+
# ── IDE / editor ──────────────────────────────────────────────────────────────
34+
.idea/
35+
.vscode/
36+
37+
# ── OS artefacts ──────────────────────────────────────────────────────────────
38+
.DS_Store
39+
Thumbs.db

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Changelog
2+
3+
## 0.1.0
4+
5+
- Rebuilt the package around a `src/` layout and `pyproject.toml` packaging.
6+
- Added `httpx`-based `NetLicensingClient` with API-key and username/password authentication.
7+
- Added typed Pydantic models for core NetLicensing entities.
8+
- Added services for products, product modules, licensees, license templates, licenses, tokens, transactions, payment methods, bundles, notifications, utility data, and validation.
9+
- Added deterministic pytest coverage using `httpx.MockTransport`.
10+
- Added demo CLI for validation and shop-token flows.

CONTRIBUTING.md

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Contributing
22

3-
## Adding features or fixing bugs
3+
## Add features or fix bugs
44

55
* Fork the repo
66
* Check out a feature or bug branch
@@ -11,6 +11,56 @@
1111
* Ensure tests are passing
1212
* Ensure branch is mergeable
1313

14-
## Testing
14+
## Setup
1515

16-
* Please make sure tests pass with `./script/test`
16+
```bash
17+
pip install -e ".[dev]"
18+
```
19+
20+
## Test
21+
22+
Testing is set up using [pytest](http://pytest.org) and coverage is handled with the pytest-cov plugin.
23+
24+
Run your tests with:
25+
26+
```bash
27+
pytest
28+
```
29+
30+
Coverage is reported in the terminal after each run.
31+
To view a detailed HTML report open `htmlcov/index.html` after running the tests.
32+
33+
To run the optional live integration tests against the NetLicensing demo account:
34+
35+
```bash
36+
NETLICENSING_LIVE_DEMO=1 pytest tests/test_live_demo.py -q
37+
```
38+
39+
## Type checking
40+
41+
```bash
42+
mypy src/netlicensing
43+
```
44+
45+
## Release
46+
47+
Create a source distribution and wheel:
48+
49+
```bash
50+
python -m build
51+
```
52+
53+
Verify the distribution before uploading:
54+
55+
```bash
56+
twine check dist/*
57+
```
58+
59+
Upload to TestPyPI first, then PyPI:
60+
61+
```bash
62+
# Test PyPI
63+
twine upload -r testpypi dist/*
64+
# PyPI
65+
twine upload dist/*
66+
```

0 commit comments

Comments
 (0)