Skip to content

Commit

Permalink
sync with current biocommons conventions: use setup.cfg, use src/, Ma…
Browse files Browse the repository at this point in the history
…kefile updates, drop req files
  • Loading branch information
reece committed Dec 17, 2019
1 parent d4508f8 commit a232d9b
Show file tree
Hide file tree
Showing 37 changed files with 107 additions and 130 deletions.
51 changes: 19 additions & 32 deletions Makefile
Expand Up @@ -10,8 +10,9 @@ SELF:=$(firstword $(MAKEFILE_LIST))

PKG=eutils
PKGD=$(subst .,/,${PKG})
PYV:=3.7
VEDIR=venv/${PYV}

VEDIR=venv/3.6


############################################################################
Expand All @@ -27,48 +28,35 @@ help:
#= SETUP, INSTALLATION, PACKAGING

#=> venv: make a Python 3 virtual environment
.PHONY: venv/2.7
venv/2.7:
virtualenv -p $$(type -p python2.7) $@; \
source $@/bin/activate; \
pip install --upgrade pip setuptools

#=> venv: make a Python 3 virtual environment
.PHONY: ${VEDIR}
${VEDIR}:
pyvenv $@; \
.PHONY: venv/%
venv/%:
python$* -m venv $@; \
source $@/bin/activate; \
python -m ensurepip --upgrade; \
pip install --upgrade pip setuptools

#=> setup: setup/upgrade packages *in current environment*
.PHONY: setup
setup: etc/develop.reqs etc/test.reqs etc/install.reqs
if [ -s $(word 1,$^) ]; then pip install --upgrade -r $(word 1,$^); fi
if [ -s $(word 2,$^) ]; then pip install --upgrade -r $(word 2,$^); fi
if [ -s $(word 3,$^) ]; then pip install --upgrade -r $(word 3,$^); fi
#=> develop: install package in develop mode
.PHONY: develop
develop:
pip install -e .[dev,extras,notebooks]

#=> devready: create venv, install prerequisites, install pkg in develop mode
.PHONY: devready
devready:
make ${VEDIR} && source ${VEDIR}/bin/activate && make setup develop
make ${VEDIR} && source ${VEDIR}/bin/activate && make develop
@echo '#################################################################################'
@echo '### Do not forget to `source ${VEDIR}/bin/activate` to use this environment ###'
@echo '#################################################################################'

#=> develop: install package in develop mode
#=> install: install package
#=> bdist bdist_egg bdist_wheel build sdist: distribution options
.PHONY: bdist bdist_egg bdist_wheel build build_sphinx sdist install develop
bdist bdist_egg bdist_wheel build sdist install develop: %:
.PHONY: bdist bdist_egg bdist_wheel build build_sphinx sdist install
bdist bdist_egg bdist_wheel build sdist install: %:
python setup.py $@

#=> upload: upload to pypi
#=> upload_*: upload to named pypi service (requires config in ~/.pypirc)
.PHONY: upload upload_%
upload: upload_pypi
upload_%:
python setup.py bdist_egg bdist_wheel sdist upload -r $*
.PHONY: install-extras
install-extras:
pip install -e .[extras]


############################################################################
Expand All @@ -78,7 +66,7 @@ upload_%:
#=> test: execute tests
.PHONY: test
test:
pytest --cov=${PKG}
python setup.py pytest

#=> tox: execute tests via tox
.PHONY: tox
Expand All @@ -93,10 +81,9 @@ tox:
#=> reformat: reformat code with yapf and commit
.PHONY: reformat
reformat:
@if hg sum | grep -qL '^commit:.*modified'; then echo "Repository not clean" 1>&2; exit 1; fi
@if hg sum | grep -qL ' applied'; then echo "Repository has applied patches" 1>&2; exit 1; fi
@if ! git diff --cached --exit-code; then echo "Repository not clean" 1>&2; exit 1; fi
yapf -i -r "${PKGD}" tests
hg commit -m "reformatted with yapf"
git commit -a -m "reformatted with yapf"

#=> docs -- make sphinx docs
.PHONY: docs
Expand All @@ -115,7 +102,7 @@ clean:
#=> cleaner: remove files and directories that are easily rebuilt
.PHONY: cleaner
cleaner: clean
rm -fr .cache *.egg-info build dist doc/_build htmlcov
rm -fr .cache *.egg-info .pytest_cache build dist doc/_build htmlcov
find . \( -name \*.pyc -o -name \*.orig -o -name \*.rej \) -print0 | xargs -0r rm
find . -name __pycache__ -print0 | xargs -0r rm -fr

Expand Down
1 change: 0 additions & 1 deletion README.rst
@@ -1,4 +1,3 @@
====================================================
eutils -- a simplified interface to NCBI E-Utilities
====================================================

Expand Down
12 changes: 0 additions & 12 deletions etc/develop.reqs

This file was deleted.

Empty file removed etc/install.reqs
Empty file.
5 changes: 0 additions & 5 deletions etc/test.reqs

This file was deleted.

86 changes: 86 additions & 0 deletions setup.cfg
@@ -1,3 +1,81 @@
[metadata]
name = eutils
author = Source Code Contributors
author-email = biocommons-dev@googlegroups.com
home-page = https://github.com/biocommons/eutils
long-description = file:README.rst
long-description-content-type = text/x-rst; charset=UTF-8
description = "Python interface to NCBI's eutilities API"
license-file = LICENSE
platform = any

classifiers =
Development Status :: 3 - Alpha
Intended Audience :: Developers
Intended Audience :: Healthcare Industry
Intended Audience :: Science/Research
License :: OSI Approved :: Apache Software License
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Topic :: Scientific/Engineering :: Bio-Informatics
Topic :: Scientific/Engineering :: Medical Science Apps.
keywords =
bioinformatics
eutilities
ncbi


[options]
packages = find:
python_requires = >= 3.6
zip_safe = true
package_dir =
= src
install_requires =
lxml
pytz
requests
six
setup_requires =
pytest-runner
setuptools_scm
wheel
tests_require =
mock
pytest
pytest-cov
pyyaml
tox
vcrpy

# TODO: Needed?
[options.packages.find]
where = src
exclude =
__pycache__
*.pyc


[options.extras_require]
dev =
flake8
ipython
mock
pytest
pytest-cov
restview
setuptools
sphinx
sphinx_rtd_theme
tox
vcrpy
yapf


[aliases]
test = pytest

Expand All @@ -13,3 +91,11 @@ max-line-length = 120
exclude = tests/*
max-complexity = 10
ignore = E129,E221,E241,E251,E303,W291

[tool:pytest]
# TODO: add src to testpaths to trigger doctests. However, this
# requires injecting fixtures, which requires conftest.py in src/,
# which requires packaging changes. Deferred.
testpaths = src tests
doctest_optionflags = ALLOW_UNICODE ALLOW_BYTES ELLIPSIS IGNORE_EXCEPTION_DETAIL NORMALIZE_WHITESPACE
addopts = --doctest-modules --cov-config=setup.cfg --cov-report=term-missing --cov=ga4gh
82 changes: 2 additions & 80 deletions setup.py
@@ -1,81 +1,3 @@
# -*- coding: utf-8 -*-
from setuptools import setup

from setuptools import setup, find_packages

package_name = "eutils"

with open("doc/short-description.txt") as short_desc:
short_description = short_desc.read()

with open("README.rst") as long_desc:
long_description = long_desc.read()


setup(
author = package_name + " Committers",
description = short_description.replace("\n", " "),
license = "Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)",
long_description = long_description,
name = package_name,
packages = find_packages(),
use_scm_version = True,
zip_safe = True,

author_email = "biocommons-dev@googlegroups.com",
url = "https://github.com/biocommons/" + package_name,

classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Intended Audience :: Healthcare Industry",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Topic :: Database :: Front-Ends",
"Topic :: Scientific/Engineering :: Bio-Informatics",
"Topic :: Scientific/Engineering :: Medical Science Apps.",
],

keywords = [
'bioinformatics',
],

install_requires = [
'lxml',
'pytz',
'requests',
'six',
],

setup_requires = [
"pytest-runner",
"setuptools_scm",
"wheel",
],

tests_require = [
"mock",
"pytest",
"pytest-cov",
"tox",
"vcrpy",
],
)

# <LICENSE>
# Copyright 2016 Source Code Committers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# </LICENSE>
setup(use_scm_version=True)
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.

0 comments on commit a232d9b

Please sign in to comment.