Skip to content

Commit

Permalink
Remove Requirements File (#50)
Browse files Browse the repository at this point in the history
This removes the requirements file and moves them to setup.py. This
also updates the Pipeline and references to reflect the move.

Signed-off-by: David Brown <dmlb2000@gmail.com>
  • Loading branch information
dmlb2000 committed May 18, 2020
1 parent ac6ecad commit c5c05fe
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 104 deletions.
30 changes: 15 additions & 15 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
repos:
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v1.4.4
hooks:
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v1.5.2
hooks:
- id: autopep8
- repo: git://github.com/pre-commit/pre-commit-hooks
rev: v2.4.0
hooks:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.5.0
hooks:
- id: fix-encoding-pragma
- id: trailing-whitespace
- id: flake8
Expand All @@ -28,17 +28,17 @@ repos:
- id: name-tests-test
- id: pretty-format-json
args:
- --autofix
- --top-keys=_id
- --autofix
- --top-keys=_id
- id: sort-simple-yaml
files: '.yaml$'
- id: check-symlinks
- id: check-yaml
- id: detect-private-key
- id: requirements-txt-fixer
- id: trailing-whitespace
- repo: local
hooks:
- repo: local
hooks:
- id: pep257
name: pep257
entry: python -m pep257
Expand All @@ -49,8 +49,8 @@ repos:
entry: python -m pylint --rcfile=pylintrc --disable=W0612
language: system
types: [python]
- repo: git://github.com/Lucas-C/pre-commit-hooks
rev: v1.1.7
hooks:
- id: remove-tabs
- id: remove-crlf
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.1.7
hooks:
- id: remove-tabs
- id: remove-crlf
112 changes: 62 additions & 50 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,58 +3,70 @@ dist: bionic
cache: pip
python: 3.6
stages:
- lint
- test
- test-docker
- deploy
- lint
- test
- test-docs
- test-docker
- deploy
before_script:
- pip install ansible
- ansible-galaxy install pacifica.ansible_pacifica pacifica.ansible_travis
- ansible-playbook ~/.ansible/roles/pacifica.ansible_travis/molecule/common/playbook.yml -i ~/.ansible/roles/pacifica.ansible_travis/molecule/common/inventory.yml -e "ansible_python_interpreter=/home/travis/virtualenv/python${TRAVIS_PYTHON_VERSION}/bin/python travis_virtualenv=python${TRAVIS_PYTHON_VERSION} github_repository=uniqueid"
- pip install ansible
- ansible-galaxy install pacifica.ansible_pacifica pacifica.ansible_travis
- ansible-playbook ~/.ansible/roles/pacifica.ansible_travis/molecule/common/playbook.yml -i ~/.ansible/roles/pacifica.ansible_travis/molecule/common/inventory.yml -e "ansible_python_interpreter=/home/travis/virtualenv/python${TRAVIS_PYTHON_VERSION}/bin/python travis_virtualenv=python${TRAVIS_PYTHON_VERSION} github_repository=uniqueid"
script:
- coverage run --include='pacifica/uniqueid/*' -m pytest -xsv tests
- coverage report --include='pacifica/uniqueid/*' --omit='pacifica/uniqueid/wsgi*' -m --fail-under 100
- cd tests
- coverage run --include='*/pacifica/uniqueid/*' -m pytest -xsv
- coverage report --include='*/pacifica/uniqueid/*' --omit='*/pacifica/uniqueid/wsgi*' -m --fail-under 100
jobs:
include:
- stage: lint
script: pre-commit run -a
- python: 3.7
script: pre-commit run -a
- python: 3.8
script: pre-commit run -a
- stage: test
- python: 3.7
- python: 3.8
- stage: test-docker
sudo: required
python: 3.8
services:
- docker
script: >
docker-compose build --pull;
docker-compose up -d;
MAX_TRIES=60;
HTTP_CODE=$(curl -sL -w "%{http_code}\\n" 'localhost:8051/getid' -o /dev/null || true);
while [[ $HTTP_CODE != 404 && $MAX_TRIES > 0 ]] ; do
sleep 1;
HTTP_CODE=$(curl -sL -w "%{http_code}\\n" 'localhost:8051/getid' -o /dev/null || true)
MAX_TRIES=$(( MAX_TRIES - 1 ))
done;
curl 'http://127.0.0.1:8051/getid?range=1&mode=test'
- stage: deploy
language: python
before_install: skip
script: skip
python: 3.8
deploy:
skip_cleanup: true
provider: pypi
user: dmlb2000
distributions: sdist bdist_wheel
password:
secure: JDfdgUub3ICxJNW8LStwJLXsq6R7YI7RbRsrLNFj88ZhzY5MqVfsgVoFd1iWQ1radHiAQmDRMMFVFGE2tdMzuuKjvcPS1ziofzpvhzHQ2nAolFIKF96/20i1q0Rv8PEQxyyhrctpFzUttd9bwyaSXmh4aB0Ltx3w71yCWxFeyEQv6Qr288tvEydvcxaaZm5oKoH3ztvX7pXWFAkjv5AtzHz9chli1ROGY9IHaDAEmPzdIbnky5SMoMl4vnNXHNQOVipEW6Ru+FILa5mzYanyBauQ+KP+gAc+SkMXNEnb/QrfU3rY1jcEbUYqgwcK/Z0VD8iAV+Kc3NRQhZdy//kmqRVEA/r4Zo6JewR/zj+Fq9ArrNeig3qnKTYZBwGSsc5Es70rtZieYdUYw/A5KDSmkGHgzYFUbKPG8xu4hilVHOS4cBLhPokoER4AyJbChRvrk8eSA2FsuQy7UMfcRMXT3m9xOhdati+dok8LCL8qhKRqMJ/UX12kfw5aL2kWQKFLDkahNswONXQQdOeRV2uq/6RR9TZE++G2+jXZ8PcPlwuP2SH7tW9ChOunaspE62QUosfZnJtU8RggHjbXqeE/22LBE48uO4WLIqzmSvjF9LiWdXz2E9+b9GfKqcTZPOqnseiIEnWkxAwVfcUnrGCdBZS+CNpbPwUlHsNPcarGeUI=
on:
tags: true
- stage: lint
script: pre-commit run -a
- python: 3.7
script: pre-commit run -a
- python: 3.8
script: pre-commit run -a
- stage: test
- python: 3.7
- python: 3.8
- stage: test-docs
python: 3.8
before_script: skip
script: >
cd docs;
sphinx-build -T -E -b readthedocs -d _build/doctrees-readthedocs -D language=en . _build/html;
sphinx-build -T -b readthedocssinglehtmllocalmedia -d _build/doctrees-readthedocssinglehtmllocalmedia -D language=en . _build/localmedia;
sphinx-build -b latex -D language=en -d _build/doctrees . _build/latex;
sphinx-build -T -b epub -d _build/doctrees-epub -D language=en . _build/epub
- stage: test-docker
sudo: required
python: 3.8
services:
- docker
script: >
docker-compose build --pull;
docker-compose up -d;
MAX_TRIES=60;
HTTP_CODE=$(curl -sL -w "%{http_code}\\n" 'localhost:8051/getid' -o /dev/null || true);
while [[ $HTTP_CODE != 404 && $MAX_TRIES > 0 ]] ; do
sleep 1;
HTTP_CODE=$(curl -sL -w "%{http_code}\\n" 'localhost:8051/getid' -o /dev/null || true)
MAX_TRIES=$(( MAX_TRIES - 1 ))
done;
curl 'http://127.0.0.1:8051/getid?range=1&mode=test'
- stage: deploy
language: python
before_install: skip
script: skip
python: 3.8
deploy:
skip_cleanup: true
provider: pypi
user: dmlb2000
distributions: sdist bdist_wheel
password:
secure: JDfdgUub3ICxJNW8LStwJLXsq6R7YI7RbRsrLNFj88ZhzY5MqVfsgVoFd1iWQ1radHiAQmDRMMFVFGE2tdMzuuKjvcPS1ziofzpvhzHQ2nAolFIKF96/20i1q0Rv8PEQxyyhrctpFzUttd9bwyaSXmh4aB0Ltx3w71yCWxFeyEQv6Qr288tvEydvcxaaZm5oKoH3ztvX7pXWFAkjv5AtzHz9chli1ROGY9IHaDAEmPzdIbnky5SMoMl4vnNXHNQOVipEW6Ru+FILa5mzYanyBauQ+KP+gAc+SkMXNEnb/QrfU3rY1jcEbUYqgwcK/Z0VD8iAV+Kc3NRQhZdy//kmqRVEA/r4Zo6JewR/zj+Fq9ArrNeig3qnKTYZBwGSsc5Es70rtZieYdUYw/A5KDSmkGHgzYFUbKPG8xu4hilVHOS4cBLhPokoER4AyJbChRvrk8eSA2FsuQy7UMfcRMXT3m9xOhdati+dok8LCL8qhKRqMJ/UX12kfw5aL2kWQKFLDkahNswONXQQdOeRV2uq/6RR9TZE++G2+jXZ8PcPlwuP2SH7tW9ChOunaspE62QUosfZnJtU8RggHjbXqeE/22LBE48uO4WLIqzmSvjF9LiWdXz2E9+b9GfKqcTZPOqnseiIEnWkxAwVfcUnrGCdBZS+CNpbPwUlHsNPcarGeUI=
on:
tags: true
install:
- pip install -r requirements-dev.txt
- pip freeze
- pip install -r requirements-dev.txt
- pip install .
- pip freeze
6 changes: 2 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
FROM python:3.8

WORKDIR /usr/src/app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
RUN pip install --no-cache-dir .
RUN pip install --no-cache-dir uwsgi pymysql psycopg2 cryptography
ENV PEEWEE_PROTO mysql
ENV PEEWEE_USER uniqueid
ENV PEEWEE_PASS uniqueid
ENV PEEWEE_PORT 3306
ENV PEEWEE_ADDR 127.0.0.1
ENV PEEWEE_DATABASE pacifica_uniqueid
COPY . .
RUN pip install .
EXPOSE 8051
ENTRYPOINT ["/bin/bash", "/usr/src/app/entrypoint.sh"]
40 changes: 21 additions & 19 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,31 @@ environment:
MSVC_VERSION: "Visual Studio 10 Win64"

install:
- ps: >
& "$env:PYTHON\python.exe" -m virtualenv C:\pacifica;
C:\pacifica\Scripts\activate.ps1;
python -m pip install --upgrade pip setuptools wheel;
Invoke-WebRequest -OutFile sqlite.zip https://www.sqlite.org/2018/sqlite-dll-win64-x64-3240000.zip;
Invoke-WebRequest -OutFile sqlite-devel.zip https://www.sqlite.org/2018/sqlite-amalgamation-3240000.zip;
Expand-Archive sqlite.zip -DestinationPath sqlite3;
Expand-Archive sqlite-devel.zip -DestinationPath sqlite3;
cd sqlite3;
& "C:\Users\appveyor\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\link.exe" /lib /def:sqlite3.def;
cd ..;
cp sqlite3\sqlite3.dll "$env:PYTHON\DLLs\sqlite3.dll";
cp sqlite3\sqlite3.lib "$env:PYTHON\libs\sqlite3.lib";
cp sqlite3\sqlite-amalgamation-3240000\sqlite3.h "$env:PYTHON\include\sqlite3.h";
cp "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdint.h" "C:\Users\appveyor\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\include\stdint.h";
pip install -r requirements-dev.txt;
echo "done";
- ps: >
& "$env:PYTHON\python.exe" -m virtualenv C:\pacifica;
C:\pacifica\Scripts\activate.ps1;
python -m pip install --upgrade pip setuptools wheel;
Invoke-WebRequest -OutFile sqlite.zip https://www.sqlite.org/2018/sqlite-dll-win64-x64-3240000.zip;
Invoke-WebRequest -OutFile sqlite-devel.zip https://www.sqlite.org/2018/sqlite-amalgamation-3240000.zip;
Expand-Archive sqlite.zip -DestinationPath sqlite3;
Expand-Archive sqlite-devel.zip -DestinationPath sqlite3;
cd sqlite3;
& "C:\Users\appveyor\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\link.exe" /lib /def:sqlite3.def;
cd ..;
cp sqlite3\sqlite3.dll "$env:PYTHON\DLLs\sqlite3.dll";
cp sqlite3\sqlite3.lib "$env:PYTHON\libs\sqlite3.lib";
cp sqlite3\sqlite-amalgamation-3240000\sqlite3.h "$env:PYTHON\include\sqlite3.h";
cp "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdint.h" "C:\Users\appveyor\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\include\stdint.h";
pip install -r requirements-dev.txt;
pip install .;
echo "done";
build: off

test_script:
- ps: >
C:\pacifica\Scripts\activate.ps1;
pre-commit run -a;
coverage run --include='pacifica/uniqueid/*' -m pytest -xsv tests;
coverage report --include='pacifica/uniqueid/*' --omit='pacifica/uniqueid/wsgi*' -m --fail-under=100;
cd tests;
coverage run --include='*/pacifica/uniqueid/*' -m pytest -xsv;
coverage report --include='*/pacifica/uniqueid/*' --omit='*/pacifica/uniqueid/wsgi*' -m --fail-under=100;
6 changes: 2 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#
from os import environ
from os.path import abspath, join
from recommonmark.parser import CommonMarkParser

environ['UNIQUEID_CPCONFIG'] = join(abspath('..'), 'server.conf')

Expand Down Expand Up @@ -46,6 +45,8 @@
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.viewcode',
'readthedocs_ext.readthedocs',
'recommonmark'
]

# Add any paths that contain templates here, relative to this directory.
Expand All @@ -54,9 +55,6 @@
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
source_parsers = {
'.md': CommonMarkParser,
}
source_suffix = ['.rst', '.md']

# The master toctree document.
Expand Down
4 changes: 3 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
-r requirements.txt
coverage
mock
pbs; sys_platform == 'win32'
Expand All @@ -7,5 +6,8 @@ pre-commit
pylint>2
pytest
radon
readthedocs-sphinx-ext
recommonmark
sh; sys_platform != 'win32'
sphinx
sphinx-rtd-theme
3 changes: 0 additions & 3 deletions requirements.txt

This file was deleted.

12 changes: 5 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,8 @@
# -*- coding: utf-8 -*-
"""Setup and install the UniqueID service."""
from os import path
try: # pip version 9
from pip.req import parse_requirements
except ImportError:
from pip._internal.req import parse_requirements
from setuptools import setup, find_packages

# parse_requirements() returns generator of pip.req.InstallRequirement objects
INSTALL_REQS = parse_requirements('requirements.txt', session='hack')

setup(
name='pacifica-uniqueid',
Expand All @@ -31,5 +25,9 @@
'pacifica-uniqueid-cmd=pacifica.uniqueid.__main__:cmd'
]
},
install_requires=[str(ir.req) for ir in INSTALL_REQS]
install_requires=[
'cherrypy',
'pacifica-namespace',
'peewee>2'
]
)
2 changes: 1 addition & 1 deletion tests/cmd_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def test_main(self):
cmd('dbsync')
hit_exception = False
try:
main('--stop-after-a-moment', '--cpconfig', 'server.conf')
main('--stop-after-a-moment', '--cpconfig', os.path.join(os.path.dirname(__file__), '..', 'server.conf'))
# pylint: disable=broad-except
except Exception:
hit_exception = True
Expand Down

0 comments on commit c5c05fe

Please sign in to comment.