forked from spacepy/spacepy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDISTRIBUTE
152 lines (105 loc) · 5.06 KB
/
DISTRIBUTE
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
Building spacepy for distribution (20191002)
============================================
Since this has to happen on multiple platforms, a single script doesn't work.
Prepare the release commit
--------------------------
Note: it's probably best to get the latest up on test PyPI first to
make sure it works!
Edit the CHANGELOG to include the release date.
Edit Doc/source/conf.py. Around line 128, remove (DRAFT) from the title.
Change version around line 72 (two places!)
Change version in setup.py, in setup_kwargs near bottom.
Change __version__ around line 136 of __init__.py.
Commit these changes. Submit PR. (Tagging is done on github now.)
Prepare the source build
------------------------
On a Unix machine:
check out the latest from git (hopefully the release commit!)
Build and install so you're getting the latest inputs for the autodocs. Then:
python setup.py sdist --formats=gztar,zip
Tarball and zip are in the dist directory.
Note: building the source distribution will build the docs, but no longer needs
to do a binary build.
Prepare the Windows binaries
----------------------------
Unzip the source distribution from the Unix side. Get the Windows
build scripts from the repository. They're in developer/scripts but
are not included in the source distribution. They need to be put in
developer/scripts in the unzipped source so they can find the rest of
SpacePy. Yes this could be improved.
Download latest (currently 3.7) 64-bit Miniconda from
https://docs.conda.io/en/latest/miniconda.html and put it in the
system-default download directory (%USERPROFILE%\Downloads)
Run win_build_system_setup.cmd, build_win.cmd, and
win_build_system_teardown.cmd. Windows binaries and wheels will be in
the "dist" directory of the SpacePy distribution.
The wheels are compliant with metadata 2.0 but are labeled as 2.1, which makes for problems unless everybody has the very newest version of everything. For now, we should edit them.
for i in *.whl; do unzip $i "spacepy-*.dist-info/METADATA"; sed -i -e "s/Metadata-Version: 2.1/Metadata-Version: 2.0/" spacepy-*.dist-info/METADATA; zip $i "spacepy-*.dist-info/METADATA"; rm -rf spacepy-*.dist-info; done
Docs
----
From the Doc directory:
cp build/latex/SpacePy.pdf spacepy-x.y.z-doc.pdf
cd build/html
zip -r ../../spacepy-0.2.1-doc.zip *
Test PyPI
---------
https://packaging.python.org/guides/using-testpypi/
Consider https://www.python.org/dev/peps/pep-0440/#pre-releases
Make a .pypirc file, see https://docs.python.org/3.3/distutils/packageindex.html
[distutils]
index-servers =
pypi
testpypi
[pypi]
username: <username>
[testpypi]
repository: https://test.pypi.org/legacy
username: <username>
(end of .pypirc)
Put all the builds (wheels, source dists, not the docs) into one directory and:
twine upload -r testpypi spacepy-*.zip spacepy-*.whl
PyPI does not support Windows standalone installers.
Test installing with:
pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ spacepy
Do this on Windows without compilers installed, and in a clean Linux
Anaconda env.
Release to PyPI
---------------
https://python-packaging-tutorial.readthedocs.io/en/latest/uploading_pypi.html
twine upload spacepy-*.zip spacepy-*.whl
Do not upload the .tar.gz since can only upload one source package per release.
There's no longer any capability to edit information on PyPI, it's
straight from the setup.py metadata. This may cause problems with the
fact that we're CamelCase on PyPI...
Release to github
-----------------
https://help.github.com/en/articles/creating-releases
On the code tab, click on "n releases" (between branches and
contributors). Click "Draft a new release." Make the tag
"release-x.y.z" and hopefully the target will be master if it's up to
date. The most consistent with what we've done so far (which is not
necessarily the best) is to use just "x.y.z" as the title with nothing
the "describe."
Click in the "upload binaries" area and upload all the files: source
distribution, Windows installers, wheels. Also upload the
documentation PDF (spacepy-x.y.z-doc.pdf) and a zip
(spacepy-x.y.z-doc.zip).
Documentation update
--------------------
Check out the spacepy.github.io repository. Right now the root of the
repo is basically the root of the Doc/build/html output. Copy all the
freshly-built docs there, commit, submit PR.
Relevant notes
--------------
Reference that have been useful for putting the wheels together (this
can eventually be captured elsewhere.)
https://www.python.org/dev/peps/pep-0427/
https://pip.pypa.io/en/stable/reference/pip_wheel/
https://docs.python.org/2/library/sysconfig.html#installation-paths
https://github.com/dask/hdfs3/issues/113
https://python-packaging-tutorial.readthedocs.io/en/latest/uploading_pypi.html
https://packaging.python.org/tutorials/packaging-projects/
Wheel is a separate package but seems to be included with
miniconda. (It's not just pip or setuptools, but it might be a
requirement for pip? Although not installed on Linux with pip.)
https://stackoverflow.com/questions/45150304/how-to-force-a-python-wheel-to-be-platform-specific-when-building-it