Skip to content

Commit 3d12be3

Browse files
Merge pull request #12 from Riminder/feature/use-poetry
Migrate to Poetry and Pytest
2 parents 20dd123 + 65c9d2a commit 3d12be3

57 files changed

Lines changed: 3813 additions & 723 deletions

Some content is hidden

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

.env.example

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
HRFLOW_API_KEY="___FILL_ME___"
2+
HRFLOW_API_KEY_READ="___FILL_ME___"
3+
HRFLOW_USER_EMAIL="___FILL_ME___"
4+
HRFLOW_ALGORITHM_KEY="___FILL_ME___"
5+
HRFLOW_BOARD_KEY="___FILL_ME___"
6+
HRFLOW_JOB_KEY="___JOB_KEY_IN_BOARD___"
7+
HRFLOW_PROFILE_KEY="___PROFILE_KEY_IN_SOURCE_QUICKSILVER_SYNC___"
8+
HRFLOW_SOURCE_KEY_HAWK_SYNC="___FILL_ME___"
9+
HRFLOW_SOURCE_KEY_QUICKSILVER_SYNC="___FILL_ME___"
10+
HRFLOW_SOURCE_KEY_QUICKSILVER_ASYNC="___FILL_ME___"
11+
HRFLOW_SOURCE_KEY_MOZART_ASYNC="___FILL_ME___"

.flake8

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[flake8]
2+
max-line-length = 88
3+
exclude = .pytest_cache, __pycache__, .env, .venv
4+
black-config = pyproject.toml
5+
per-file-ignores = __init__.py:F401
6+
ignore = E731, W503, E203

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Env
2+
.env
3+
14
# Datas
25
*.png
36
*.jpg
@@ -9,6 +12,7 @@ credentials
912
credentials_seg
1013
test/*
1114
test_assets/*
15+
tests/assets
1216
.htpasswd
1317

1418
docker/dependencies/libs/*

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) [year] [fullname]
3+
Copyright (c) 2023 HrFlow.ai
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Makefile

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,30 @@
11
# Define variables
22
ARGS :=
33

4-
install_req:
5-
pip install -U setuptools setuptools_scm wheel && python -m pip install twine
6-
74
clean:
85
rm -rf build dist *.egg-info
96

7+
clean_cache:
8+
find . -type d \( -name '__pycache__' -o -name '.pytest_cache' \) -exec rm -rf {} +
9+
rm -rf tests/assets
10+
1011
build:
11-
python setup.py sdist bdist_wheel
12+
poetry build
1213

1314
git-tag:
1415
./tag.sh $(ARGS)
1516

1617
deploy-test:
17-
python -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*
18+
poetry publish -r test-pypi --build
1819

1920
deploy:
20-
python -m twine upload dist/*
21+
poetry publish --build
22+
23+
flake8:
24+
poetry run flake8 --config=./.flake8
25+
26+
style:
27+
poetry run isort . && poetry run black --config=./pyproject.toml .
28+
29+
check:
30+
bash ./check.sh

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Install using `pip install -U hrflow` or `conda install hrflow -c conda-forge`.
5656

5757
```py
5858
from hrflow import Hrflow
59-
client = Hrflow(api_secret="YOUR_API_KEY"; api_user="YOU_USER_EMAIL")
59+
client = Hrflow(api_secret="YOUR_API_KEY", api_user="YOU_USER_EMAIL")
6060

6161
# read file from directory (in binary mode)
6262
with open("path_to_file.pdf", "rb") as f:

README.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

check.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
PYTEST_RUN="poetry run pytest"
4+
PYTEST_OPTIONS=(--verbose --tb=long --strict-markers --durations=0 --datefmt "%Y-%m-%d %H:%M:%S.%f%z")
5+
PYTEST_DIR=tests/
6+
7+
if [ "$#" -gt 0 ]; then
8+
for marker in "$@"; do
9+
$PYTEST_RUN "${PYTEST_OPTIONS[@]}" "$PYTEST_DIR" -m "$marker"
10+
done
11+
else
12+
$PYTEST_RUN "${PYTEST_OPTIONS[@]}" "$PYTEST_DIR"
13+
fi

hrflow/__init__.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1+
from .__version__ import (
2+
__author__,
3+
__author_email__,
4+
__description__,
5+
__license__,
6+
__title__,
7+
__url__,
8+
__version__,
9+
)
110
from .hrflow.hrflow import Hrflow
2-
3-
from .__version__ import __title__, __description__, __url__, __version__
4-
from .__version__ import __author__, __author_email__, __license__

hrflow/__version__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
import importlib.metadata
2+
13
__title__ = "hrflow"
24
__description__ = "Python hrflow.ai API package"
35
__url__ = "https://github.com/hrflow/python-hrflow-api"
4-
__version__ = "3.1.1"
6+
__version__ = importlib.metadata.version("hrflow")
57
__author__ = "HrFlow.ai"
68
__author_email__ = "contact@hrflow.ai"
79
__license__ = "MIT"

0 commit comments

Comments
 (0)