From ade1959381459abb179df2b3a7c1e25ae695f3db Mon Sep 17 00:00:00 2001 From: Mark Sevelj Date: Wed, 1 Sep 2021 23:15:12 +0000 Subject: [PATCH] chore(Travis): Remove support for Travis #18 Travis is quite expensive and the free tier is only for a trial. Continue developing GitHub actions for build and deploy. closes #18 --- .travis.yml | 25 -------- README.rst | 7 ++- docs/index.rst | 1 - docs/prompts.rst | 27 ++++---- docs/travis_pypi_setup.rst | 62 ------------------- docs/tutorial.rst | 46 ++++++++------ tests/test_bake_project.py | 51 +++------------ tox.ini | 7 --- {{cookiecutter.project_slug}}/.travis.yml | 30 --------- .../CONTRIBUTING.rst | 6 +- 10 files changed, 57 insertions(+), 205 deletions(-) delete mode 100644 .travis.yml delete mode 100644 docs/travis_pypi_setup.rst delete mode 100644 {{cookiecutter.project_slug}}/.travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 15777bd..0000000 --- a/.travis.yml +++ /dev/null @@ -1,25 +0,0 @@ -# Config file for automatic testing at travis-ci.org - -language: python -python: - - 3.8 - - 3.7 - - 3.6 - -# command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors -install: pip install -U tox-travis - -# command to run tests, e.g. python setup.py test -script: tox - -# deploy new versions to PyPI -deploy: - provider: pypi - distributions: sdist bdist_wheel - user: audreyr - password: - secure: PLEASE_REPLACE_ME - on: - tags: true - repo: audreyr/python_boilerplate - python: 3.8 diff --git a/README.rst b/README.rst index 90541d1..01c81a3 100644 --- a/README.rst +++ b/README.rst @@ -38,6 +38,11 @@ Cookiecutter_ template for a Python package. **The information below relates to the original package and has not been updated yet** +**Notable Fork changes from the Original project so far.** + +#. Links from the original fork have been updated to point to this repository. +#. Support for Travis has been removed. + Features -------- @@ -116,7 +121,7 @@ Similar Cookiecutter Templates * `zillionare/cookiecutter-pypackage`_: A template containing Poetry_, Mkdocs_, Github CI and many more. It's a template and a package also (can be installed with `pip`) -* Also see the `network`_ and `family tree`_ for this repo. (If you find +* Also see the `network`_ and `family tree`_ for the original repo. (If you find anything that should be listed here, please add it and send a pull request!) Fork This / Create Your Own diff --git a/docs/index.rst b/docs/index.rst index b834c4d..0fddfcc 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -30,7 +30,6 @@ Advanced Features .. toctree:: :maxdepth: 2 - travis_pypi_setup console_script_setup diff --git a/docs/prompts.rst b/docs/prompts.rst index b2b1b48..2e91966 100644 --- a/docs/prompts.rst +++ b/docs/prompts.rst @@ -18,10 +18,13 @@ github_username Your GitHub username. project_name - The name of your new Python package project. This is used in documentation, so spaces and any characters are fine here. - + The name of your new Python package project. This is used in documentation, + so spaces and any characters are fine here. + project_slug - The namespace of your Python package. This should be Python import-friendly. Typically, it is the slugified version of project_name. Note: your PyPi project and Travis links will use project_slug, so change those in the README afterwards. + The namespace of your Python package. This should be Python import-friendly. + Typically, it is the slugified version of project_name. Note: your PyPi + project link will use project_slug, so change those in the README afterwards. project_short_description A 1-sentence description of what your Python package does. @@ -35,22 +38,24 @@ version Options ------- -The following package configuration options set up different features for your project. +The following package configuration options set up different features for your +project. use_pytest Whether to use `pytest `_ -use_pypi_deployment_with_travis - Whether to use PyPI deployment with `Travis `_. - add_pyup_badge Whether to include a `pyup `_ badge command_line_interface - Whether to create a console script using Click. Console script entry point will match the project_slug. Options: ['Click', 'Argparse', 'No command-line interface'] - + Whether to create a console script using Click. Console script entry point + will match the project_slug. Options: ['Click', 'Argparse', + 'No command-line interface'] + create_author_file Whether to create an authors file - + open_source_license - Choose a `license `_. Options: [1. MIT License, 2. BSD license, 3. ISC license, 4. Apache Software License 2.0, 5. GNU General Public License v3, 6. Not open source] + Choose a `license `_. Options: [1. MIT + License, 2. BSD license, 3. ISC license, 4. Apache Software License 2.0, 5. + GNU General Public License v3, 6. Not open source] diff --git a/docs/travis_pypi_setup.rst b/docs/travis_pypi_setup.rst deleted file mode 100644 index 0d03ae3..0000000 --- a/docs/travis_pypi_setup.rst +++ /dev/null @@ -1,62 +0,0 @@ -.. _travis-pypi-setup: - -Travis/PyPI Setup -================= - -Optionally, your package can automatically be released on PyPI whenever you -push a new tag to the master branch. - -Install the Travis CLI tool ---------------------------- - -This is OS-specific. - -macOS ------- - -We recommend the Homebrew travis package: - -``` -brew install travis -``` - -Windows and Linux ------------------- - -Follow the official Travis CLI installationinstructions for your operating system: - -https://github.com/travis-ci/travis.rb#installation - -How It Works ------------- - -Once you have the `travis` command - line tool installed, from the root of your project do:: - - travis encrypt --add deploy.password - -This will encrypt your locally-stored PyPI password and save that to your `.travis.yml` file. Commit that change to git. - - -Your Release Process --------------------- - -If you are using this feature, this is how you would do a patch release: - -.. code-block:: bash - - bump2version patch - git push --tags - -This will result in: - -* mypackage 0.1.1 showing up in your GitHub tags/releases page -* mypackage 0.1.1 getting released on PyPI - -You can also replace patch with `minor` or `major`. - - -More Details ------------- - -You can read more about using Travis for PyPI deployment at: -https://docs.travis-ci.com/user/deployment/pypi/ diff --git a/docs/tutorial.rst b/docs/tutorial.rst index 1857b6f..2e9a249 100644 --- a/docs/tutorial.rst +++ b/docs/tutorial.rst @@ -62,11 +62,15 @@ If you don't know what to enter, stick with the defaults. Step 3: Create a GitHub Repo ---------------------------- -Go to your GitHub account and create a new repo named ``mypackage``, where ``mypackage`` matches the ``[project_slug]`` from your answers to running cookiecutter. This is so that Travis CI and pyup.io can find it when we get to Step 5. +Go to your GitHub account and create a new repo named ``mypackage``, where +``mypackage`` matches the ``[project_slug]`` from your answers to running +cookiecutter. This is so that pyup.io can find it when we get to Step 5. -``If your virtualenv folder is within your project folder, be sure to add the virtualenv folder name to your .gitignore file.`` +``If your virtualenv folder is within your project folder, be sure to add the +virtualenv folder name to your .gitignore file.`` -You will find one folder named after the ``[project_slug]``. Move into this folder, and then setup git to use your GitHub repo and upload the code: +You will find one folder named after the ``[project_slug]``. Move into this f +older, and then setup git to use your GitHub repo and upload the code: .. code-block:: bash @@ -90,39 +94,41 @@ Step 4: Install Dev Requirements You should still be in the folder containing the ``requirements_dev.txt`` file. -Your virtualenv should still be activated. If it isn't, activate it now. Install the new project's local development requirements: +Your virtualenv should still be activated. If it isn't, activate it now. +Install the new project's local development requirements: .. code-block:: bash pip install -r requirements_dev.txt -Step 5: Set Up Travis CI ------------------------- +.. TODO: Change this to Codacy Step. See Issue 22 +.. Step 5: Set Up Travis CI +.. ------------------------ -`Travis CI com`_ is a continuous integration tool used to prevent integration problems. Every commit to the master branch will trigger automated builds of the application. +.. `Travis CI com`_ is a continuous integration tool used to prevent integration problems. Every commit to the master branch will trigger automated builds of the application. -Login using your Github credentials. It may take a few minutes for Travis CI to load up a list of all your GitHub repos. They will be listed with boxes to the left of the repo name, where the boxes have an ``X`` in them, meaning it is not connected to Travis CI. +.. Login using your Github credentials. It may take a few minutes for Travis CI to load up a list of all your GitHub repos. They will be listed with boxes to the left of the repo name, where the boxes have an ``X`` in them, meaning it is not connected to Travis CI. -Add the public repo to your Travis CI account by clicking the ``X`` to switch it "on" in the box next to the ``mypackage`` repo. Do not try to follow the other instructions, that will be taken care of next. +.. Add the public repo to your Travis CI account by clicking the ``X`` to switch it "on" in the box next to the ``mypackage`` repo. Do not try to follow the other instructions, that will be taken care of next. -In your terminal, your virtualenv should still be activated. If it isn't, activate it now. Run the Travis CLI tool to do your Travis CI setup: +.. In your terminal, your virtualenv should still be activated. If it isn't, activate it now. Run the Travis CLI tool to do your Travis CI setup: -.. code-block:: bash +.. .. code-block:: bash - travis encrypt --add deploy.password +.. travis encrypt --add deploy.password -This will: +.. This will: -* Encrypt your PyPI password in your Travis config. -* Activate automated deployment on PyPI when you push a new tag to master branch. +.. * Encrypt your PyPI password in your Travis config. +.. * Activate automated deployment on PyPI when you push a new tag to master branch. -See :ref:`travis-pypi-setup` for more information. +.. See :ref:`travis-pypi-setup` for more information. -.. _`Travis CI com`: https://travis-ci.com/ +.. .. _`Travis CI com`: https://travis-ci.com/ -Step 6: Set Up Read the Docs +Step 5: Set Up Read the Docs -------------------------- `Read the Docs`_ hosts documentation for the open source community. Think of it as Continuous Documentation. @@ -135,7 +141,7 @@ Now your documentation will get rebuilt when you make documentation changes to y .. _`Read the Docs`: https://readthedocs.org/ -Step 7: Set Up pyup.io +Step 6: Set Up pyup.io ---------------------- `pyup.io`_ is a service that helps you to keep your requirements files up to date. It sends you automated @@ -150,7 +156,7 @@ Once your repo is set up correctly, the pyup.io badge will show your current upd .. _`pyup.io`: https://pyup.io/ -Step 8: Release on PyPI +Step 7: Release on PyPI ----------------------- The Python Package Index or `PyPI`_ is the official third-party software repository for the Python programming language. Python developers intend it to be a comprehensive catalog of all open source Python packages. diff --git a/tests/test_bake_project.py b/tests/test_bake_project.py index 2916ad2..bc6ebbe 100644 --- a/tests/test_bake_project.py +++ b/tests/test_bake_project.py @@ -1,16 +1,15 @@ -from contextlib import contextmanager -import shlex +import datetime +import importlib import os -import sys +import shlex import subprocess -import yaml -import datetime -import pytest -from cookiecutter.utils import rmtree +import sys +from contextlib import contextmanager +import pytest +import yaml from click.testing import CliRunner - -import importlib +from cookiecutter.utils import rmtree @contextmanager @@ -112,40 +111,6 @@ def test_bake_with_apostrophe_and_run_tests(cookies): run_inside_dir('python setup.py test', str(result.project)) == 0 -# def test_bake_and_run_travis_pypi_setup(cookies): -# # given: -# with bake_in_temp_dir(cookies) as result: -# project_path = str(result.project) -# -# # when: -# travis_setup_cmd = ('python travis_pypi_setup.py' -# ' --repo audreyr/cookiecutter-pypackage' -# ' --password invalidpass') -# run_inside_dir(travis_setup_cmd, project_path) -# # then: -# result_travis_config = yaml.load( -# result.project.join(".travis.yml").open() -# ) -# min_size_of_encrypted_password = 50 -# assert len( -# result_travis_config["deploy"]["password"]["secure"] -# ) > min_size_of_encrypted_password - - -def test_bake_without_travis_pypi_setup(cookies): - with bake_in_temp_dir( - cookies, - extra_context={'use_pypi_deployment_with_travis': 'n'} - ) as result: - result_travis_config = yaml.load( - result.project.join(".travis.yml").open(), - Loader=yaml.FullLoader - ) - assert "deploy" not in result_travis_config - assert "python" == result_travis_config["language"] - # found_toplevel_files = [f.basename for f in result.project.listdir()] - - def test_bake_without_author_file(cookies): with bake_in_temp_dir( cookies, diff --git a/tox.ini b/tox.ini index b15a592..dac4e28 100644 --- a/tox.ini +++ b/tox.ini @@ -4,13 +4,6 @@ envlist = py36, py37,py38 pypy, py39, docs skipsdist = true skip_missing_interpreters = true -[travis] -python = - 3.9: py39 - 3.8: py38 - 3.7: py37 - 3.6: py36 - [testenv:docs] basepython=python changedir=docs/source diff --git a/{{cookiecutter.project_slug}}/.travis.yml b/{{cookiecutter.project_slug}}/.travis.yml deleted file mode 100644 index cde3fcf..0000000 --- a/{{cookiecutter.project_slug}}/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -# Config file for automatic testing at travis-ci.com - -language: python -python: - - 3.8 - - 3.7 - - 3.6 - -# Command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors -install: pip install -U tox-travis - -# Command to run tests, e.g. python setup.py test -script: tox - -{% if cookiecutter.use_pypi_deployment_with_travis == 'y' -%} -# Assuming you have installed the travis-ci CLI tool, after you -# create the Github repo and add it to Travis, run the -# following command to finish PyPI deployment setup: -# $ travis encrypt --add deploy.password -deploy: - provider: pypi - distributions: sdist bdist_wheel - user: {{ cookiecutter.pypi_username }} - password: - secure: PLEASE_REPLACE_ME - on: - tags: true - repo: {{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }} - python: 3.8 -{%- endif %} diff --git a/{{cookiecutter.project_slug}}/CONTRIBUTING.rst b/{{cookiecutter.project_slug}}/CONTRIBUTING.rst index b0eb583..06bcfbe 100644 --- a/{{cookiecutter.project_slug}}/CONTRIBUTING.rst +++ b/{{cookiecutter.project_slug}}/CONTRIBUTING.rst @@ -102,9 +102,7 @@ Before you submit a pull request, check that it meets these guidelines: 2. If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.rst. -3. The pull request should work for Python 3.5, 3.6, 3.7 and 3.8, and for PyPy. Check - https://travis-ci.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}/pull_requests - and make sure that the tests pass for all supported Python versions. +3. The pull request should work for Python 3.5, 3.6, 3.7, 3.8, 3.9 and PyPy. Tips ---- @@ -127,5 +125,3 @@ Then run:: $ bump2version patch # possible: major / minor / patch $ git push $ git push --tags - -Travis will then deploy to PyPI if tests pass.