Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try python app github workflow #500

Merged
merged 12 commits into from
May 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/python-app.yml
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 }}
41 changes: 41 additions & 0 deletions .github/workflows/python-publish.yml
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 }}
41 changes: 0 additions & 41 deletions .travis.yml

This file was deleted.

3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Add custom MTurk qualification support (#493)

### Changed
- Migrate from Travis CI to Github Actions (#500)

## [3.1.0]
### Added
- ability to launch the experiment server from a subdirectory instead of just
Expand Down
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
recursive-include psiturk *
include requirements.txt
include LICENSE
1 change: 1 addition & 0 deletions psiturk/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from psiturk import *
from psiturk.version import version_number as __version__
3 changes: 3 additions & 0 deletions pyproject.toml
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"
25 changes: 0 additions & 25 deletions requirements.txt

This file was deleted.

73 changes: 72 additions & 1 deletion setup.cfg
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
70 changes: 1 addition & 69 deletions setup.py
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()