-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from dmitry-ed-gusev/feature/update-project-wit…
…h-pipenv Feature/update project with pipenv
- Loading branch information
Showing
79 changed files
with
4,163 additions
and
1,390 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
############################################################################### | ||
# | ||
# Configuration file .coveragerc for control of the behaviour of | ||
# coverage.py / pytest-cov plugins. | ||
# See full doc here: | ||
# - https://coverage.readthedocs.io/en/latest/config.html | ||
# - https://pytest-cov.readthedocs.io/en/latest/index.html | ||
# | ||
# Created: Dmitrii Gusev, 09.10.2022 | ||
# Modified: Dmitrii Gusev, 27.11.2022 | ||
# | ||
############################################################################### | ||
|
||
[run] | ||
branch = True | ||
data_file = .coverage/.coverage | ||
omit = | ||
*__init__* | ||
*/temp/* | ||
*/tests/* | ||
*/.vscode/* | ||
|
||
[report] | ||
show_missing = True | ||
# -- show 2 decimal digits for coverage values | ||
precision = 2 | ||
|
||
[html] | ||
directory = .coverage/htmlcoverage | ||
title = "PyUtilities: Tests Coverage Report" | ||
|
||
[xml] | ||
output = .coverage/coverage.xml | ||
|
||
# -- used by coverage.py, ignored by pytest-cov | ||
[json] | ||
output = .coverage/coverage.json | ||
pretty_print = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Set the default behavior, in case people don't have core.autocrlf set | ||
* text=auto | ||
|
||
# Explicitly declare text files you want to always be normalized and converted | ||
# to native line endings on checkout. | ||
# *.java text | ||
|
||
# Files that will always have LF line endings on checkout. | ||
*.sh text eol=lf | ||
*.py text eol=lf | ||
|
||
# Files that are truly binary and should not be modified. | ||
*.png binary | ||
*.jpg binary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"python.analysis.typeCheckingMode": "basic" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
[[source]] | ||
url = "https://pypi.org/simple" | ||
verify_ssl = true | ||
name = "pypi" | ||
|
||
[packages] | ||
pyutilities = {editable = true, path = "."} | ||
|
||
[dev-packages] | ||
mock = "*" | ||
nose2 = "*" | ||
pytest = "*" | ||
pytest-cov = "*" | ||
pytest-mock = "*" | ||
mypy = "*" | ||
types-six = "*" | ||
types-mock = "*" | ||
types-paramiko = "*" | ||
types-requests = "*" | ||
types-PyYAML = "*" | ||
flake8 = "*" | ||
black = "*" | ||
pre-commit = "*" | ||
twine = "*" | ||
build = "*" | ||
ipykernel = "*" | ||
responses = "*" | ||
sphinx = "*" | ||
hypothesis = "*" | ||
|
||
[requires] | ||
python_version = "3.10" | ||
|
||
[pipenv] | ||
allow_prereleases = true |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,66 @@ | ||
# [pyutilities] package | ||
# Pythin Utilities package | ||
|
||
**Useful Python 3.x utilities.** | ||
(C) 2018 - 2022, Dmitrii Gusev | ||
*Last update 10.01.2021* | ||
|
||
For content here | ||
[Github-flavored Markdown](https://guides.github.com/features/mastering-markdown/) | ||
was used. | ||
## Project Description | ||
|
||
**Versions history** | ||
|
||
0.13.1 | ||
Updated library dependencies. Added openpyxl as support of xlsx format was removed from | ||
Useful utilities/experimantal modules/research in python 3.x. Some of the modules/scripts are just a research or experiments... | ||
|
||
## Versions history | ||
|
||
**0.13.3** | ||
- updated build mechanism with pipenv, instead of virtualenv and requirements.txt file | ||
|
||
**0.13.1** | ||
Updated library dependencies. Added openpyxl as support of xlsx format was removed from | ||
xlrd library. Updated unit tests. Minor fixes / refactorings. Doc updates. Removed windows batch script. | ||
|
||
0.12.0 | ||
Significant update for library. Many changes were done and sometimes tested :). | ||
**0.12.0** | ||
Significant update for library. Many changes were done and sometimes tested :). | ||
|
||
Changes that were done: | ||
* added pylog.py module, for logging purposes (convenience mostly). Method setup_logging() was moved here (from utils.py). | ||
* method setup_logging() now is able to initialize logger by name and return it | ||
* added deprecation of direct execution to utils.py | ||
* added module strings.py for various convenient methods for strings (with unit tests) | ||
* added unit tests modules for strings.py and pylog.py | ||
* added pysftp.py module for working with SFTP protocol (currently - empty DRAFT!) | ||
* added pyssh.py module for working with SSH protocol (currently - DRAFT!) | ||
* added pymaven.py module for representing Maven functionalitys (not tested yet!) | ||
* added pygit.py module for representing Git functionality (PyGit class) | ||
* methods git_clean_global_proxy()/git_set_global_proxy() moved to pygit module | ||
* added internal exception class PyUtilsException (module pyexception.py) | ||
* added type hints for some classes methods/functions | ||
* added shell script for executing unit tests with creating coverage report | ||
|
||
0.5.5 | ||
|
||
- added pylog.py module, for logging purposes (convenience mostly). Method setup_logging() was moved here | ||
(from utils.py). | ||
- method setup_logging() now is able to initialize logger by name and return it | ||
- added deprecation of direct execution to utils.py | ||
- added module strings.py for various convenient methods for strings (with unit tests) | ||
- added unit tests modules for strings.py and pylog.py | ||
- added pysftp.py module for working with SFTP protocol (currently - empty DRAFT!) | ||
- added pyssh.py module for working with SSH protocol (currently - DRAFT!) | ||
- added pymaven.py module for representing Maven functionalitys (not tested yet!) | ||
- added pygit.py module for representing Git functionality (PyGit class) | ||
- methods git_clean_global_proxy()/git_set_global_proxy() moved to pygit module | ||
- added internal exception class PyUtilsException (module pyexception.py) | ||
- added type hints for some classes methods/functions | ||
- added shell script for executing unit tests with creating coverage report | ||
|
||
**0.5.5** | ||
Added compatability with Python 3.7. Should also still work on Python 2.7. Let me know if it's not the case :) | ||
|
||
0.5.4 | ||
**0.5.4** | ||
Added method contains_key() to Configuration class. | ||
|
||
0.5.3 | ||
**0.5.3** | ||
Added one utility method - write_report_to_file(). Minor fixes, comments improvements. | ||
|
||
0.5.0 | ||
**0.5.0** | ||
Added ability for ConfigurationXls class to merge provided list of dictionaries on init. Added more | ||
unit test cases for ConfigurationXls class (initialization, dictionaries merge). | ||
|
||
0.4.0 | ||
**0.4.0** | ||
Added ability for Configuration class to merge list of dictionaries on init. Minor improvements, | ||
added several unit test cases. Minor refactoring. | ||
|
||
0.3.0 | ||
**0.3.0** | ||
Added ConfigurationXls class. It extends (inherites) Configuration class with ability of | ||
loading configuration from XLS files, from specified sheet, as name=value pairs. Added some | ||
unit tests for new class. | ||
Added dependencies list: requirements.txt file. | ||
|
||
0.2.0 | ||
**0.2.0** | ||
Added tests and some new methods. | ||
|
||
0.1.0 | ||
**0.1.0** | ||
Initial version. Just draft of utilities library. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/usr/bin/env bash | ||
|
||
############################################################################### | ||
# | ||
# Build and test script for [pyutilities] project. | ||
# Script can be run from outside of virtual (pipenv) environment (from the | ||
# system shell) and from the pipenv environment as well (pipenv shell). | ||
# | ||
# Created: Dmitrii Gusev, 30.11.2021 | ||
# Modified: Dmitrii Gusev, 27.11.2022 | ||
# | ||
############################################################################### | ||
|
||
# -- safe bash scripting - fail-fast pattern (google for more info) | ||
set -euf -o pipefail | ||
|
||
# -- set up encoding/language | ||
export LANG="en_US.UTF-8" | ||
|
||
# -- verbose output mode (on/off) | ||
VERBOSE="--verbose" | ||
|
||
# -- build directories | ||
BUILD_DIR='build/' | ||
DIST_DIR='dist/' | ||
|
||
clear | ||
printf "Build of [PyUtilities] library is starting...\n" | ||
sleep 2 | ||
|
||
# -- clean build and distribution folders | ||
printf "\nClearing temporary directories.\n" | ||
printf "\nDeleting [%s]...\n" ${BUILD_DIR} | ||
rm -r ${BUILD_DIR} || printf "%s doesn't exist!\n" ${BUILD_DIR} | ||
printf "\nDeleting [%s]...\n" ${DIST_DIR} | ||
rm -r ${DIST_DIR} || printf "%s doesn't exist!\n" ${DIST_DIR} | ||
|
||
# -- clean caches and sync + lock pipenv dependencies (update from the file Pipfile.lock) | ||
# todo: make this update optional - by cmd line key | ||
printf "\n\nCleaning pipenv cache and update dependencies.\n\n" | ||
pipenv clean ${VERBOSE} | ||
pipenv update --outdated ${VERBOSE} | ||
pipenv update ${VERBOSE} | ||
|
||
# -- run black code formatter | ||
printf "\n\nExecuting [black] automatic code formatter.\n" | ||
pipenv run black src/ ${VERBOSE} --line-length 110 | ||
pipenv run black tests/ ${VERBOSE} --line-length 110 | ||
|
||
# -- run pytest with pytest-cov (see pytest.ini/setup.cfg - additional parameters) | ||
printf "\n\nExecuting tests.\n\n" | ||
pipenv run pytest tests/ | ||
|
||
# -- run mypy - types checker | ||
printf "\n\nExecuting [mypy] types checker\n\n" | ||
pipenv run mypy src/ | ||
pipenv run mypy tests/ | ||
|
||
# -- run flake8 for checking code formatting | ||
printf "\n\nExecuting [flake8] code format checker\n\n" | ||
pipenv run flake8 src/ | ||
pipenv run flake8 tests/ | ||
|
||
# -- build library distribution (binary whl and source (tar.gz) | ||
# -- (option -s -> tar.gz, option -w -> whl (binary) distribution) | ||
printf "\n\nBuilding distribution for [PyUtilities] library.\n\n" | ||
pipenv run python -m build -s -w | ||
|
||
printf "\nBuild finished.\n\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
############################################################################### | ||
# | ||
# Deployment script for [pyutilities] project. | ||
# Script can be run from outside of virtual (pipenv) environment (from the | ||
# system shell) and from the pipenv environment as well (pipenv shell). | ||
# | ||
# Created: Dmitrii Gusev, 27.11.2022 | ||
# Modified: | ||
# | ||
############################################################################### | ||
|
||
# -- safe bash scripting - fail-fast pattern (google for more info) | ||
set -euf -o pipefail | ||
|
||
# -- set up encoding/language | ||
export LANG="en_US.UTF-8" | ||
|
||
# -- upload new library to Test PyPi (TEST) | ||
# printf "\n\nUploading new library dist to test pypi repo\n\n" | ||
# twine upload --repository-url https://test.pypi.org/legacy/ dist/* | ||
|
||
# -- upload new library dist to real PyPi (PROD) | ||
printf "\n\nUploading library [pyutilities] to PyPi repository\n\n" | ||
twine upload -u "$1" -p "$2" dist/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/usr/bin/env bash | ||
|
||
############################################################################### | ||
# | ||
# General python environment setup/reset script. Script can be used to | ||
# re-create python general environment from 'scratch'. | ||
# Script installs basic libraries: | ||
# - pipenv | ||
# - jupyter | ||
# - pytest | ||
# Warning: script must be used (run) from shell, not from the virtual | ||
# environment (pipenv shell). | ||
# | ||
# Created: Dmitrii Gusev, 09.10.2022 | ||
# Modified: Dmitrii Gusev, 22.11.2022 | ||
# | ||
############################################################################### | ||
|
||
# -- safe bash scripting | ||
set -euf -o pipefail | ||
|
||
# -- general setup - some variables | ||
export LANG='en_US.UTF-8' | ||
TMP_FILE="req.txt" | ||
|
||
clear | ||
printf "Python Development Environment setup is starting...\n\n" | ||
|
||
# -- upgrading pip (just for the case) | ||
pip --no-cache-dir install --upgrade pip | ||
printf "\n\n ** upgrading pip - done **\n" | ||
|
||
# -- freeze current global dependencies | ||
pip freeze > ${TMP_FILE} | ||
printf "\n\n ** freezing the current dependencies to the [%s] file - done **\n\n" ${TMP_FILE} | ||
|
||
# -- remove all dependencies | ||
pip uninstall -r ${TMP_FILE} -y | ||
printf "\n\n ** uninstalling the current dependencies - done **\n" | ||
|
||
# -- list the current empty environment | ||
printf "\n\n--- The Current Empty Environment (no dependencies) ---\n\n" | ||
pip list | ||
sleep 5 | ||
|
||
# -- remove temporary file | ||
rm ${TMP_FILE} | ||
printf "\n\n ** removing tmp file %s - done **\n\n" ${TMP_FILE} | ||
|
||
# -- install necessary dependencies | ||
pip --no-cache-dir install pipenv pytest jupyter | ||
printf "\n\n ** installing core dependencies - done **\n" | ||
|
||
printf "\n\nPython Development Environment setup is done.\n\n\n" |
Oops, something went wrong.