-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
try python app github workflow (#500)
Migrate from Travis CI to Github Actions * moves all setup.py stuff to be declarative (put in setup.cfg instead) * readme.md is now rendered as markdown on pypi listing, yay! * move all requirements.txt into setup.cfg
- Loading branch information
Showing
10 changed files
with
162 additions
and
137 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,41 @@ | ||
# This workflow will install Python dependencies, run tests and lint with a single version of Python | ||
# For more information see: https://docs.github.com/en/actions/guides/building-and-testing-python | ||
|
||
name: Python application | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [3.6, 3.7, 3.8] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install flake8 pytest pytest-cov | ||
pip install -e ".[testing]" | ||
pip install coveralls | ||
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: | | ||
pytest --cov psiturk | ||
- name: Upload coverage data to coveralls.io | ||
run: | | ||
coveralls --service=github | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,41 @@ | ||
# This workflows will upload a Python Package using Twine when a release is created | ||
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | ||
|
||
# Also, see https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ | ||
name: Upload Python Package | ||
|
||
on: push | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
- name: Install pypa/build | ||
run: >- | ||
python -m | ||
pip install | ||
build | ||
--user | ||
- name: Build a binary wheel and a source tarball | ||
run: >- | ||
python -m | ||
build | ||
--sdist | ||
--wheel | ||
--outdir dist/ | ||
- name: Publish distribution 📦 to Test PyPI | ||
uses: pypa/gh-action-pypi-publish@master | ||
with: | ||
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | ||
repository_url: https://test.pypi.org/legacy/ | ||
- name: Publish distribution 📦 to PyPI | ||
if: startsWith(github.ref, 'refs/tags') | ||
uses: pypa/gh-action-pypi-publish@master | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} |
This file was deleted.
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
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,3 +1,2 @@ | ||
recursive-include psiturk * | ||
include requirements.txt | ||
include LICENSE |
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 +1,2 @@ | ||
from psiturk import * | ||
from psiturk.version import version_number as __version__ |
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 @@ | ||
[build-system] | ||
requires = ["setuptools >= 46.4.0", "wheel"] | ||
build-backend = "setuptools.build_meta" |
This file was deleted.
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,8 +1,79 @@ | ||
[metadata] | ||
name = PsiTurk | ||
version = attr: psiturk.version.version_number | ||
classifiers = | ||
Programming Language :: Python | ||
Programming Language :: Python :: 3 | ||
Programming Language :: Python :: 3.6 | ||
Programming Language :: Python :: 3.7 | ||
author = NYU Computation and Cognition Lab | ||
author_email = authors@psiturk.org | ||
description = An open platform for science on Amazon Mechanical Turk | ||
long_description = file: README.md | ||
long_description_content_type = text/markdown | ||
url = https://github.com/NYUCCL/psiturk | ||
|
||
[options] | ||
install_requires = | ||
Flask_RESTful~=0.3.7 | ||
boto3~=1.9.179 | ||
fuzzywuzzy~=0.17.0 | ||
cmd2~=0.9.14 | ||
psutil~=5.6.3 | ||
Flask_Login~=0.4.1 | ||
gunicorn[gevent]~=20.0.4 | ||
Flask~=1.1.1 | ||
certifi~=2019.11.28 | ||
pytz~=2019.1 | ||
user_agents~=2.0 | ||
docopt~=0.6.2 | ||
urllib3~=1.25.3 | ||
Faker~=1.0.7 | ||
requests~=2.22.0 | ||
APScheduler~=3.6.1 | ||
botocore~=1.12.179 | ||
SQLAlchemy~=1.3.5 | ||
pytest~=6.1.1 | ||
future~=0.17.1 | ||
GitPython~=3.1.0 | ||
python-dotenv~=0.12.0 | ||
python_dateutil~=2.8.1 | ||
pyOpenSSL~=19.0.0 | ||
setproctitle~=1.1.10 | ||
packages= | ||
psiturk | ||
psiturk.api | ||
psiturk.dashboard | ||
include_package_data = True | ||
zip_safe = False | ||
setup_requires = | ||
pytest-runner | ||
|
||
[options.extras_require] | ||
dev = | ||
sphinx | ||
sphinx_rtd_theme | ||
sphinx-server | ||
testing = | ||
pytest | ||
ciso8601 | ||
pytest-mock | ||
pytest-socket | ||
pytz | ||
|
||
[options.entry_points] | ||
console_scripts = | ||
psiturk-shell = psiturk.psiturk_shell:run | ||
psiturk = psiturk.command_line:process | ||
psiturk-server = psiturk.command_line:process | ||
psiturk-setup-example = psiturk.command_line:process | ||
psiturk-heroku-config = psiturk.command_line:process | ||
|
||
[aliases] | ||
test=pytest | ||
|
||
[testenv] | ||
deps = .[test] | ||
|
||
[tool:pytest] | ||
addopts = --disable-socket | ||
addopts = --disable-socket |
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,70 +1,2 @@ | ||
from setuptools import setup | ||
from psiturk.version import version_number | ||
|
||
try: | ||
with open("README.md") as readmefile: | ||
readme_text = readmefile.readlines() | ||
long_description = '' | ||
for line in readme_text: | ||
if line[0] != '<' and line[0] != '[': # drop lines that are html/markdown | ||
long_description += line | ||
except IOError: | ||
long_description = "" | ||
|
||
test_deps = ['pytest', 'ciso8601', 'pytest-mock', 'pytest-socket', 'pytz'] | ||
|
||
if __name__ == "__main__": | ||
# remove file if it exists and re-write with current version number | ||
fp = open('psiturk/version.py', "w+") | ||
fp.write("version_number = '%s'\n" % version_number) | ||
fp.flush() | ||
fp.close() | ||
|
||
setup_args = dict( | ||
name="PsiTurk", | ||
version=version_number, | ||
packages=['psiturk', 'psiturk.api', 'psiturk.dashboard'], | ||
include_package_data=True, | ||
zip_safe=False, | ||
entry_points={ | ||
'console_scripts': [ | ||
'psiturk-shell = psiturk.psiturk_shell:run', | ||
'psiturk = psiturk.command_line:process', | ||
'psiturk-server = psiturk.command_line:process', | ||
'psiturk-setup-example = psiturk.command_line:process', | ||
'psiturk-install = psiturk.command_line:process', | ||
'psiturk-heroku-config = psiturk.command_line:process' | ||
] | ||
}, | ||
setup_requires=['pytest-runner'], | ||
tests_require=test_deps, | ||
extras_require={ | ||
':python_version == "2.7"': ['futures'], | ||
'dev': ['sphinx', 'sphinx_rtd_theme', 'sphinx-server'], | ||
'test': test_deps | ||
}, | ||
author="NYU Computation and Cognition Lab", | ||
author_email="authors@psiturk.org", | ||
description="An open platform for science on Amazon Mechanical Turk", | ||
long_description=long_description, | ||
url="https://github.com/NYUCCL/psiturk", | ||
test_suite='test_psiturk', | ||
classifiers=[ | ||
'Programming Language :: Python', | ||
'Programming Language :: Python :: 3', | ||
'Programming Language :: Python :: 3.6', | ||
'Programming Language :: Python :: 3.7', | ||
] | ||
) | ||
|
||
# read in requirements.txt for dependencies | ||
setup_args['install_requires'] = install_requires = [] | ||
with open('requirements.txt') as f: | ||
for line in f.readlines(): | ||
req = line.strip() | ||
if not req or req.startswith('#'): # ignore comments | ||
continue | ||
else: | ||
install_requires.append(req) | ||
|
||
setup(**setup_args) | ||
setup() |