|
10 | 10 |
|
11 | 11 | The link in this tutorial will explain the steps to upload a package to pypi: <https://dzone.com/articles/executable-package-pip-install> |
12 | 12 |
|
13 | | -#### Get started with Travis CI |
14 | | - |
15 | | -1. Sing up on Travis-ci with GitHub. |
16 | | - |
17 | | -2. Accept the authorization of Travis CI. |
18 | | - |
19 | | -3. Click on your profile picture in the top right of your Travis Dashboard, |
20 | | - click the green Activate button, and select the repositories |
21 | | - you want to use with Travis CI. |
22 | | - |
23 | | -4. Add a .travis.yml file to your repository to tell Travis CI what to do. |
24 | | - |
25 | | -#### Use the .travis.yml file to configure your deploy |
26 | | - |
27 | | -5. Create an API token to authenticate with PyPI: |
28 | | - 1. In your Pypi account settings, go to API tokens section and |
29 | | - select "Add API token" |
30 | | - |
31 | | - 2. Add the token to the Github Actions Secret. |
32 | | - |
33 | | -6. Create a github action with the following content: |
34 | | - ```yaml |
35 | | - name: Publish to PyPI |
36 | | - on: |
37 | | - push: |
38 | | - tags: |
39 | | - - "*" |
40 | | - |
41 | | - jobs: |
42 | | - build-n-publish: |
43 | | - if: github.event.base_ref == 'refs/heads/<branch-for-deploy>' && startsWith(github.ref, 'refs/tags') |
44 | | - name: Build and publish package |
45 | | - runs-on: ubuntu-latest |
46 | | - steps: |
47 | | - - uses: actions/checkout@v2 |
48 | | - - name: Set up Python 3.6 |
49 | | - uses: actions/setup-python@v2 |
50 | | - with: |
51 | | - python-version: 3.6 |
52 | | - - name: Install dependencies |
53 | | - run: | |
54 | | - python -m pip install --upgrade "pip<20" |
55 | | - pip install -r requirements-dev.txt |
56 | | - - name: <optional step to lint and test the code> |
57 | | - run: | |
58 | | - flake8 |
59 | | - pytest |
60 | | - - name: Build |
61 | | - run: | |
62 | | - pip install setuptools wheel twine |
63 | | - python setup.py sdist bdist_wheel |
64 | | - - name: Publish |
65 | | - uses: pypa/gh-action-pypi-publish@master |
66 | | - with: |
67 | | - user: __token__ |
68 | | - password: ${{ secrets.pypi_password }} |
69 | | - ``` |
| 13 | +#### Use Github Actions to deploy |
| 14 | + |
| 15 | +1. Create an API token to authenticate with PyPI: |
| 16 | + - In your Pypi account settings, go to API tokens section and select "Add API token" |
| 17 | + |
| 18 | + - Add the token to the Github Actions Secret. |
| 19 | + |
| 20 | +2. Create a github workflow with the following content: |
| 21 | +```yaml |
| 22 | +name: Publish to PyPI |
| 23 | +on: |
| 24 | + push: |
| 25 | + tags: |
| 26 | + - "*" |
| 27 | + |
| 28 | +jobs: |
| 29 | + build-n-publish: |
| 30 | + if: github.event.base_ref == 'refs/heads/<branch-for-deploy>' && startsWith(github.ref, 'refs/tags') |
| 31 | + name: Build and publish package |
| 32 | + runs-on: ubuntu-latest |
| 33 | + steps: |
| 34 | + - uses: actions/checkout@v2 |
| 35 | + - name: Set up Python 3.6 |
| 36 | + uses: actions/setup-python@v2 |
| 37 | + with: |
| 38 | + python-version: 3.6 |
| 39 | + - name: Install dependencies |
| 40 | + run: | |
| 41 | + python -m pip install --upgrade pip |
| 42 | + make dev |
| 43 | + - name: <optional step to lint and test the code> |
| 44 | + run: | |
| 45 | + make lint |
| 46 | + make test |
| 47 | + - name: Build |
| 48 | + run: | |
| 49 | + pip install setuptools wheel twine |
| 50 | + python setup.py sdist bdist_wheel |
| 51 | + - name: Publish |
| 52 | + uses: pypa/gh-action-pypi-publish@master |
| 53 | + with: |
| 54 | + user: __token__ |
| 55 | + password: ${{ secrets.pypi_password }} |
| 56 | +``` |
70 | 57 |
|
71 | 58 | #### Configure bump2version |
72 | 59 |
|
73 | 60 | For the versioning control we a using the package bump2version. |
74 | 61 |
|
75 | 62 | 1. Run `pip install bump2version` in your environment |
76 | | -2. Add the following attributes to the .bumpversion.cfg file: |
77 | | -```yaml |
78 | | - [bumpversion] |
79 | | - current_version = <version_number> |
80 | | - allow_dirty = True |
81 | | - tag_name = version-{new_version} |
82 | | - tag = True |
83 | | - commit = True |
84 | | - [bumpversion:file:<path_to_file_version_file>] |
| 63 | +2. Add the following attributes to the setup.cfg file: |
| 64 | +```conf |
| 65 | +[bumpversion] |
| 66 | +current_version = <version_number> |
| 67 | +allow_dirty = True |
| 68 | +tag_name = version-{new_version} |
| 69 | +tag = True |
| 70 | +commit = True |
| 71 | +[bumpversion:file:<path_to_file_version_file>] |
| 72 | +[bumpversion:file:<path_to_setup_file>] |
85 | 73 | ``` |
86 | 74 |
|
87 | 75 | ***Note:*** If `NotADirectoryError: [Errno 20] Not a directory`, |
88 | 76 | check <https://github.com/c4urself/bump2version/issues/139> for a fix. |
89 | 77 |
|
90 | 78 | #### For more information see these links |
91 | 79 |
|
92 | | -- <https://docs.travis-ci.com/user/tutorial/> |
93 | 80 | - <https://docs.travis-ci.com/user/deployment/pypi/> |
94 | 81 | - <https://github.com/c4urself/bump2version> |
95 | 82 |
|
96 | 83 | --- |
97 | 84 |
|
98 | | -### Deploy the package using Travis CI |
99 | | - |
100 | | -1. Run the command `bumperversion [major|minor|patch]` to increase the |
101 | | - version number. This will create a new tag and commit the changes. |
| 85 | +1. Run the command `bumperversion [major|minor|patch]` to increase the version number. |
| 86 | + This will create a new tag and commit the changes. |
102 | 87 |
|
103 | 88 | 2. Push the changes to the developer branch. |
104 | 89 |
|
105 | 90 | 3. Create a pull request onto master. To deploy pymove to Pypi using |
106 | | - you must be in the master branch, Travis was configured to only allow |
107 | | - deployments from tagged commits on the master branch. |
| 91 | + you must be in the master branch, pushing a tagged commit. |
108 | 92 |
|
109 | 93 | 4. After merging the new version into the master branch, push the new |
110 | 94 | tag created by bump2version. |
@@ -133,76 +117,76 @@ With the package published to Pypi, we can easily deploy to the |
133 | 117 |
|
134 | 118 | 2. Now add some information to the `<package_name>/meta.yaml` file. |
135 | 119 | ```yaml |
136 | | - {% set name = <package_name> %} |
137 | | - {% set version = <package_version> %} |
138 | | -
|
139 | | - package: |
140 | | - name: "{{ name|lower }}" |
141 | | - version: "{{ version }}" |
142 | | -
|
143 | | - source: |
144 | | - url: "https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz" |
145 | | - sha256: <package_version_sha256> |
146 | | -
|
147 | | - build: |
148 | | - number: 0 |
149 | | - script: "{{ PYTHON }} -m pip install . -vv" |
150 | | - noarch: python |
151 | | -
|
152 | | - requirements: |
153 | | - host: |
154 | | - - pip |
155 | | - - python >=3.6 |
156 | | - run: |
157 | | - - <package_requirements> |
158 | | - - python >=3.6 |
159 | | -
|
160 | | - test: |
161 | | - imports: |
162 | | - - <all_possible_imports> |
163 | | -
|
164 | | - about: |
165 | | - home: <repository_url> |
166 | | - license: <licence> |
167 | | - license_family: <licence_family> |
168 | | - license_file: <path_to_licence_file> |
169 | | - summary: <package_summary> |
170 | | - doc_url: <package_docs_url> |
171 | | - dev_url: |
172 | | -
|
173 | | - extra: |
174 | | - recipe-maintainers: |
175 | | - - <your_github_username> |
176 | | - - <other_package_maintainers> |
| 120 | +{% set name = <package_name> %} |
| 121 | +{% set version = <package_version> %} |
| 122 | +
|
| 123 | +package: |
| 124 | + name: "{{ name|lower }}" |
| 125 | + version: "{{ version }}" |
| 126 | +
|
| 127 | +source: |
| 128 | + url: "https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz" |
| 129 | + sha256: <package_version_sha256> |
| 130 | +
|
| 131 | +build: |
| 132 | + number: 0 |
| 133 | + script: "{{ PYTHON }} -m pip install . -vv" |
| 134 | + noarch: python |
| 135 | +
|
| 136 | +requirements: |
| 137 | + host: |
| 138 | + - pip |
| 139 | + - python >=3.6 |
| 140 | + run: |
| 141 | + - <package_requirements> |
| 142 | + - python >=3.6 |
| 143 | +
|
| 144 | +test: |
| 145 | + imports: |
| 146 | + - <all_possible_imports> |
| 147 | +
|
| 148 | +about: |
| 149 | + home: <repository_url> |
| 150 | + license: <licence> |
| 151 | + license_family: <licence_family> |
| 152 | + license_file: <path_to_licence_file> |
| 153 | + summary: <package_summary> |
| 154 | + doc_url: <package_docs_url> |
| 155 | + dev_url: |
| 156 | +
|
| 157 | +extra: |
| 158 | + recipe-maintainers: |
| 159 | + - <your_github_username> |
| 160 | + - <other_package_maintainers> |
177 | 161 | ``` |
178 | 162 |
|
179 | | -1. All package run requirements must be avaiable in the conda-forge channel. |
| 163 | +All package run requirements must be available in the conda-forge channel. |
180 | 164 |
|
181 | 165 | #### Request the publication to the conda-forge channel |
182 | 166 |
|
183 | | -2. Fork the example recipes repository at <https://github.com/conda-forge/staged-recipes> |
| 167 | +1. Fork the example recipes repository at <https://github.com/conda-forge/staged-recipes> |
184 | 168 |
|
185 | | -3. Copy the `<package_name>/meta.yaml` file created in the step above to |
| 169 | +2. Copy the `<package_name>/meta.yaml` file created in the step above to |
186 | 170 | the forked repo `staged-recipes/recipes/example` directory |
187 | 171 |
|
188 | | -4. Push the changes to your forked repository. |
| 172 | +3. Push the changes to your forked repository. |
189 | 173 |
|
190 | | -5. Make a pull request for your repository to the master branch on |
| 174 | +4. Make a pull request for your repository to the master branch on |
191 | 175 | the stage-recipes repository. |
192 | 176 | - `conda-forge:master from <your_github_username>:<package_name>` |
193 | 177 |
|
194 | | -6. Now, the pull request will be checked. |
195 | | - - Comlete the checklist for the pull requests. |
| 178 | +5. Now, the pull request will be checked. |
| 179 | + - Complete the checklist for the pull requests. |
196 | 180 |
|
197 | 181 | - The recipe meta.yaml file will be checked by the `conda-forge-linting service`. |
198 | 182 |
|
199 | 183 | - The recipe will be built for `linux64`, `macos64` |
200 | 184 | and `windows64` systems. |
201 | 185 |
|
202 | | -7. If there are any problems with the PR, a review team member will give |
| 186 | +6. If there are any problems with the PR, a review team member will give |
203 | 187 | you feedback, pointing out improvements and answering questions. |
204 | 188 |
|
205 | | -8. Once everything is in order, the pull request will be aproved. |
| 189 | +7. Once everything is in order, the pull request will be aproved. |
206 | 190 |
|
207 | 191 | --- |
208 | 192 |
|
|
0 commit comments