-
Notifications
You must be signed in to change notification settings - Fork 16
Packaging and other cleanup #159
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
5ff5385
Refactor project layout: source code in src/, tests in tests/
alanbriolat c4d9b7a
Install as package, create `csbot` entrypoint
alanbriolat c597818
Move runtime requirements to setup.py
alanbriolat 343bc54
Use tox in Travis CI
alanbriolat 97e7eb5
Fix up docker build for new layout
alanbriolat a82ebd5
Don't build image twice on docker hub, re-use built image for tests
alanbriolat 137588c
Re-enable coveralls in Travis
alanbriolat 88ba430
Remove redundant docker-entrypoint.sh
alanbriolat 481701e
Actually fix coveralls this time?
alanbriolat e356d81
docker: run as non-root user, reduce context with .dockerignore white…
alanbriolat 260a652
Bump version (somewhat arbitrarily), use setuptools not distutils...
alanbriolat d78c71b
Add --version option to csbot command
alanbriolat 9f7c69c
Tweaks
alanbriolat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 @@ | ||
| # Exclude everything by default | ||
| * | ||
|
|
||
| # Whitelist specific files | ||
| !src/**/* | ||
| !tests/**/* | ||
| !setup.py | ||
| !requirements.txt | ||
| !pytest.ini | ||
| !csbot.*.cfg | ||
|
|
||
| # Exclude Python temp files | ||
| **/__pycache__ | ||
| **/*.pyc | ||
This file contains hidden or 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 hidden or 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,15 +1,16 @@ | ||
| FROM python:3.7 | ||
|
|
||
| VOLUME /app | ||
| WORKDIR /app | ||
| COPY csbot ./csbot | ||
| COPY csbot.*.cfg requirements.txt run_csbot.py docker-entrypoint.sh ./ | ||
| RUN find . -name '*.pyc' -delete | ||
| ARG UID=9000 | ||
| ARG GID=9000 | ||
|
|
||
| RUN groupadd -g $GID app \ | ||
| && useradd -u $UID -g $GID --no-create-home app | ||
|
|
||
| COPY --chown=app:app . /app | ||
| WORKDIR /app | ||
| RUN pip install -r requirements.txt | ||
|
|
||
| ARG SOURCE_COMMIT | ||
| ENV SOURCE_COMMIT $SOURCE_COMMIT | ||
|
|
||
| ENTRYPOINT ["./docker-entrypoint.sh"] | ||
| CMD ["./csbot.cfg"] | ||
| USER app:app | ||
| CMD ["csbot", "csbot.cfg"] |
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -2,6 +2,5 @@ version: "3" | |
|
|
||
| services: | ||
| sut: | ||
| build: . | ||
| entrypoint: pytest | ||
| command: [] | ||
| image: "${IMAGE_NAME}" | ||
| command: pytest | ||
This file contains hidden or 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 was deleted.
Oops, something went wrong.
This file contains hidden or 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,5 @@ | ||
| [pytest] | ||
| testpaths = tests/ | ||
| addopts = --cov=src/ | ||
| markers = | ||
| bot: mark a test as Bot-based rather than IRCClient-based |
This file contains hidden or 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,28 +1,17 @@ | ||
| # Requirements for deployment | ||
| click>=6.2,<7.0 | ||
| straight.plugin==1.4.0-post-1 | ||
| pymongo>=3.6.0 | ||
| requests>=2.9.1,<3.0.0 | ||
| lxml>=2.3.5 | ||
| aiogoogle==0.1.13 | ||
| isodate>=0.5.1 | ||
| aiohttp>=3.5.1,<4.0 | ||
| async_generator>=1.10,<2.0 | ||
| rollbar | ||
|
|
||
| # Requirements for unit testing | ||
| pytest==4.2.0 | ||
| pytest-asyncio==0.10.0 | ||
| pytest-aiohttp==0.3.0 | ||
| #aioresponses==0.6.0 | ||
| git+https://github.com/alanbriolat/aioresponses.git@callback-coroutines#egg=aioresponses | ||
| pytest-cov==2.6.1 | ||
| pytest-cov | ||
| asynctest==0.12.2 | ||
| aiofastforward==0.0.17 | ||
| responses | ||
| python-coveralls>=2.6.0,<2.7.0 | ||
| mongomock | ||
|
|
||
| # Requirements for documentation | ||
| # (commented out to save build time) | ||
| #sphinx | ||
|
|
||
| -e . |
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,5 +1,33 @@ | ||
| from distutils.core import setup | ||
| setup(name='csbot', | ||
| version='0.1', | ||
| packages=['csbot', 'csbot.plugins'], | ||
| ) | ||
| import setuptools | ||
|
|
||
|
|
||
| setuptools.setup( | ||
| name='csbot', | ||
| version='0.3.0', | ||
| author='Alan Briolat', | ||
| author_email='alan@briol.at', | ||
| url='https://github.com/HackSoc/csbot', | ||
| packages=['csbot', 'csbot.plugins'], | ||
| package_dir={'': 'src'}, | ||
| classifiers=[ | ||
| 'Programming Language :: Python :: 3.6', | ||
| 'Programming Language :: Python :: 3.7', | ||
| ], | ||
| install_requires=[ | ||
| 'click>=6.2,<7.0', | ||
| 'straight.plugin==1.4.0-post-1', | ||
| 'pymongo>=3.6.0', | ||
| 'requests>=2.9.1,<3.0.0', | ||
| 'lxml>=2.3.5', | ||
| 'aiogoogle>=0.1.13', | ||
| 'isodate>=0.5.1', | ||
| 'aiohttp>=3.5.1,<4.0', | ||
| 'async_generator', | ||
| 'rollbar', | ||
| ], | ||
| entry_points={ | ||
| 'console_scripts': [ | ||
| 'csbot = csbot:main', | ||
| ], | ||
| }, | ||
| ) |
This file contains hidden or 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or 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,6 +1,6 @@ | ||
| import pytest | ||
|
|
||
| from csbot.test import TempEnvVars | ||
| from . import TempEnvVars | ||
| import csbot.plugin | ||
|
|
||
|
|
||
|
|
||
File renamed without changes.
This file contains hidden or 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
File renamed without changes.
File renamed without changes.
This file contains hidden or 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
File renamed without changes.
This file contains hidden or 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,6 +1,6 @@ | ||
| import pytest | ||
|
|
||
| from csbot.test import read_fixture_file | ||
| from . import read_fixture_file | ||
|
|
||
|
|
||
| test_cases = [ | ||
|
|
||
File renamed without changes.
File renamed without changes.
This file contains hidden or 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
File renamed without changes.
File renamed without changes.
This file contains hidden or 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 hidden or 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
File renamed without changes.
This file contains hidden or 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,13 @@ | ||
| [tox] | ||
| envlist = py36,py37 | ||
| skipsdist = True | ||
|
|
||
| [testenv] | ||
| passenv = TRAVIS TRAVIS_* | ||
| deps = | ||
| -r requirements.txt | ||
| coveralls: coveralls | ||
| commands = | ||
| python -m pytest {posargs} | ||
| # Try to run coveralls, but don't fail if coveralls fails | ||
| coveralls: - coveralls |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i thought we didn't want tests in the docker?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't want tests in a Python package (e.g.
bdist_wheel), but they are deliberately in the Docker image so that tests get run inside the image as part of the Docker Hub build process. That way we have confidence that the produced image will run the bot correctly.(There may be better ways to run tests without leaving them in the image, but I couldn't figure out a better one yet.)