Skip to content

Commit 7ebd5ea

Browse files
authored
Modernize Python project setup (#40)
* Add modern Python project setup * Run pre-commit fixes
1 parent 6897444 commit 7ebd5ea

File tree

10 files changed

+273
-107
lines changed

10 files changed

+273
-107
lines changed

.flake8

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[flake8]
2+
max-line-length = 88
3+
extend-ignore = E203,W503

.github/workflows/ci.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
- uses: actions/setup-python@v5
14+
with:
15+
python-version: '3.11'
16+
- uses: pre-commit/action@v3.0.1
17+
- name: Install dependencies
18+
run: |
19+
python -m pip install --upgrade pip
20+
pip install -r requirements.txt -r requirements-dev.txt
21+
- name: Run tests
22+
run: pytest -q

.gitignore

Lines changed: 101 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,106 @@
1-
.coverage
2-
MANIFEST
3-
coverage.xml
4-
nosetests.xml
5-
junit-report.xml
6-
pylint.txt
7-
toy.py
8-
tox.ini
9-
violations.pyflakes.txt
10-
cover/
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
env/
1112
build/
12-
docs/_build
13-
requests.egg-info/
14-
*.pyc
15-
*.swp
13+
develop-eggs/
14+
dist/
15+
downloads/
16+
.eggs/
17+
.eggs/**.egg-info/
18+
lib/
19+
lib64/
20+
parts/
21+
sdist/
22+
var/
23+
*.egg-info/
24+
.installed.cfg
1625
*.egg
17-
env/
26+
docs/_build/
27+
28+
# PyInstaller
29+
# Usually these files are written by a python script from a template
30+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
31+
*.manifest
32+
*.spec
33+
34+
# Installer logs
35+
pip-log.txt
36+
pip-delete-this-directory.txt
37+
38+
# Unit test / coverage reports
39+
htmlcov/
40+
.tox/
41+
.coverage
42+
.coverage.*
43+
.cache
44+
nosetests.xml
45+
coverage.xml
46+
*,cover
47+
.hypothesis/
48+
.pytest_cache/
49+
50+
# Translations
51+
*.mo
52+
*.pot
53+
54+
# Django stuff:
55+
*.log
56+
local_settings.py
57+
58+
# Flask stuff:
59+
instance/
60+
.webassets-cache
61+
62+
# Scrapy stuff:
63+
.scrapy
64+
65+
# Sphinx documentation
66+
docs/_build/
67+
68+
# PyBuilder
69+
.target/
70+
71+
# Jupyter Notebook
72+
.ipynb_checkpoints
73+
74+
# IPython
75+
profile_default/
76+
ipython_config.py
77+
78+
# pyenv
79+
.python-version
80+
81+
# pipenv
82+
Pipfile.lock
83+
84+
# poetry
85+
poetry.lock
86+
87+
# macOS
88+
.DS_Store
89+
90+
# VS Code
91+
.vscode/
92+
93+
# backup files
94+
*~
95+
96+
# mypy
97+
.mypy_cache/
98+
99+
# pre-commit
100+
.pre-commit/
18101

19-
.workon
102+
# coverage
103+
htmlcov/
20104

21-
t.py
105+
# others
22106

23-
t2.py
24-
dist

.pre-commit-config.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
repos:
2+
- repo: https://github.com/psf/black
3+
rev: 25.1.0
4+
hooks:
5+
- id: black
6+
- repo: https://github.com/pycqa/isort
7+
rev: 5.13.2
8+
hooks:
9+
- id: isort
10+
- repo: https://github.com/pycqa/flake8
11+
rev: 7.2.0
12+
hooks:
13+
- id: flake8

README.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
[![CircleCI](https://circleci.com/gh/MissiaL/hikvision-client.svg?style=svg)](https://circleci.com/gh/MissiaL/hikvision-client)
2+
[![CI](https://github.com/MissiaL/hikvision-client/actions/workflows/ci.yml/badge.svg)](https://github.com/MissiaL/hikvision-client/actions/workflows/ci.yml)
33

44

55
# Python Library for Hikvision Cameras
@@ -160,12 +160,8 @@ with open('screen.jpg', 'wb') as f:
160160

161161

162162
```bash
163-
pipenv install --dev
164-
pipenv run pytest
165-
pipenv run pytest --cov-report html --cov hikvisionapi # to get coverage report in ./htmlcov/
166-
167-
# or you can get into the virtual env with:
168-
pipenv shell
169-
pytest
163+
python -m pip install -r requirements.txt -r requirements-dev.txt
164+
pre-commit run --all-files
165+
pytest --cov-report html --cov hikvisionapi
170166
```
171167

hikvisionapi/__init__.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
from .hikvisionapi import AsyncClient
2-
from .hikvisionapi import Client
1+
from .hikvisionapi import AsyncClient, Client
32

4-
__title__ = 'hikvisionapi'
5-
__version__ = '0.3.2'
6-
__author__ = 'Petr Alekseev'
7-
__license__ = 'MIT'
8-
__copyright__ = 'Copyright 2018 Petr Alekseev'
3+
__all__ = ["Client", "AsyncClient"]
4+
5+
__title__ = "hikvisionapi"
6+
__version__ = "0.3.2"
7+
__author__ = "Petr Alekseev"
8+
__license__ = "MIT"
9+
__copyright__ = "Copyright 2018 Petr Alekseev"

0 commit comments

Comments
 (0)