diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml new file mode 100644 index 000000000..1eb737ecd --- /dev/null +++ b/.github/workflows/python-app.yml @@ -0,0 +1,36 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Python application + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.10 + uses: actions/setup-python@v2 + with: + python-version: "3.10" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + python -m pytest diff --git a/.gitignore b/.gitignore index 86f7f584d..5152c3d1b 100755 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ __pycache__/ *.py[cod] -*.iml -*.xml +*.iml +*.xml .idea/ .cache/ .pytest_cache/ @@ -11,3 +11,9 @@ __pycache__/ # Python egg metadata, regenerated from source files by setuptools. /*.egg-info /*.egg +# docs +build/ +pythonenv3.8/ +.vscode/ +# Ignoring the virtual Environment when using GitHub Codespaces +.venv/ \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index b3be12855..94607d486 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,39 +1,30 @@ group: travis_latest +dist: xenial # Travis CI's default distro language: python -cache: pip -python: - - 3.6 - #- nightly - #- pypy3 +cache: + directories: + - $HOME/.cache/pip matrix: - allow_failures: - - python: nightly - - python: pypy3 + include: + - python: 3.6 + env: TOX_ENV=py36 + - python: 3.7 + env: TOX_ENV=py37 install: - - pip install -r requirements.txt - - pip install flake8 # pytest # add another testing frameworks later - - pip install python-coveralls - - pip install coverage - - pip install nose + - pip install -r test_requirements.txt before_script: + # run black to check if some files would need reformatting + - black --check . || true # stop the build if there are Python syntax errors or undefined names - - flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics + - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics script: # Check python install package - - pip3 install -e . - # Check unittest running - - python3 -m unittest discover tests - # Check pytest running - - python3 -m pytest tests - # Run nose with coverage support - - nosetests --with-coverage + - pip install -e . + - tox -e $TOX_ENV # Check python uninstall package - - pip3 uninstall -y algorithms + - pip uninstall -y algorithms notifications: on_success: change on_failure: change # `always` will be the setting once code changes slow down - -after_success: - - coveralls diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 380bd3d64..6eac6c029 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,8 +11,9 @@ agree to abide by the [Code of Conduct](CODE_OF_CONDUCT.md). * After that create a branch for your changes. For example: * add_XXX if you will add new algorithms or data structures. - * fix_XXX if you will fixe a bug on a certain algorithm or data structure. + * fix_XXX if you will fix a bug on a certain algorithm or data structure. * test_XXX if you wrote a test/s. + * doc_XXX if you added to or edited documentation. You may contribute by: - implementing new algorithms in the repo. Be sure to keep it under @@ -23,6 +24,7 @@ it doesn't fall under any section. Make sure that your implementation works. - finding and fixing bugs. - adding examples to explain the algorithms better. - adding test cases. +- improving documentation. ## Pull Requests Push to your fork and [submit a pull request][pr]. diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 000000000..50af9b9c9 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,3 @@ +include README.md +include LICENSE +include algorithms/* diff --git a/README.md b/README.md index fce6c05a3..65caeb5ca 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,10 @@ -English | [简体中文](https://github.com/yunshuipiao/algorithms/blob/master/README_CN.md) | [Deutsch](README_GE.md) - +[](https://badge.fury.io/py/algorithms) [](https://www.codetriage.com/keon/algorithms) [](https://travis-ci.org/keon/algorithms) [](https://coveralls.io/github/keon/algorithms?branch=master) +