From 91a7bf1704c1471a4aefab042fd7d7f78bc2dae0 Mon Sep 17 00:00:00 2001 From: sodre Date: Sun, 29 Dec 2019 06:34:58 +0000 Subject: [PATCH] Render ght/master into master This commit was obtained as follows: 1. Checkout the last merged rendering of ght/master git checkout master 2. Replace its contents with ght/master git rm -rf . git checkout origin/ght/master -- . 3. Load the configured ght.yaml from PR #1 file git checkout 44cc9dfd14cd3e6f3abe564d6acc2aaddafc0a9e -- .github/ght.yaml 4. Execute the rendering steps .github/bin/ght-render.sh render_tree_structure .github/bin/ght-render.sh render_tree_ght_content .github/bin/ght-render.sh render_tree_content .github/bin/ght-render.sh finish 5. Commit git commit Close #1 --- .codacy.yml | 2 +- .coveragerc | 6 +- .github/ght.yaml | 47 ++++---- .github/workflows/ght-init.yml | 108 ------------------ .github/workflows/ght-render-repo.yml | 90 --------------- CONTRIBUTING.rst | 20 ++-- LICENSE | 95 +-------------- Makefile | 6 +- README.rst | 55 ++++----- conda.recipe/meta.yaml | 32 +----- docs/Makefile | 2 +- docs/conf.py | 32 +++--- docs/index.rst | 2 +- docs/installation.rst | 16 +-- docs/make.bat | 72 ++++++------ docs/usage.rst | 4 +- environment.yml | 4 +- setup.py | 50 ++------ tests/__init__.py | 2 +- ...iecutter.project_slug}}.py => test_cli.py} | 18 +-- .../__init__.py | 0 zeroae/cli/__init__.py | 2 + zeroae/cli/__main__.py | 3 + zeroae/cli/cli.py | 17 +++ .../{{cookiecutter.project_slug}}/__init__.py | 2 - .../{{cookiecutter.project_slug}}/__main__.py | 3 - .../{{cookiecutter.project_slug}}/cli.py | 33 ------ 27 files changed, 177 insertions(+), 546 deletions(-) delete mode 100644 .github/workflows/ght-init.yml delete mode 100644 .github/workflows/ght-render-repo.yml mode change 100755 => 100644 docs/conf.py mode change 100755 => 100644 setup.py rename tests/{test_{{cookiecutter.project_slug}}.py => test_cli.py} (53%) rename {{{cookiecutter.project_namespace}} => zeroae}/__init__.py (100%) create mode 100644 zeroae/cli/__init__.py create mode 100644 zeroae/cli/__main__.py create mode 100644 zeroae/cli/cli.py delete mode 100644 {{cookiecutter.project_namespace}}/{{cookiecutter.project_slug}}/__init__.py delete mode 100644 {{cookiecutter.project_namespace}}/{{cookiecutter.project_slug}}/__main__.py delete mode 100644 {{cookiecutter.project_namespace}}/{{cookiecutter.project_slug}}/cli.py diff --git a/.codacy.yml b/.codacy.yml index f7de163..42cb5c8 100644 --- a/.codacy.yml +++ b/.codacy.yml @@ -1,6 +1,6 @@ --- exclude_paths: - - '{{cookiecutter.project_namespace}}/{{cookiecutter.project_slug}}/_version.py' + - 'zeroae/cli/_version.py' - 'tests/**/*' - 'tests/*' - 'benchmarks/**/*' diff --git a/.coveragerc b/.coveragerc index 12b3384..897dc01 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,9 +1,9 @@ [run] -source = {{ cookiecutter.project_namespace }} +source = zeroae [report] omit = setup.py - {{ cookiecutter.project_namespace }}/{{ cookiecutter.project_slug }}/__main__.py - {{ cookiecutter.project_namespace }}/{{ cookiecutter.project_slug }}/_version.py + zeroae/cli/__main__.py + zeroae/cli/_version.py tests/* diff --git a/.github/ght.yaml b/.github/ght.yaml index 59cc44c..ed15c57 100644 --- a/.github/ght.yaml +++ b/.github/ght.yaml @@ -8,34 +8,26 @@ codacy: # # TODO: Place your CODACY Project Id here. # This is used for displaying your badge in public and private repos - project_id: CODACY_BADGE_TOKEN + project_id: d0799708f30942368739c3c54d4f2b92 cookiecutter: # # TODO: Please pick one, e.g. command_line_interface: Click - command_line_interface: - - Click - - None + command_line_interface: Click # # TODO: Please pick one, e.g. open_source_license: MIT - open_source_license: - - MIT - - BSD - - ISC - - Apache - - GNUv3 - - Proprietary + open_source_license: MIT # # These were guess based on the repository information # You probably want to customize them. - project_namespace: "{{ github.repository.full_name.split('/')[0].lower().replace(' ', '_').replace('-', '_') }}" - project_slug: "{{ github.repository.name.lower().replace(' ', '_').replace('-', '_').replace(cookiecutter.project_namespace+'_', '') }}" - project_name: "{{ cookiecutter.project_namespace }}'s {{ cookiecutter.project_slug }}" + project_namespace: "zeroae" + project_slug: "cli" + project_name: "zeroae's cli" # # These are likely correct... - anaconda_organization: "{{ cookiecutter.github_organization }}" + anaconda_organization: "zeroae" # # These should not be changed at the moment... @@ -46,9 +38,22 @@ cookiecutter: # # These should probably be left alone. They came from github - full_name: "{{ github.author.name }}" - email: "{{ github.author.email }}" - github_username: "{{ github.author.username }}" - github_organization: "{{ github.repository.full_name.split('/')[0] }}" - project_repo: "{{ github.repository.name }}" - project_short_description: "{{ github.repository.description }}" + full_name: "Patrick Sodré" + email: "psodre@gmail.com" + github_username: "sodre" + github_organization: "zeroae" + project_repo: "zeroae-cli" + project_short_description: "ZeroAE's CLI" + +# +# These were picked up during Initial Commit... +github: + author: + email: psodre@gmail.com + name: Patrick Sodré + username: sodre + repository: + name: zeroae-cli + full_name: zeroae/zeroae-cli + description: ZeroAE's CLI + private: false diff --git a/.github/workflows/ght-init.yml b/.github/workflows/ght-init.yml deleted file mode 100644 index 816f872..0000000 --- a/.github/workflows/ght-init.yml +++ /dev/null @@ -1,108 +0,0 @@ -name: ght-init -on: - push: - branches: - - master -jobs: - ght-configuration: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: Create GHT Branch - uses: peterjgrainger/action-create-branch@v1.0.0 - with: - branch: ght/master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - uses: actions/checkout@v1 - if: success() || failure() - with: - ref: ght/master - - - name: Set up Python 3.7 - uses: actions/setup-python@v1 - with: - python-version: 3.7 - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install jinja2 jinja2-cli jinja2-time pyyaml - - - name: Here is what is available during Initial Commit - run: jq . $GITHUB_EVENT_PATH - - - name: Create ght-repository.yaml file - run: | - tmpfile=$(mktemp) - cat > $tmpfile <<-EOF - - # - # These were picked up during Initial Commit... - github: - author: - email: ${{ github.event.head_commit.author.email }} - name: ${{ github.event.head_commit.author.name }} - username: ${{ github.event.head_commit.author.username }} - repository: - name: ${{ github.event.repository.name }} - full_name: ${{ github.event.repository.full_name }} - description: ${{ github.event.repository.description }} - private: ${{ github.event.repository.private }} - EOF - cat $tmpfile >> .github/ght.yaml - - - name: Render ght.yaml configuration - run: | - .github/bin/ght-render.sh render_configuration - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - base: ght/master - branch: ght/configure - branch-suffix: none - commit-message: Start ght-render configuration - title: ght-render configuration - assignees: ${{ github.actor }} - labels: ght - body: | - Use this PR to edit your ght-render configuration file [ght.yaml][1] - - Once a valid configuration is supplied, ght-render will create a separate pull-request - with the rendered template. - - Here is a list of things that I can't automatte yet: - - [Protect][2] your the branches: - - [ ] The `master` branch - - [ ] The `ght/master` branch - - Configure codecov.io: - - [ ] Add [CODECOV_TOKEN][codecov] to [GitHub Secrets][secrets] - - [ ] (private repo) Add [CODECOV_BADGE_TOKEN][codecov-badge] to [ght.yaml][1] - - Configure codacy.com: - - [ ] Add your [Codacy badge id][codacy-badge] a.k.a. `project-id` to [ght.yaml][1] - - [ ] (optional) Add your [CODACY_API_TOKEN][codacy-coverage] to [GitHub Secrets][secrets] for code coverage - - Configure anaconda.org - - [ ] Add a [ANACONDA_API_TOKEN][anaconda] to [GitHub Secrets][secrets]. - The token must have `api:read, api:write, conda` scope. We suggest calling it `zeroae-cli-rw`. - - (public repos) Configure PyPi.org - - [ ] Add your [PYPI_API_TOKEN][pypi] to [GitHub Secrets][secrets] - - [1]: https://github.com/${{ github.repository }}/edit/ght/configure/.github/ght.yaml - [2]: https://github.com/${{ github.repository }}/settings/branch_protection_rules/new - [codecov]: https://codecov.io/gh/${{ github.repository }}/settings - [codecov-badge]: https://codecov.io/gh/${{ github.repository }}/settings/badge - [codacy-badge]: https://app.codacy.com/gh/${{ github.repository }}/settings - [codacy-coverage]: https://app.codacy.com/gh/${{ github.repository }}/settings/coverage - [secrets]: https://github.com/${{ github.repository }}/settings/secrets - [pypi]: https://pypi.org/manage/account/token/ - [anaconda]: https://anaconda.org/${{ github.event.repository.owner.name }}/settings/access - - - name: Remind owner to replace their PyPi - uses: maxkomarychev/oction-create-issue@v0.7.1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - title: Replace PyPi Personal Access Token with package restricted one - body: | - This is a reminder that after you have uploaded the first version of your package - to PyPi, that you should replace your PAT with a package-restricted one. diff --git a/.github/workflows/ght-render-repo.yml b/.github/workflows/ght-render-repo.yml deleted file mode 100644 index f2339f3..0000000 --- a/.github/workflows/ght-render-repo.yml +++ /dev/null @@ -1,90 +0,0 @@ -name: ght-render-repo -on: - pull_request: - branches: - - ght/master - -jobs: - ght-render-repo: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - ref: master - - - name: Get last Merge Commit of the ght/render branch to Master - id: last-render - run: | - last_render=$(git log --merges -1 --grep 'ght/render' --pretty=format:'%H') - if [ -z $last_render ]; then - last_render=master - fi - echo "::set-output name=treeish::${last_render}" - - - uses: actions/checkout@v2 - with: - ref: ${{ steps.last-render.outputs.treeish }} - - - name: Fetch all branches - run: | - git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* - - - name: Prepare tree for re-rendering - run: | - git rm -rf . - git checkout origin/ght/master -- . - git checkout origin/${{ github.head_ref }} -- .github/ght.yaml - - - name: Set up Python 3.7 - uses: actions/setup-python@v1 - with: - python-version: 3.7 - - name: Install ght-render dependencies - run: | - python -m pip install --upgrade pip - pip install jinja2 jinja2-cli jinja2-time pyyaml - - run: | - .github/bin/ght-render.sh render-tree-structure - .github/bin/ght-render.sh render-tree-ght_content - .github/bin/ght-render.sh render-tree-content - .github/bin/ght-render.sh remove-workflows - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - base: master - branch: ght/render - branch-suffix: timestamp - commit-message: | - Render ght/master into master - - This commit was obtained as follows: - 1. Checkout the last merged rendering of ght/master - git checkout ${{ steps.last-render.outputs.treeish }} - 2. Replace its contents with ght/master - git rm -rf . - git checkout origin/ght/master -- . - 3. Load the configured ght.yaml from PR #${{ github.event.number }} file - git checkout ${{ github.sha }} -- .github/ght.yaml - 4. Execute the rendering steps - .github/bin/ght-render.sh render_tree_structure - .github/bin/ght-render.sh render_tree_ght_content - .github/bin/ght-render.sh render_tree_content - .github/bin/ght-render.sh finish - 5. Commit - git commit - - Close #${{ github.event.number }} - - title: Render ght/master into master - reviewers: ${{ github.actor }} - labels: ght - body: | - Please review the changes and fix any conflicts before merging. - - If the configuration variables were incorrect, please close this PR and - use your ght-configure PR #${{ github.event.number }} to edit the values. - - - diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 9aee575..8166634 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -15,7 +15,7 @@ Types of Contributions Report Bugs ~~~~~~~~~~~ -Report bugs at https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.project_repo }}/issues. +Report bugs at https://github.com/zeroae/zeroae-cli/issues. If you are reporting a bug, please include: @@ -38,14 +38,14 @@ and "help wanted" is open to whoever wants to implement it. Write Documentation ~~~~~~~~~~~~~~~~~~~ -{{ cookiecutter.project_name }} could always use more documentation, whether as part of the -official {{ cookiecutter.project_name }} docs, in docstrings, or even on the web in blog posts, +zeroae's cli could always use more documentation, whether as part of the +official zeroae's cli docs, in docstrings, or even on the web in blog posts, articles, and such. Submit Feedback ~~~~~~~~~~~~~~~ -The best way to send feedback is to file an issue at https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.project_repo }}/issues. +The best way to send feedback is to file an issue at https://github.com/zeroae/zeroae-cli/issues. If you are proposing a feature: @@ -57,18 +57,18 @@ If you are proposing a feature: Get Started! ------------ -Ready to contribute? Here's how to set up `{{ cookiecutter.project_repo }}` for local development. +Ready to contribute? Here's how to set up `zeroae-cli` for local development. -1. Fork the `{{ cookiecutter.project_repo }}` repo on GitHub. +1. Fork the `zeroae-cli` repo on GitHub. 2. Clone your fork locally:: - $ git clone git@github.com:your_name_here/{{ cookiecutter.project_repo }}.git + $ git clone git@github.com:your_name_here/zeroae-cli.git 3. Install your local copy into a conda environment. Assuming you have conda installed, this is how you set up your fork for local development:: - $ cd {{ cookiecutter.project_repo }}/ + $ cd zeroae-cli/ $ make init - $ conda activate {{ cookiecutter.project_repo }}-dev + $ conda activate zeroae-cli-dev $ pip install -e . --no-deps 4. Create a branch for local development, use the ``f-``, ``i-`` or ``chore-`` prefixes to auto-label your PR:: @@ -108,7 +108,7 @@ Tips To run a subset of tests:: - $ pytest tests.test_{{ cookiecutter.project_slug }} + $ pytest tests.test_cli Deploying --------- diff --git a/LICENSE b/LICENSE index 1c65d42..e41f36b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,6 @@ -{% if cookiecutter.open_source_license == 'MIT' -%} MIT License -Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.full_name }} +Copyright (c) 2019, Patrick Sodré Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -20,96 +19,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -{% elif cookiecutter.open_source_license == 'BSD' %} -BSD License - -Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.full_name }} -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or - other materials provided with the distribution. - -* Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from this - software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED -OF THE POSSIBILITY OF SUCH DAMAGE. -{% elif cookiecutter.open_source_license == 'ISC' -%} -ISC License - -Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.full_name }} - -Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -{% elif cookiecutter.open_source_license == 'Apache' -%} -Apache Software License 2.0 - -Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.full_name }} - -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. -{% elif cookiecutter.open_source_license == 'GNUv3' -%} -GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - {{ cookiecutter.project_short_description }} - Copyright (C) {% now 'local', '%Y' %} {{ cookiecutter.full_name }} - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. -{% elif cookiecutter.open_source_license == 'Proprietary' -%} -Proprietary License - -Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.full_name }} all rights reserved. -{% endif %} diff --git a/Makefile b/Makefile index 8f87e6d..e07e38e 100644 --- a/Makefile +++ b/Makefile @@ -68,9 +68,9 @@ coverage: ## check code coverage quickly with the default Python $(BROWSER) htmlcov/index.html docs: ## generate Sphinx HTML documentation, including API docs - rm -f docs/{{ cookiecutter.project_slug }}.rst + rm -f docs/cli.rst rm -f docs/modules.rst - sphinx-apidoc -o docs/ {{ cookiecutter.project_namespace }} + sphinx-apidoc -o docs/ zeroae $(MAKE) -C docs clean $(MAKE) -C docs html $(BROWSER) docs/_build/html/index.html @@ -88,7 +88,7 @@ dist: clean ## builds source and wheel package dist-conda: ## builds conda-package conda build --no-anaconda-upload --output-folder conda-bld \ - -c {{ cookiecutter.anaconda_organization }} \ + -c zeroae \ -c conda-forge \ -c anaconda . diff --git a/README.rst b/README.rst index e74e44b..0aa076b 100644 --- a/README.rst +++ b/README.rst @@ -1,47 +1,36 @@ -{% set is_open_source = cookiecutter.open_source_license != 'Proprietary' -%} -{% for _ in cookiecutter.project_name %}={% endfor %} -{{ cookiecutter.project_name }} -{% for _ in cookiecutter.project_name %}={% endfor %} - -.. image:: https://img.shields.io/conda/v/{{ cookiecutter.anaconda_organization }}/{{ cookiecutter.project_repo }}?logo=anaconda&style=flat-square - :target: https://anaconda.org/{{ cookiecutter.anaconda_organization }}/{{ cookiecutter.project_repo }} - -{%-if is_open_source %} -.. image:: https://img.shields.io/codecov/c/gh/{{ cookiecutter.github_organization }}/{{ cookiecutter.project_repo }}?logo=codecov&style=flat-square -{%- else %} -.. image:: https://codecov.io/gh/{{ cookiecutter.github_organization }}/{{ cookiecutter.project_repo }}/branch/master/graph/badge.svg?token={{ codecov.badge_token }} -{%- endif %} - :target: https://codecov.io/gh/{{ cookiecutter.github_organization }}/{{ cookiecutter.project_repo }} - -.. image:: https://img.shields.io/codacy/grade/{{ codacy.project_id }}?logo=codacy&style=flat-square - :target: https://www.codacy.com/app/{{ cookiecutter.github_organization }}/{{ cookiecutter.project_repo }} +============ +zeroae's cli +============ + +.. image:: https://img.shields.io/conda/v/zeroae/zeroae-cli?logo=anaconda&style=flat-square + :target: https://anaconda.org/zeroae/zeroae-cli +.. image:: https://img.shields.io/codecov/c/gh/zeroae/zeroae-cli?logo=codecov&style=flat-square + :target: https://codecov.io/gh/zeroae/zeroae-cli + +.. image:: https://img.shields.io/codacy/grade/d0799708f30942368739c3c54d4f2b92?logo=codacy&style=flat-square + :target: https://www.codacy.com/app/zeroae/zeroae-cli :alt: Codacy Badge .. image:: https://img.shields.io/badge/code--style-black-black?style=flat-square :target: https://github.com/psf/black -{% if is_open_source %} -.. image:: https://img.shields.io/pypi/v/{{ cookiecutter.project_repo }}?logo=pypi&style=flat-square - :target: https://pypi.python.org/pypi/{{ cookiecutter.project_repo }} -.. image:: https://readthedocs.org/projects/{{ cookiecutter.project_repo | replace("_", "-") }}/badge/?version=latest&style=flat-square - :target: https://{{ cookiecutter.project_repo | replace("_", "-") }}.readthedocs.io/en/latest/?badge=latest +.. image:: https://img.shields.io/pypi/v/zeroae-cli?logo=pypi&style=flat-square + :target: https://pypi.python.org/pypi/zeroae-cli + +.. image:: https://readthedocs.org/projects/zeroae-cli/badge/?version=latest&style=flat-square + :target: https://zeroae-cli.readthedocs.io/en/latest/?badge=latest :alt: Documentation Status -{%- endif %} -{% if cookiecutter.add_pyup_badge == 'y' and false %} -.. image:: https://pyup.io/repos/github/{{ cookiecutter.github_username }}/{{ cookiecutter.project_repo }}/shield.svg&style=flat-square - :target: https://pyup.io/repos/github/{{ cookiecutter.github_username }}/{{ cookiecutter.project_repo }}/ - :alt: Updates -{% endif %} -{{ cookiecutter.project_short_description }} -{% if is_open_source %} -* Free software: {{ cookiecutter.open_source_license }} -* Documentation: https://{{ cookiecutter.project_repo | replace("_", "-") }}.readthedocs.io. -{% endif %} +ZeroAE's CLI + + +* Free software: MIT +* Documentation: https://zeroae-cli.readthedocs.io. + Features -------- diff --git a/conda.recipe/meta.yaml b/conda.recipe/meta.yaml index 6d1bb1d..d3051b9 100644 --- a/conda.recipe/meta.yaml +++ b/conda.recipe/meta.yaml @@ -1,15 +1,11 @@ -{# raw is for ignoring templating with cookiecutter, leaving it for use with conda-build #} -{%- raw %} + {% set data = load_setup_py_data() %} {% set rosetta = data["conda_rosetta_stone"] %} -{%- endraw %} package: - name: {{ cookiecutter.project_repo}} - {# raw is for ignoring templating with cookiecutter, leaving it for use with conda-build #} - {%- raw %} + name: zeroae-cli + version: {{ data['version'] }} - {%- endraw %} source: path: .. @@ -19,13 +15,8 @@ build: # separate bld.bat and build.sh files instead of this key. Add the line # "skip: True # [py<35]" (for example) to limit to Python 3.5 and newer, or # "skip: True # [not win]" to limit to Windows. - {%- raw %} script: {{ PYTHON }} -m pip install --no-deps --ignore-installed -vv . - {%- endraw %} - {% if cookiecutter.noarch_python == 'y' -%} noarch: python - {%- endif %} - {%- raw %} {%- if 'entry_points' in data and 'console_scripts' in data['entry_points'] %} entry_points: {% for entry in data['entry_points']['console_scripts'] %} @@ -33,58 +24,45 @@ build: - {{ kv[0].strip() }} = {{ kv[1].strip() }} {% endfor %} {%- endif %} - {%- endraw %} requirements: # if you need compilers, uncomment these # read more at https://docs.conda.io/projects/conda-build/en/latest/resources/compiler-tools.html # build: - {%- raw %} # - {{ compilers('c') }} - {%- endraw %} host: - {%- raw %} - python {{ data['python_requires'] }} - pip {% for dep in data['setup_requires'] %} - {{ rosetta.get(dep, dep).lower() }} {% endfor %} {# raw is for ignoring templating with cookiecutter, leaving it for use with conda-build #} - {%- endraw %} run: - python - {%- raw %} # dependencies are defined in setup.py {% for dep in data['install_requires'] %} - {{ rosetta.get(dep, dep).lower() }} {% endfor %} - {%- endraw %} test: source_files: - tests requires: - {%- raw %} # dependencies are defined in setup.py {% for dep in data['tests_require'] %} - {{ rosetta.get(dep, dep).lower() }} {% endfor %} - {%- endraw %} commands: - {%- raw %} {%- if 'entry_points' in data and 'console_scripts' in data['entry_points'] %} {%- for entry in data['entry_points']['console_scripts'] %} - {{ entry.split('=')[0].strip() }} --help {%- endfor %} {%- endif %} - {%- endraw %} - pytest tests about: - home: https://github.com/{{ cookiecutter.github_organization}}/{{ cookiecutter.project_repo}} - summary: {{ cookiecutter.project_short_description }} - {%- raw %} + home: https://github.com/zeroae/zeroae-cli + summary: ZeroAE's CLI license: {{ data.get('license') }} - {%- endraw %} license_file: LICENSE diff --git a/docs/Makefile b/docs/Makefile index 2a5834e..299c7bd 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -4,7 +4,7 @@ # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = python -msphinx -SPHINXPROJ = {{cookiecutter.project_namespace}}/{{ cookiecutter.project_slug }} +SPHINXPROJ = zeroae/cli SOURCEDIR = . BUILDDIR = _build diff --git a/docs/conf.py b/docs/conf.py old mode 100755 new mode 100644 index 138a849..1f91d4c --- a/docs/conf.py +++ b/docs/conf.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# {{ cookiecutter.project_repo }} documentation build configuration file, created by +# zeroae-cli documentation build configuration file, created by # sphinx-quickstart on Fri Jun 9 13:47:02 2017. # # This file is execfile()d with the current directory set to its @@ -20,7 +20,7 @@ import os import sys -import {{cookiecutter.project_namespace}}.{{ cookiecutter.project_slug }} +import zeroae.cli sys.path.insert(0, os.path.abspath("..")) @@ -47,18 +47,18 @@ master_doc = "index" # General information about the project. -project = "{{ cookiecutter.project_name }}" -copyright = "{% now 'local', '%Y' %}, {{ cookiecutter.full_name }}" -author = "{{ cookiecutter.full_name }}" +project = "zeroae's cli" +copyright = "2019, Patrick Sodré" +author = "Patrick Sodré" # The version info for the project you're documenting, acts as replacement # for |version| and |release|, also used in various other places throughout # the built documents. # # The short X.Y version. -version = {{cookiecutter.project_namespace}}.{{ cookiecutter.project_slug }}.__version__ +version = zeroae.cli.__version__ # The full version, including alpha/beta/rc tags. -release = {{cookiecutter.project_namespace}}.{{ cookiecutter.project_slug }}.__version__ +release = zeroae.cli.__version__ # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -101,7 +101,7 @@ # -- Options for HTMLHelp output --------------------------------------- # Output file base name for HTML help builder. -htmlhelp_basename = "{{ cookiecutter.project_slug }}doc" +htmlhelp_basename = "clidoc" # -- Options for LaTeX output ------------------------------------------ @@ -132,9 +132,9 @@ # fmt: off ( master_doc, - "{{ cookiecutter.project_slug }}.tex", - "{{ cookiecutter.project_name }} Documentation", - "{{ cookiecutter.full_name }}", + "cli.tex", + "zeroae's cli Documentation", + "Patrick Sodré", "manual", ), # fmt: on @@ -149,8 +149,8 @@ # fmt: off ( master_doc, - "{{ cookiecutter.project_slug }}", - "{{ cookiecutter.project_name }} Documentation", + "cli", + "zeroae's cli Documentation", [author], 1 ) @@ -167,10 +167,10 @@ # fmt: off ( master_doc, - "{{ cookiecutter.project_slug }}", - "{{ cookiecutter.project_name }} Documentation", + "cli", + "zeroae's cli Documentation", author, - "{{ cookiecutter.project_slug }}", + "cli", "One line description of project.", "Miscellaneous", ), diff --git a/docs/index.rst b/docs/index.rst index c2d1eb8..0eeb956 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,4 +1,4 @@ -Welcome to {{ cookiecutter.project_name }}'s documentation! +Welcome to zeroae's cli's documentation! ====================================== .. toctree:: diff --git a/docs/installation.rst b/docs/installation.rst index df03ef0..3092b69 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -8,13 +8,13 @@ Installation Stable release -------------- -To install {{ cookiecutter.project_name }}, run this command in your terminal: +To install zeroae's cli, run this command in your terminal: .. code-block:: console - $ pip install {{ cookiecutter.project_repo }} + $ pip install zeroae-cli -This is the preferred method to install {{ cookiecutter.project_name }}, as it will always install the most recent stable release. +This is the preferred method to install zeroae's cli, as it will always install the most recent stable release. If you don't have `pip`_ installed, this `Python installation guide`_ can guide you through the process. @@ -26,19 +26,19 @@ you through the process. From sources ------------ -The sources for {{ cookiecutter.project_name }} can be downloaded from the `Github repo`_. +The sources for zeroae's cli can be downloaded from the `Github repo`_. You can either clone the public repository: .. code-block:: console - $ git clone git://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_repo }} + $ git clone git://github.com/sodre/zeroae-cli Or download the `tarball`_: .. code-block:: console - $ curl -OJL https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_repo }}/tarball/master + $ curl -OJL https://github.com/sodre/zeroae-cli/tarball/master Once you have a copy of the source, you can install it with: @@ -47,5 +47,5 @@ Once you have a copy of the source, you can install it with: $ python setup.py install -.. _Github repo: https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.project_repo }} -.. _tarball: https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.project_repo }}/tarball/master +.. _Github repo: https://github.com/zeroae/zeroae-cli +.. _tarball: https://github.com/zeroae/zeroae-cli/tarball/master diff --git a/docs/make.bat b/docs/make.bat index 4a216da..c6cf9c9 100644 --- a/docs/make.bat +++ b/docs/make.bat @@ -1,36 +1,36 @@ -@ECHO OFF - -pushd %~dp0 - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=python -msphinx -) -set SOURCEDIR=. -set BUILDDIR=_build -set SPHINXPROJ={{ cookiecutter.project_slug }} - -if "%1" == "" goto help - -%SPHINXBUILD% >NUL 2>NUL -if errorlevel 9009 ( - echo. - echo.The Sphinx module was not found. Make sure you have Sphinx installed, - echo.then set the SPHINXBUILD environment variable to point to the full - echo.path of the 'sphinx-build' executable. Alternatively you may add the - echo.Sphinx directory to PATH. - echo. - echo.If you don't have Sphinx installed, grab it from - echo.http://sphinx-doc.org/ - exit /b 1 -) - -%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% -goto end - -:help -%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% - -:end -popd +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=python -msphinx +) +set SOURCEDIR=. +set BUILDDIR=_build +set SPHINXPROJ=cli + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The Sphinx module was not found. Make sure you have Sphinx installed, + echo.then set the SPHINXBUILD environment variable to point to the full + echo.path of the 'sphinx-build' executable. Alternatively you may add the + echo.Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% + +:end +popd diff --git a/docs/usage.rst b/docs/usage.rst index 4add6fb..6282405 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -2,6 +2,6 @@ Usage ===== -To use {{ cookiecutter.project_name }} in a project:: +To use zeroae's cli in a project:: - import {{ cookiecutter.project_slug }} + import cli diff --git a/environment.yml b/environment.yml index dbbca50..1461362 100644 --- a/environment.yml +++ b/environment.yml @@ -1,6 +1,6 @@ -name: {{ cookiecutter.project_repo }}-dev +name: zeroae-cli-dev channels: - - {{ cookiecutter.anaconda_organization }} + - zeroae - conda-forge - defaults dependencies: diff --git a/setup.py b/setup.py old mode 100755 new mode 100644 index e00248f..a59867b --- a/setup.py +++ b/setup.py @@ -11,30 +11,24 @@ # The requirements section should be kept in sync with the environment.yml file requirements = [ # fmt: off - {%- if cookiecutter.command_line_interface|lower == 'click' %} "click>=7.0", "click-plugins", "entrypoints", - {%- endif %} # fmt: on ] setup_requirements = [ # fmt: off - {%- if cookiecutter.use_pytest == 'y' %} "pytest-runner", "setuptools_scm", "wheel", - {%- endif %} # fmt: on ] test_requirements = [ # fmt: off - {%- if cookiecutter.use_pytest == 'y' %} "pytest>=3", "pytest-cov", - {%- endif %} # fmt: on ] @@ -44,57 +38,37 @@ # fmt: on } -{%- set license_classifiers = { - 'MIT': 'License :: OSI Approved :: MIT License', - 'BSD': 'License :: OSI Approved :: BSD License', - 'ISC': 'License :: OSI Approved :: ISC License (ISCL)', - 'Apache': 'License :: OSI Approved :: Apache Software License', - 'GNUv3': 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)', - 'Proprietary': 'License :: Other/Proprietary License', -} %} - setup_kwargs = dict( - author="{{ cookiecutter.full_name.replace('\"', '\\\"') }}", - author_email="{{ cookiecutter.email }}", - use_scm_version={"write_to": "{{ cookiecutter.project_namespace }}/{{ cookiecutter.project_slug }}/_version.py"}, + author="Patrick Sodré", + author_email="psodre@gmail.com", + use_scm_version={"write_to": "zeroae/cli/_version.py"}, python_requires=">=3.6", classifiers=[ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", -{%- if cookiecutter.open_source_license in license_classifiers %} - "{{ license_classifiers[cookiecutter.open_source_license] }}", -{%- endif %} + "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", ], - description="{{ cookiecutter.project_short_description }}", - {%- if 'no' not in cookiecutter.command_line_interface|lower %} + description="ZeroAE's CLI", # fmt: off entry_points={ - {%- if cookiecutter.project_slug == "cli" %} "console_scripts": [ - "{{ cookiecutter.project_namespace }} - {%- else %} - "{{cookiecutter.project_namespace}}.cli": [ - "{{ cookiecutter.project_slug.replace("_","-") }} - {%- endif -%}={{cookiecutter.project_namespace}}.{{ cookiecutter.project_slug }}.cli:{{ cookiecutter.project_slug }}", + "zeroae=zeroae.cli.cli:cli", ], }, # fmt: on - {%- endif %} install_requires=requirements, -{%- if cookiecutter.open_source_license in license_classifiers %} - license="{{ cookiecutter.open_source_license }}", -{%- endif %} + license="MIT", long_description=readme, long_description_content_type="text/x-rst", include_package_data=True, - keywords="{{ cookiecutter.project_slug }} {{ cookiecutter.project_namespace }}", - name="{{cookiecutter.project_namespace}}-{{ cookiecutter.project_slug }}", - packages=find_namespace_packages(include=["{{ cookiecutter.project_namespace }}.*"]), + keywords="cli zeroae", + name="zeroae-cli", + packages=find_namespace_packages(include=["zeroae.*"]), setup_requires=setup_requirements, test_suite="tests", tests_require=test_requirements, @@ -103,7 +77,7 @@ "test": test_requirements # fmt: on }, - url="https://github.com/{{ cookiecutter.github_organization}}/{{ cookiecutter.project_repo}}", + url="https://github.com/zeroae/zeroae-cli", zip_safe=False, ) @@ -115,7 +89,7 @@ del setup_kwargs["use_scm_version"] except ModuleNotFoundError: print( - "Error: {{ cookiecutter.project_repo }} requires that setuptools_scm be installed with conda-build!" # noqa: E501 + "Error: zeroae-cli requires that setuptools_scm be installed with conda-build!" # noqa: E501 ) raise setup_kwargs["conda_rosetta_stone"] = conda_rosetta_stone diff --git a/tests/__init__.py b/tests/__init__.py index b4820af..ab5cf93 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1 +1 @@ -"""Unit test package for {{ cookiecutter.project_repo }}.""" +"""Unit test package for zeroae-cli.""" diff --git a/tests/test_{{cookiecutter.project_slug}}.py b/tests/test_cli.py similarity index 53% rename from tests/test_{{cookiecutter.project_slug}}.py rename to tests/test_cli.py index c131c18..b4dbe7a 100644 --- a/tests/test_{{cookiecutter.project_slug}}.py +++ b/tests/test_cli.py @@ -1,12 +1,10 @@ #!/usr/bin/env python -"""Tests for `{{ cookiecutter.project_repo }}` package.""" +"""Tests for `zeroae-cli` package.""" import pytest -{%- if cookiecutter.command_line_interface|lower == 'click' %} from click.testing import CliRunner -from {{cookiecutter.project_namespace}}.{{ cookiecutter.project_slug }} import cli -{%- endif %} +from zeroae.cli import cli @pytest.fixture @@ -23,20 +21,14 @@ def test_content(response): """Sample pytest test function with the pytest fixture as an argument.""" # from bs4 import BeautifulSoup # assert 'GitHub' in BeautifulSoup(response.content).title.string -{%- if cookiecutter.command_line_interface|lower == 'click' %} def test_command_line_interface(): """Test the CLI.""" runner = CliRunner() - result = runner.invoke(cli.{{ cookiecutter.project_slug }}) + result = runner.invoke(cli.cli) assert result.exit_code == 0 - {%- if cookiecutter.project_slug != "cli" %} - assert "Replace this message" in result.output - {%- else %} - assert "Usage: {{ cookiecutter.project_slug }}" in result.output - {%- endif %} - help_result = runner.invoke(cli.{{ cookiecutter.project_slug }}, ["--help"]) + assert "Usage: cli" in result.output + help_result = runner.invoke(cli.cli, ["--help"]) assert help_result.exit_code == 0 assert "--help Show this message and exit." in help_result.output -{%- endif %} diff --git a/{{cookiecutter.project_namespace}}/__init__.py b/zeroae/__init__.py similarity index 100% rename from {{cookiecutter.project_namespace}}/__init__.py rename to zeroae/__init__.py diff --git a/zeroae/cli/__init__.py b/zeroae/cli/__init__.py new file mode 100644 index 0000000..02833d6 --- /dev/null +++ b/zeroae/cli/__init__.py @@ -0,0 +1,2 @@ +"""Top-level package for zeroae's cli.""" +from ._version import version as __version__ # noqa: F401 diff --git a/zeroae/cli/__main__.py b/zeroae/cli/__main__.py new file mode 100644 index 0000000..f3e0b8a --- /dev/null +++ b/zeroae/cli/__main__.py @@ -0,0 +1,3 @@ +from . import cli + +cli.cli() diff --git a/zeroae/cli/cli.py b/zeroae/cli/cli.py new file mode 100644 index 0000000..2aff59e --- /dev/null +++ b/zeroae/cli/cli.py @@ -0,0 +1,17 @@ +"""Console script for zeroae-cli.""" + +import sys +import click +from click_plugins import with_plugins +from entrypoints import get_group_named + + +@with_plugins(get_group_named("zeroae.cli").values()) +@click.group() +def cli(args=None): + """zeroae command-line-interface""" + return 0 + + +if __name__ == "__main__": + sys.exit(cli) # pragma: no cover diff --git a/{{cookiecutter.project_namespace}}/{{cookiecutter.project_slug}}/__init__.py b/{{cookiecutter.project_namespace}}/{{cookiecutter.project_slug}}/__init__.py deleted file mode 100644 index b8379b7..0000000 --- a/{{cookiecutter.project_namespace}}/{{cookiecutter.project_slug}}/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -"""Top-level package for {{ cookiecutter.project_name }}.""" -from ._version import version as __version__ # noqa: F401 diff --git a/{{cookiecutter.project_namespace}}/{{cookiecutter.project_slug}}/__main__.py b/{{cookiecutter.project_namespace}}/{{cookiecutter.project_slug}}/__main__.py deleted file mode 100644 index 06c5280..0000000 --- a/{{cookiecutter.project_namespace}}/{{cookiecutter.project_slug}}/__main__.py +++ /dev/null @@ -1,3 +0,0 @@ -from . import cli - -cli.{{ cookiecutter.project_slug }}() diff --git a/{{cookiecutter.project_namespace}}/{{cookiecutter.project_slug}}/cli.py b/{{cookiecutter.project_namespace}}/{{cookiecutter.project_slug}}/cli.py deleted file mode 100644 index f80d12a..0000000 --- a/{{cookiecutter.project_namespace}}/{{cookiecutter.project_slug}}/cli.py +++ /dev/null @@ -1,33 +0,0 @@ -"""Console script for {{cookiecutter.project_repo}}.""" - -import sys -{%- if cookiecutter.command_line_interface|lower == 'click' %} -import click -{%- endif %} -{%- if cookiecutter.project_slug == 'cli' %} -from click_plugins import with_plugins -from entrypoints import get_group_named - - -@with_plugins(get_group_named("{{cookiecutter.project_namespace}}.cli").values()) -@click.group() -def {{ cookiecutter.project_slug }}(args=None): - """{{cookiecutter.project_namespace}} command-line-interface""" - return 0 -{%- elif cookiecutter.command_line_interface|lower == 'click' %} - - -@click.command() -def {{ cookiecutter.project_slug }}(args=None): - """Console script for {{cookiecutter.project_repo}}.""" - # fmt: off - click.echo("Replace this message by putting your code into " - "{{cookiecutter.project_slug}}.cli.main") - click.echo("See click documentation at https://click.palletsprojects.com/") - # fmt: on - return 0 -{%- endif %} - - -if __name__ == "__main__": - sys.exit({{ cookiecutter.project_slug }}) # pragma: no cover