Skip to content

Commit

Permalink
Package software.
Browse files Browse the repository at this point in the history
* Add setup.py
* Integrate with pytest-runner
* Remove requirements_dev.txt
* Rework console scripts to produce binaries with distro
* Adapt travis.yml
  • Loading branch information
Stefano Cossu committed Apr 3, 2018
1 parent 83c2f8f commit f0248de
Show file tree
Hide file tree
Showing 11 changed files with 177 additions and 53 deletions.
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ python:
- "3.5"
- "3.6"
install:
- pip install -r requirements.txt
- coilmq&
- pip -e .
script:
- pytest tests
- python setup.py test
32 changes: 0 additions & 32 deletions etc.defaults/gunicorn.py

This file was deleted.

24 changes: 24 additions & 0 deletions etc.defaults/gunicorn.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Set up main GUnicorn options.
# See: http://docs.gunicorn.org/en/stable/settings.html

# Commented values are the application defaults.

# Directory where the WSGI server data are stored.
data_dir: 'data'

# Set app_mode to either 'prod', 'test' or 'dev'.
# 'prod' is normal running mode. 'test' is used for running test suites.
# 'dev' is similar to normal mode but with reload and debug enabled.
app_mode: 'dev'

#listen_addr: '0.0.0.0'
#listen_port: 8000
#workers: 4
#worker_class: 'gevent'
#max_requests: 512

#user: ''
#group: ''

#preload_app: True

5 changes: 0 additions & 5 deletions fcrepo

This file was deleted.

1 change: 0 additions & 1 deletion lsup-admin → lsup_admin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python
import click
import click_log
import json
Expand Down
6 changes: 3 additions & 3 deletions profiler.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python

import logging
from logging.config import dictConfig
from werkzeug.contrib.profiler import ProfilerMiddleware
Expand All @@ -18,9 +16,11 @@

from lakesuperior.app import create_app

if __name__ == '__main__':
def run():
fcrepo = create_app(config['application'])
fcrepo.wsgi_app = ProfilerMiddleware(fcrepo.wsgi_app, **options)
fcrepo.config['PROFILE'] = True
fcrepo.run(debug = True)

if __name__ == '__main__':
run()
12 changes: 11 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
CoilMQ==1.0.1
Flask==0.12.2
HiYaPyCo==0.4.11
Pillow==4.3.0
PyYAML==3.12
arrow==0.10.0
click==6.7
click-log==0.2.1
click==6.7
gevent==1.2.2
gunicorn==19.7.1
lmdb==0.93
numpy==1.14.1
pytest-flask==0.10.0
pytest==3.2.2
rdflib==4.2.2
requests-toolbelt==0.8.0
requests==2.18.4
sphinx-rtd-theme==0.2.4
stomp.py==4.1.20
wheel==0.30.0a0

# Uncomment this and remove all above when the project will be in PyPI.
#--index-url https://pypi.python.org/lakesuperior/
#-e .
6 changes: 0 additions & 6 deletions requirements_dev.txt

This file was deleted.

2 changes: 0 additions & 2 deletions server.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python

import logging
from logging.config import dictConfig

Expand Down
6 changes: 6 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[aliases]
test = pytest

[tool:pytest]
addopts = --verbose
#python_files = tests
131 changes: 131 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
"""
LAKEsuperior setup script.
Proudly ripped from https://github.com/pypa/sampleproject/blob/master/setup.py
"""

import sys

# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path

here = path.abspath(path.dirname(__file__))

# ``pytest_runner`` is referenced in ``setup_requires``.
# See https://github.com/pytest-dev/pytest-runner#conditional-requirement
needs_pytest = {'pytest', 'test', 'ptr'}.intersection(sys.argv)
pytest_runner = ['pytest-runner'] if needs_pytest else []


# Get the long description from the README file
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()

setup(
name='lakesuperior',
version='1.0.0a9pre1',

description='A Linked Data Platform repository sever.',
long_description=long_description,
long_description_content_type='text/x-rst; charset=UTF-8',

url='https://lakesuperior.readthedocs.io',

author='Stefano Cossu <@scossu>',
#author_email='', # Optional
license='Apache License Version 2.0',

# https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
'Development Status :: 3 - Alpha',

'Environment :: Console',
'Environment :: Web Environment',

'Framework :: Flask',

'Intended Audience :: Developers',
'Intended Audience :: Information Technology',
'Intended Audience :: Science/Research',

'License :: OSI Approved :: Apache Software License',

'Natural Language :: English',

'Operating System :: MacOS',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX :: Linux',

'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',

'Topic :: Database :: Database Engines/Servers',
],

keywords='repository linked-data',

python_requires='~=3.5',

packages=find_packages(exclude=['contrib', 'docs', 'tests']),

# Great reference read about dependency management:
# https://caremad.io/posts/2013/07/setup-vs-requirement/
install_requires=[
'CoilMQ',
'Flask',
'HiYaPyCo',
'PyYAML',
'arrow',
'click',
'click-log',
'gevent',
'gunicorn',
'lmdb',
'rdflib',
'requests',
'requests-toolbelt',
'sphinx-rtd-theme',
'stomp.py',
],

setup_requires=[] + pytest_runner,
tests_require=[
'Pillow',
'numpy',
'pytest',
'pytest-flask',
],

#extras_require={},
#package_data={},
#data_files=[],

entry_points={
'console_scripts': [
'lsup-admin=lsup_admin:admin',
'profiler=profiler:run',
'fcrepo=wsgi:run',
],
},

# List additional URLs that are relevant to your project as a dict.
#
# This field corresponds to the "Project-URL" metadata fields:
# https://packaging.python.org/specifications/core-metadata/#project-url-multiple-use
#
# Examples listed include a pattern for specifying where the package tracks
# issues, where the source is hosted, where to say thanks to the package
# maintainers, and where to support the project financially. The key is
# what's used to render the link text on PyPI.
project_urls={ # Optional
'Source Code': 'https://github.com/scossu/lakesuperior/',
'Documentation': 'https://lakesuperior.readthedocs.io',
'Discussion': 'https://groups.google.com/forum/#!forum/lakesuperior',
'Bug Reports': 'https://github.com/scossu/lakesuperior/issues',
}
)

0 comments on commit f0248de

Please sign in to comment.