You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Upload from the local machine (not recommended)
124
-
125
-
[twine](https://twine.readthedocs.io/en/stable/) allows to upload a package
126
-
from your local machine to PyPI.
127
-
128
-
### Prerequisites
129
-
130
-
You need a PyPI API token. See prerequisites for the Github actions above
131
-
(you don't need to perform any actions on Github when using twine, so you
132
-
only need to perform step 1).
133
-
134
-
### Configuration
135
-
136
-
The PyPI credentials must be configured either via a configuration file
137
-
or via environment variables.
138
-
See the [twine documentation](https://twine.readthedocs.io/en/stable/#configuration)
139
-
for details.
140
-
141
-
Since we are using an api token to authenticate with PyPI, the username
142
-
must be set to `__token__`, and the password is the actual token.
143
-
144
-
When using the PyPI test server, the repository url must be set to
145
-
`https://test.pypi.org/legacy/`.
146
-
147
-
### Usage
148
-
149
-
The `publish` target in the [Makefile](Makefile) calls twine to upload
150
-
a package to PyPI.
151
-
152
-
**Note:** the upload command is deactivated by default to prevent accidental
153
-
uploads. You need to manually uncomment it before the first release.
154
-
155
-
Here are the necessary steps:
156
-
157
-
1. update the version number in the [pyproject.toml](pyproject.toml)
158
-
2. run `make publish`.
159
-
160
123
161
124
# Using a custom package repository
162
125
@@ -172,27 +135,6 @@ To release to a server other than the standard PyPI, you need to specify the res
172
135
repository URL when uploading.
173
136
174
137
175
-
### Releasing to a custom repo with twine
176
-
177
-
With twine, you can specify the repository URL via the `--repository-url` parameter.
178
-
179
-
In the special case of the PyPI Test server, you can also specify
180
-
`--repository testpypi`.
181
-
182
-
```bash
183
-
# for Test PyPI
184
-
twine upload --repository testpypi dist/*
185
-
186
-
# for any custom repository
187
-
twine upload --repository-url <URL> dist/*
188
-
```
189
-
190
-
In the context of this project, you can modify the `publish` target in the
191
-
[Makefile](Makefile).
192
-
193
-
See also [Using TestPyPI](https://packaging.python.org/en/latest/guides/using-testpypi/).
194
-
195
-
196
138
### Releasing to a custom repo with Github actions
197
139
198
140
To release to a custom repo with Github actions, you can follow the same process
@@ -210,7 +152,8 @@ as described above for the default PyPI. The only necessary change is adding a
210
152
repository_url: https://test.pypi.org/legacy/
211
153
```
212
154
213
-
For use with Test PyPI you need an account and an API token from [test.pypi.org](https://test.pypi.org). Note that in the example above, that token is assumed to
155
+
For use with Test PyPI you need an account and an API token from [test.pypi.org](https://test.pypi.org).
156
+
Note that in the example above, that token is assumed to
214
157
be stored in the `TEST_PYPI_API_TOKEN` secret in Github.
215
158
216
159
See also [Advanced release management](https://github.com/marketplace/actions/pypi-publish#advanced-release-management)
0 commit comments