Skip to content

Commit

Permalink
Use flit and pyproject.toml
Browse files Browse the repository at this point in the history
setup.py is remained for now.
  • Loading branch information
JaeyeongYang committed Jan 8, 2019
1 parent 38ce1b5 commit 78e951c
Show file tree
Hide file tree
Showing 10 changed files with 168 additions and 22 deletions.
10 changes: 10 additions & 0 deletions MANIFEST.in
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,10 @@
include LICENSE README.rst
include Makefile pyproject.toml
exclude .editorconfig .travis.yml Pipfile* setup.cfg

recursive-include docs *
recursive-include tests *.py
recursive-include examples *

prune docs/build

7 changes: 6 additions & 1 deletion Makefile
Original file line number Original file line Diff line number Diff line change
@@ -1,6 +1,11 @@
PIPENV_PATH = $(shell which pipenv)

init: init:
pip3 install pipenv ifeq (, $(PIPENV_PATH))
pip install pipenv
endif
pipenv install --dev pipenv install --dev
pipenv run python -m flit install


test: test:
pipenv run py.test tests pipenv run py.test tests
Expand Down
5 changes: 4 additions & 1 deletion Pipfile
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ autopep8 = "*"
flake8 = "*" flake8 = "*"
pylint = "*" pylint = "*"
mypy = "*" mypy = "*"

# For tests
pytest = "*" pytest = "*"
pytest-cov = "*" pytest-cov = "*"
codecov = "*" codecov = "*"

# For docs # For docs
sphinx = "*" sphinx = "*"
sphinx_rtd_theme = "*" sphinx_rtd_theme = "*"
Expand All @@ -21,7 +24,7 @@ travis-sphinx = "*"
pandas = "*" pandas = "*"
scipy = "*" scipy = "*"
numpy = "*" numpy = "*"
adopy = {editable = true,path = "."} flit = "*"


[requires] [requires]
python_version = "3.5" python_version = "3.5"
69 changes: 65 additions & 4 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 22 additions & 3 deletions README.rst
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Currently working in progress.
Dependencies Dependencies
------------ ------------


- Python 2.7 or 3.5+ - Python 3.5+
- NumPy - NumPy
- Pandas - Pandas
- SciPy - SciPy
Expand All @@ -47,5 +47,24 @@ Installation
# Set the working directory to the cloned repository. # Set the working directory to the cloned repository.
cd adopy cd adopy
# Install ADOpy with pip (Currently for development) # Install ADOpy with pip
pip install -e . pip install .
Development
-----------

You can set up a developmental environment using pipenv.

.. code-block:: bash
# Clone the repository from Github.
git clone https://github.com/JaeyeongYang/adopy.git
# Set the working directory to the cloned repository.
cd adopy
# Install dev dependencies with pipenv
pipenv install --dev
# Install adopy with flit with symlink
pipenv run flit install -e
2 changes: 1 addition & 1 deletion adopy/__init__.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
__all__ = ['base', 'functions', 'tasks', 'Task', 'Model', 'Engine'] __all__ = ['base', 'functions', 'tasks', 'Task', 'Model', 'Engine']


with open(os.path.join(os.path.dirname(__file__), 'VERSION'), 'r') as f: with open(os.path.join(os.path.dirname(__file__), 'VERSION'), 'r') as f:
__version__ = f.read() __version__ = f.read().strip()
8 changes: 8 additions & 0 deletions adopy/functions/_const.py
Original file line number Original file line Diff line number Diff line change
@@ -1,3 +1,11 @@
"""
Define functions for constraints on model parameters.
These constraints should be defined as named functions, since unnamed functions
like lambda cannot be serialized by pickle.
"""


def const_positive(x): def const_positive(x):
return x > 0 return x > 0


Expand Down
33 changes: 33 additions & 0 deletions pyproject.toml
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,33 @@
[build-system]
requires = ["flit"]
build-backend = "flit.buildapi"

[tool.flit.metadata]
module = "adopy"
dist-name = "ADOpy"
author = "Jaeyeong Yang"
author-email = "jaeyeong.yang1125@gmail.com"
home-page = "https://github.com/JaeyeongYang/adopy/"

requires = [
"numpy",
"pandas",
"scipy",
]
requires-python = ">=3.5"

description-file = "README.rst"
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3 :: Only",
]

[tool.flit.metadata.urls]
Documentation = "https://jaeyeong-yang.com/adopy/"

6 changes: 0 additions & 6 deletions requirements.txt

This file was deleted.

25 changes: 19 additions & 6 deletions setup.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -6,28 +6,41 @@


# Get the long description from the relevant file # Get the long description from the relevant file
with codecs_open('README.rst', encoding='utf-8') as f: with codecs_open('README.rst', encoding='utf-8') as f:
long_description = f.read() LONG_DESCRIPTION = f.read()


# Load the version # Load the version
with open(os.path.join('adopy', 'VERSION'), 'r') as f: with open(os.path.join('adopy', 'VERSION'), 'r') as f:
version = f.read() VERSION = f.read().strip()


setup( setup(
name='adopy', name='adopy',
version=version, url='https://github.com/JaeyeongYang/adopy',
version=VERSION,
description='', description='',
long_description=long_description, long_description=LONG_DESCRIPTION,
classifiers=[],
keywords='', keywords='',

author='Jaeyeong Yang', author='Jaeyeong Yang',
author_email='jaeyeong.yang1125@gmail.com', author_email='jaeyeong.yang1125@gmail.com',
url='https://github.com/JaeyeongYang/adopy',
license='GPL-3', license='GPL-3',
include_package_data=True, include_package_data=True,
zip_safe=False, zip_safe=False,

python_requires='>=3.5',
install_requires=[ install_requires=[
'numpy', 'numpy',
'pandas', 'pandas',
'scipy', 'scipy',
], ],
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)', # noqa: E501
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3 :: Only',
],
) )

0 comments on commit 78e951c

Please sign in to comment.