Skip to content

Commit

Permalink
Moving changes from the cookiecutter branch
Browse files Browse the repository at this point in the history
  • Loading branch information
bsipocz committed Oct 3, 2017
1 parent fbdaec3 commit efbc631
Show file tree
Hide file tree
Showing 16 changed files with 83 additions and 47 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ docs/_build
# Pycharm editor project files
.idea

# Floobits project files
.floo
.flooignore

# Packages/installer info
*.egg
*.egg-info
Expand All @@ -48,6 +52,9 @@ distribute-*.tar.gz
.tox
.*.sw[op]
*~
.project
.pydevproject
.settings

# Mac OSX
.DS_Store
2 changes: 1 addition & 1 deletion .rtd-environment.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: package-template
name: packagename

channels:
- astropy
Expand Down
21 changes: 10 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,15 @@ env:
- PIP_DEPENDENCIES=''
- EVENT_TYPE='pull_request push'


# For this package-template, we include examples of Cython modules,
# so Cython is required for testing. If your package does not include
# Cython code, you can set CONDA_DEPENDENCIES=''
- CONDA_DEPENDENCIES='Cython'

# List other runtime dependencies for the package that are available as
# pip packages here.
# - PIP_DEPENDENCIES=''

# Conda packages for affiliated packages are hosted in channel
# "astropy" while builds for astropy LTS with recent numpy versions
Expand All @@ -54,7 +59,6 @@ env:
matrix:
# Make sure that egg_info works without dependencies
- PYTHON_VERSION=2.7 SETUP_CMD='egg_info'
- PYTHON_VERSION=3.3 SETUP_CMD='egg_info'
- PYTHON_VERSION=3.4 SETUP_CMD='egg_info'
- PYTHON_VERSION=3.5 SETUP_CMD='egg_info'
- PYTHON_VERSION=3.6 SETUP_CMD='egg_info'
Expand Down Expand Up @@ -96,15 +100,11 @@ matrix:
# time.

- os: linux
env: PYTHON_VERSION=2.7 NUMPY_VERSION=1.7
env: PYTHON_VERSION=2.7 NUMPY_VERSION=1.9
- os: linux
env: PYTHON_VERSION=3.3 NUMPY_VERSION=1.8
env: PYTHON_VERSION=3.4 NUMPY_VERSION=1.10
- os: linux
env: PYTHON_VERSION=3.4 NUMPY_VERSION=1.9
- os: linux
env: PYTHON_VERSION=3.5 NUMPY_VERSION=1.10
- os: linux
env: NUMPY_VERSION=1.11
env: PYTHON_VERSION=3.5 NUMPY_VERSION=1.11

# Try numpy pre-release
- os: linux
Expand Down Expand Up @@ -135,7 +135,7 @@ install:
# commands in the install: section below.

- git clone git://github.com/astropy/ci-helpers.git
- source ci-helpers/travis/setup_conda_$TRAVIS_OS_NAME.sh
- source ci-helpers/travis/setup_conda.sh

# As described above, using ci-helpers, you should be able to set up an
# environment with dependencies installed using conda and pip, but in some
Expand All @@ -150,7 +150,6 @@ script:
- $MAIN_CMD $SETUP_CMD

after_success:
# If coveralls.io is set up for this package, uncomment the line
# below and replace "packagename" with the name of your package.
# If coveralls.io is set up for this package, uncomment the line below.
# The coveragerc file may be customized as needed for your package.
# - if [[ $SETUP_CMD == *coverage* ]]; then coveralls --rcfile='packagename/tests/coveragerc'; fi
3 changes: 2 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ include CHANGES.rst
include ez_setup.py
include ah_bootstrap.py
include setup.cfg
include packagename/tests/coveragerc

recursive-include packagename *.pyx *.c *.pxd
recursive-include docs *
Expand All @@ -28,7 +29,7 @@ recursive-include astropy_helpers/licenses *
include astropy_helpers/ez_setup.py
include astropy_helpers/ah_bootstrap.py

recursive-include astropy_helpers/astropy_helpers *.py *.pyx *.c *.h
recursive-include astropy_helpers/astropy_helpers *.py *.pyx *.c *.h *.rst
recursive-include astropy_helpers/astropy_helpers.egg-info *
# include the sphinx stuff with "*" because there are css/html/rst/etc.
recursive-include astropy_helpers/astropy_helpers/sphinx *
Expand Down
5 changes: 5 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@ Status reports for developers
.. image:: https://travis-ci.org/astropy/package-template.svg
:target: https://travis-ci.org/astropy/package-template
:alt: Travis Status

License
-------

This project is Copyright (c) Astropy Developers and licensed under the terms of the BSD 3-Clause license. See the licenses folder for more information.
16 changes: 9 additions & 7 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,6 @@
# global configuration are listed below, commented out.


# Please update these texts to match the name of your package.
html_theme_options = {
'logotext1': 'package', # white, semi-bold
'logotext2': '-template', # orange, light
'logotext3': ':docs' # white, light
}

# Add any paths that contain custom themes here, relative to this directory.
# To use a different custom theme, add the directory containing the theme.
#html_theme_path = []
Expand All @@ -119,6 +112,15 @@
# name of a builtin theme or the name of a custom theme in html_theme_path.
#html_theme = None

# Please update these texts to match the name of your package.
html_theme_options = {
'logotext1': 'package', # white, semi-bold
'logotext2': '-template', # orange, light
'logotext3': ':docs' # white, light
}



# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}

Expand Down
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Documentation
=============

This is an affiliated package for the AstroPy package. The documentation for
this package is here:
This is the documentation for packagename.


.. toctree::
:maxdepth: 2
Expand Down
8 changes: 4 additions & 4 deletions docs/packagename/index.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
****************
Template package
****************
*************************
packagename Documentation
*************************

This is the documentation for the affiliated package.
This is the documentation for packagename.

Reference/API
=============
Expand Down
2 changes: 1 addition & 1 deletion licenses/LICENSE.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) year, author
Copyright (c) year, Astropy Developers
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
Expand Down
4 changes: 3 additions & 1 deletion packagename/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
from ._astropy_init import *
# ----------------------------------------------------------------------------

# For egg_info test builds to pass, put package imports here.
if not _ASTROPY_SETUP_:
# For egg_info test builds to pass, put package imports here.

from .example_mod import *

10 changes: 9 additions & 1 deletion packagename/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@
from astropy.tests.pytest_plugins import *

## Uncomment the following line to treat all DeprecationWarnings as
## exceptions
## exceptions. For Astropy v2.0 or later, there are 2 additional keywords,
## as follow (although default should work for most cases).
## To ignore some packages that produce deprecation warnings on import
## (in addition to 'compiler', 'scipy', 'pygments', 'ipykernel', and
## 'setuptools'), add:
## modules_to_ignore_on_import=['module_1', 'module_2']
## To ignore some specific deprecation warning messages for Python version
## MAJOR.MINOR or later, add:
## warnings_to_ignore_by_pyver={(MAJOR, MINOR): ['Message to ignore']}
# enable_deprecations_as_exceptions()

## Uncomment and customize the following lines to add/remove entries from
Expand Down
2 changes: 2 additions & 0 deletions packagename/example_mod.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ def primes(imax):

def do_primes(n, usecython=False):
if usecython:

from .example_c import primes as cprimes
print('Using cython-based primes')
return cprimes(n)

else:
print('Using pure python primes')
return primes(n)
Expand Down
4 changes: 4 additions & 0 deletions packagename/tests/test_example.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@

def test_primes_c():
from ..example_c import primes as primes_c
assert primes_c(10) == [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]



def test_primes():
from ..example_mod import primes
assert primes(10) == [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]


def test_deprecation():
import warnings
warnings.warn(
Expand Down
2 changes: 1 addition & 1 deletion packagename/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst

# This sub-module is destined for common non-package specific utility
# functions that will ultimately be merged into `astropy.utils`
# functions.
25 changes: 15 additions & 10 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@ all_files = 1
upload-dir = docs/_build/html
show-response = 1

[pytest]
minversion = 2.2
[tool:pytest]
minversion = 3.0
norecursedirs = build docs/_build
doctest_plus = enabled
addopts = -p no:warnings

[ah_bootstrap]
auto_use = True

[pep8]
[pycodestyle]
# E101 - mix of tabs and spaces
# W191 - use of tabs
# W291 - trailing whitespace
Expand All @@ -37,17 +38,21 @@ exclude = extern,sphinx,*parsetab.py

[metadata]
package_name = packagename
description = Astropy affiliated package
long_description = This is a package for doing X that relies on astropy
author = Author Names
author_email = someone@nowhere.com
license = BSD
url = http://astropy.org/
description = packagename
long_description =
author = Astropy Developers
author_email =
license = BSD 3-Clause
url = http://astropy.org
edit_on_github = False
github_project = astropy/astropy
# install_requires should be formatted as a comma-separated list, e.g.:
# install_requires = astropy, scipy, matplotlib
install_requires = astropy
# version should be PEP440 compatible (http://www.python.org/dev/peps/pep-0440)
# version should be PEP386 compatible (http://www.python.org/dev/peps/pep-0386)
version = 0.0.dev

[entry_points]

astropy-package-template-example = packagename.example_mod:main

15 changes: 8 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
metadata = dict(conf.items('metadata'))

PACKAGENAME = metadata.get('package_name', 'packagename')
DESCRIPTION = metadata.get('description', 'Astropy affiliated package')
AUTHOR = metadata.get('author', '')
DESCRIPTION = metadata.get('description', 'packagename')
AUTHOR = metadata.get('author', 'Astropy Developers')
AUTHOR_EMAIL = metadata.get('author_email', '')
LICENSE = metadata.get('license', 'unknown')
URL = metadata.get('url', 'http://astropy.org')
Expand Down Expand Up @@ -100,10 +100,11 @@
# Define entry points for command-line scripts
entry_points = {'console_scripts': []}

entry_point_list = conf.items('entry_points')
for entry_point in entry_point_list:
entry_points['console_scripts'].append('{0} = {1}'.format(entry_point[0],
entry_point[1]))
if conf.has_section('entry_points'):
entry_point_list = conf.items('entry_points')
for entry_point in entry_point_list:
entry_points['console_scripts'].append('{0} = {1}'.format(
entry_point[0], entry_point[1]))

# Include all .c files, recursively, including those generated by
# Cython, since we can not do this in MANIFEST.in with a "dynamic"
Expand All @@ -125,7 +126,7 @@
version=VERSION,
description=DESCRIPTION,
scripts=scripts,
install_requires=metadata.get('install_requires', 'astropy').strip().split(),
install_requires=[s.strip() for s in metadata.get('install_requires', 'astropy').split(',')],
author=AUTHOR,
author_email=AUTHOR_EMAIL,
license=LICENSE,
Expand Down

0 comments on commit efbc631

Please sign in to comment.