|
| 1 | +Quickstart Guide |
| 2 | +================ |
| 3 | + |
| 4 | +Requirements |
| 5 | +------------ |
| 6 | + |
| 7 | +Install Cookiecutter_: |
| 8 | + |
| 9 | +.. code:: console |
| 10 | +
|
| 11 | + $ pipx install cookiecutter |
| 12 | +
|
| 13 | +Install Poetry_ by downloading and running get-poetry.py_: |
| 14 | + |
| 15 | +.. _`get-poetry.py`: https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py |
| 16 | + |
| 17 | +.. code:: console |
| 18 | +
|
| 19 | + $ python get-poetry.py |
| 20 | +
|
| 21 | +Install Nox_: |
| 22 | + |
| 23 | +.. code:: console |
| 24 | +
|
| 25 | + $ pipx install nox |
| 26 | +
|
| 27 | +pipx_ is preferred, |
| 28 | +but you can also install with ``pip install --user``. |
| 29 | + |
| 30 | +It is recommended to set up Python 3.6, 3.7, and 3.8 using pyenv_. |
| 31 | + |
| 32 | + |
| 33 | +Creating a project |
| 34 | +------------------ |
| 35 | + |
| 36 | +Generate a Python project: |
| 37 | + |
| 38 | +.. code:: console |
| 39 | +
|
| 40 | + $ cookiecutter gh:cjolowicz/cookiecutter-hypermodern-python \ |
| 41 | + --checkout="2020.3.27" |
| 42 | +
|
| 43 | +Change to the root directory of your new project, |
| 44 | +and create a Git repository: |
| 45 | + |
| 46 | +.. code:: console |
| 47 | +
|
| 48 | + $ git init |
| 49 | + $ git add . |
| 50 | + $ git commit |
| 51 | +
|
| 52 | +Local testing |
| 53 | +------------- |
| 54 | + |
| 55 | +Run the full test suite: |
| 56 | + |
| 57 | +.. code:: console |
| 58 | +
|
| 59 | + $ nox |
| 60 | +
|
| 61 | +List the available Nox sessions: |
| 62 | + |
| 63 | +.. code:: console |
| 64 | +
|
| 65 | + $ nox --list-sessions |
| 66 | +
|
| 67 | +
|
| 68 | +Continuous Integration |
| 69 | +---------------------- |
| 70 | + |
| 71 | +GitHub |
| 72 | +~~~~~~ |
| 73 | + |
| 74 | +1. Sign up at GitHub_. |
| 75 | +2. Create an empty repository for your project. |
| 76 | +3. Follow the instructions to push an existing repository from the command line. |
| 77 | + |
| 78 | + |
| 79 | +PyPI |
| 80 | +~~~~ |
| 81 | + |
| 82 | +1. Sign up at PyPI_. |
| 83 | +2. Go to the Account Settings on PyPI, |
| 84 | + generate an API token, and copy it. |
| 85 | +3. Go to the repository settings on GitHub, and |
| 86 | + add a secret named ``PYPI_TOKEN`` with the token you just copied. |
| 87 | + |
| 88 | + |
| 89 | +TestPyPI |
| 90 | +~~~~~~~~ |
| 91 | + |
| 92 | +1. Sign up at TestPyPI_. |
| 93 | +2. Go to the Account Settings on TestPyPI, |
| 94 | + generate an API token, and copy it. |
| 95 | +3. Go to the repository settings on GitHub, and |
| 96 | + add a secret named ``TEST_PYPI_TOKEN`` with the token you just copied. |
| 97 | + |
| 98 | + |
| 99 | +Codecov |
| 100 | +~~~~~~~ |
| 101 | + |
| 102 | +1. Sign up at Codecov_, and install their GitHub app. |
| 103 | +2. Add your repository to Codecov. |
| 104 | + |
| 105 | + |
| 106 | +Read the Docs |
| 107 | +~~~~~~~~~~~~~ |
| 108 | + |
| 109 | +1. Sign up at `Read the Docs`_. |
| 110 | +2. Import your GitHub repository, using the button *Import a Project*. |
| 111 | + |
| 112 | + |
| 113 | +Releasing |
| 114 | +--------- |
| 115 | + |
| 116 | +1. Bump the version using `poetry version`_. Push to GitHub. |
| 117 | +2. Publish a GitHub Release. |
| 118 | +3. GitHub Action triggers the PyPI upload. |
| 119 | + |
| 120 | +.. _`poetry version`: https://python-poetry.org/docs/cli/#version |
| 121 | + |
| 122 | +Release notes are pre-filled with titles and authors of merged pull requests. |
| 123 | + |
| 124 | +Use labels to group the pull requests into sections: |
| 125 | + |
| 126 | +.. include:: guide.rst |
| 127 | + :start-after: table-release-drafter-sections-begin |
| 128 | + :end-before: table-release-drafter-sections-end |
| 129 | + |
| 130 | +GitHub creates the ``bug``, ``enhancement``, and ``documentation`` labels for you. |
| 131 | +Create the remaining labels on the Issues tab of your GitHub repository. |
| 132 | + |
| 133 | + |
| 134 | +Caveats |
| 135 | +------- |
| 136 | + |
| 137 | +When upgrading Sphinx or its extensions using Poetry, |
| 138 | +also update the requirements located in ``docs/requirements.txt`` for Read the Docs. |
| 139 | + |
| 140 | +.. include:: guide.rst |
| 141 | + :start-after: references-begin |
| 142 | + :end-before: references-end |
0 commit comments