Skip to content
This repository has been archived by the owner on Aug 11, 2023. It is now read-only.

Commit

Permalink
Merge pull request #438 from astrofrog/infrastructure-refactor
Browse files Browse the repository at this point in the history
Refactor package template to follow APE 17
  • Loading branch information
pllim authored Jan 31, 2020
2 parents 34c5256 + 46622bb commit 999de51
Show file tree
Hide file tree
Showing 35 changed files with 1,054 additions and 422 deletions.
11 changes: 9 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
requirements_file: requirements.txt
version: 2

build:
image: latest

python:
version: 3.5
version: 3.7
install:
- requirements: requirements.txt

formats: []
12 changes: 0 additions & 12 deletions .travis-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,6 @@ if [[ "${TRAVIS_PULL_REQUEST}" = "false" && "$TRAVIS_OS_NAME" = "linux" && $TASK
git checkout master
rsync -avz --delete --exclude .git/ ../packagename/ ./
git add -A

# Add astropy_helpers manually at the version in the cookiecutter template
git submodule add https://github.com/astropy/astropy-helpers astropy_helpers || true
git submodule update --init
cd astropy_helpers
# parse the json with jq to get the helpers version
helpers_version=$(jq -r ".cookiecutter.astropy_helpers_version" $HOME/.cookiecutter_replay/package-template.json)
git checkout $helpers_version
cp ah_bootstrap.py ../
cd ..
git add astropy_helpers ah_bootstrap.py

git commit --allow-empty -m "Update rendered version to ""$TRAVIS_COMMIT"
git push origin master
fi
30 changes: 11 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
# We set the language to c because python isn't supported on the MacOS X nodes
# on Travis. However, the language ends up being irrelevant anyway, since we
# install Python ourselves using conda.
language: c
language: python

os:
- linux

python: 3.8

env:
global:

# The following versions are the 'default' for tests, unless
# overridden underneath. They are defined here in order to save having
# to repeat them for all configurations.
- FOLDERNAME='packagename'
- PYTHON_VERSION=3.7
- CONDA_DEPENDENCIES='cython astropy sphinx'
- PIP_DEPENDENCIES='cookiecutter gitpython pytest-astropy sphinx-astropy'
- EVENT_TYPE='pull_request push'
- TASK='test'
- EXTRA_CONTEXT=''
- FLAGS=''
Expand All @@ -27,26 +22,23 @@ env:
# being overridden here must exist in the cookiecutter.json
# See https://cookiecutter.readthedocs.io/en/0.9.1/advanced_usage.html#injecting-extra-context
- EXTRA_CONTEXT=''
- EXTRA_CONTEXT='include_example_cython_code=y'
- EXTRA_CONTEXT='use_compiled_extensions=y include_example_code=y'
- EXTRA_CONTEXT="package_name=AstropyProject" FOLDERNAME='AstropyProject'
- EXTRA_CONTEXT='_parent_project=sunpy'
- EXTRA_CONTEXT='minimum_python_version=3.5'
- TASK='render' FLAGS='--config-file rendered.yml --no-input' EXTRA_CONTEXT='include_example_cython_code=y initialize_git_repo=n license=Other'
- EXTRA_CONTEXT='minimum_python_version=3.6'
- TASK='render' FLAGS='--config-file rendered.yml --no-input' EXTRA_CONTEXT='use_compiled_extensions=y include_example_code=y license=Other'

install:

- git clone --depth 1 git://github.com/astropy/ci-helpers.git
- source ci-helpers/travis/setup_conda.sh
- pip install sphinx-astropy cookiecutter gitpython tox

script:
- cd docs ; make html ; cd ..
- cookiecutter --no-input ./ -o ../test $EXTRA_CONTEXT $FLAGS
- cd ../test/$FOLDERNAME
- if [[ $TASK == 'test' ]]; then python setup.py egg_info; fi
- if [[ $TASK == 'test' ]]; then python setup.py build; fi
- if [[ $TASK == 'test' ]]; then python setup.py build_docs; fi
- if [[ $TASK == 'test' ]]; then python setup.py test; fi
- if [[ $TASK == 'error_check' ]]; then python setup.py egg_info 2>&1 | grep "ERROR:"; fi
- git init
- if [[ $TASK == 'test' ]]; then tox -e py38-test; fi
- if [[ $TASK == 'test' ]]; then tox -e build_docs; fi
- if [[ $TASK == 'test' ]]; then tox -e codestyle; fi


after_success:
Expand Down
29 changes: 15 additions & 14 deletions QUESTIONS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,21 @@ To use the package template run ``cookiecutter gh:astropy/package-template``,
once you have run this command you will be asked a series of questions. Below is
a description of each of the prompts.

1. ``package_name``: This is a human readable name for your package, like 'Astropy' or 'SunPy'.
2. ``module_name``: This is the name of your python package i.e. 'astropy' or 'sunpy'.
1. ``package_name``: This is a human readable name for your package, like ``Astropy`` or ``SunPy``.
2. ``module_name``: This is the name of your python package i.e. ``astropy`` or ``sunpy``.
3. ``short_description``: This is a one sentence description of your package.
4. ``long_description``: This is a multi-line description of your package.
5. ``author_name``: The name or names of the authors.
6. ``author_email``: A contact email for the authors.
7. ``license``: The license of your project.
8. ``project_url``: Project website.
9. ``include_example_code``: This includes a set of example python and cython files showing you how to use the package template. If you choose 'n' then none of this will be included and you will have to populate the directory structure before you can import the package.
4. ``author_name``: The name or names of the authors.
5. ``author_email``: A contact email for the authors.
6. ``license``: The license of your package.
7. ``project_url``: Project website.
8. ``include_example_code``: This includes a set of example python files showing you how to use the package template. If you choose ``n`` then none of this will be included and you will have to populate the directory structure before you can import the package.
9. ``use_compiled_extensions``: Whether you plan to use compiled extensions in your package
10. ``include_cextern_folder``: The cextern folder should be used if you are including non-python C code.
11. ``edit_on_github_extension``: Set to "True" to enable the edit on GitHub sphinx extension.
11. ``edit_on_github_extension``: Set to ``True`` to enable the edit on GitHub sphinx extension.
12. ``github_project``: This is the GitHub identifier for the edit on GitHub extension and the changelog link extension.
13. ``project_version``: The current version number of your project.
14. ``use_travis_ci``: If 'y' the template will include an example ``.travis.yml`` file for the Travis CI service.
15. ``use_read_the_docs``: If 'y' the ``read_the_docs.yml`` and ``.rtd-environment.yml`` files will be included for using conda on Read the Docs.
16. ``sphinx_theme``: The value of the ``html_theme`` variable in the sphinx configuration file.
17. ``minimum_python_version``: Version string of minimum supported Python version
13. ``use_travis_ci``: If ``'y'`` the template will include an example ``.travis.yml`` file for the Travis CI service.
14. ``use_read_the_docs``: If ``'y'`` the ``read_the_docs.yml`` and ``.rtd-environment.yml`` files will be included for using conda on Read the Docs.
15. ``sphinx_theme``: The value of the ``html_theme`` variable in the sphinx configuration file.
16. ``required_dependencies``: Comma-separated list of required dependencies
17. ``optional_dependencies``: Comma-separated list of optional dependencies
18. ``minimum_python_version``: Version string of minimum supported Python version
3 changes: 3 additions & 0 deletions TEMPLATE_CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ be copied over manually if desired.

- Removed Appveyor CI option. Use ``os: windows`` in Travis CI. [#420]

- Refactored the template to follow the recommendations in APE 17:
https://github.com/astropy/astropy-APEs/blob/master/APE17.rst [#438]

2.1 (unreleased)
----------------

Expand Down
16 changes: 5 additions & 11 deletions cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,20 @@
"package_name": "packagename",
"module_name": "{{ cookiecutter.package_name|lower()|replace(' ', '_') }}",
"short_description": "{{ cookiecutter.package_name|replace('-', ' ')|replace('_', ' ') }}",
"long_description": "",
"author_name": "Astropy Developers",
"author_email": "",
"license": ["BSD 3-Clause", "GNU GPL v3+", "Apache Software Licence 2.0", "BSD 2-Clause", "Other"],
"project_url": "http://docs.astropy.org/projects/package-template/",
"project_version": "0.0.dev",
"include_example_code": "y",
"include_example_cython_code": "n",
"include_cextern_folder": "n",
"use_compiled_extensions": "y",
"include_example_code": "y",
"edit_on_github_extension": "False",
"github_project": "astropy/astropy",
"use_travis_ci": "y",
"use_read_the_docs": "y",
"sphinx_theme": "astropy-bootstrap",
"initialize_git_repo": "y",
"_parent_project": "astropy",
"_install_requires": "astropy",
"_copy_without_render": [
"docs/_templates"
],
"minimum_python_version": ["3.7", "3.6", "3.5"],
"astropy_helpers_version": "v3.2.1"
"required_dependencies": "astropy",
"optional_dependencies": "",
"minimum_python_version": ["3.6", "3.7", "3.8"]
}
Loading

0 comments on commit 999de51

Please sign in to comment.