-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotes.txt
254 lines (180 loc) · 8.45 KB
/
notes.txt
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
= Fresh Install
== Install Xcode/git, brew
# xcode-select --install
# git status
# /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
== Install Multiple Versions of Python
ref: http://blog.pinaxproject.com/2015/12/08/how-test-against-multiple-python-versions-parallel/
# brew install pyenv pyenv-virtualenv pyenv-virtualenvwrapper zlib
^-- Based on output, I now have:
$ cat ~/.bash_profile
# from `brew install pyenv pyenv-virtualenv pyenv-virtualenvwrapper`
## for openssl
export PATH="/usr/local/opt/openssl/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"
## for readline
export LDFLAGS="-L/usr/local/opt/readline/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
export PKG_CONFIG_PATH="/usr/local/opt/readline/lib/pkgconfig"
## for pyenv-virtualenv-init
if which pyenv-virtualenv-init > /dev/null; then eval "$(pyenv virtualenv-init -)"; fi
## for zlib
export LDFLAGS="-L/usr/local/opt/zlib/lib"
export CPPFLAGS="-I/usr/local/opt/zlib/include"
export PKG_CONFIG_PATH="/usr/local/opt/zlib/lib/pkgconfig"
## for pyenv (ref: https://github.com/pyenv/pyenv)
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
fi
# pyenv install --list
# pyenv versions
# pyenv version
for each version of interest:
# pyenv install <version>
# pyenv install 3.7.2
# pyenv install 3.6.8
# pyenv install 3.5.6
# pyenv install 3.4.9
# pyenv install 2.7.10
# pyenv versions
# pyenv version
# pyenv global 3.7.2
^-- this creates the ~/.pyenv/version file
# pyenv version:
3.7.2 (set by /Users/kent/.pyenv/version)
In the ~/xiax/ directory:
# pyenv local 3.7.2 3.6.8 3.5.6 3.4.9 2.7.10
^-- this creates the .python-version file
# pyenv version
3.7.2 (set by <snip>/GitHub/kwatsen/xiax/.python-version)
3.6.8 (set by <snip>/GitHub/kwatsen/xiax/.python-version)
3.5.6 (set by <snip>/GitHub/kwatsen/xiax/.python-version)
3.4.9 (set by <snip>/GitHub/kwatsen/xiax/.python-version)
2.7.10 (set by <snip>/GitHub/kwatsen/xiax/.python-version)
== Run Tests
In my home (~/) directory:
# which detox (no output)
# which tox (no output)
# pip install --user detox
The script virtualenv is installed in '/Users/kent/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
The scripts tox and tox-quickstart are installed in '/Users/kent/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
The script detox is installed in '/Users/kent/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
# which detox (no output)
# which tox (no output)
Note: comments above discuss adding stuff to path.
I thought (from before) that this would help, but it didn't:
Ref: https://pypi.org/project/tox-pyenv/)
# pip install --user tox-pyenv
// THE OUTPUT JUST SAID THAT EVERYTHING WAS ALREADY INSTALLED
# which detox (no output)
# which tox (no output)
Okay, adding paths to PATH:
# echo '' >> ~/.bash_profile
# echo '## for tox, detox, and virtualenv' >> ~/.bash_profile
# echo 'export PATH="/Users/kent/.local/bin:$PATH"' >> ~/.bash_profile
Opening a new shell:
# which detox
/Users/kent/.local/bin/detox
# which tox
/Users/kent/.local/bin/tox
Now, in "xiax" directory: (where the .python-version file is located)
# tox (sequential) [NOTE: first time takes awhile as it needs to build the ~/xiax/.tox/py<ver> dirs]
# detox (parallel)
OR PICK JUST ONE:
# tox -e <env> (e.g., tox -e py35)
== if installing new dependency (e.g., lxml), force recreation of the virtual environment:
ref: https://tox.readthedocs.io/en/latest/example/basic.html#forcing-re-creation-of-virtual-environments
# tox --recreate -e py37
# tox --recreate -e py36
# etc.
== install pytest (tox didn't need it?)
# pip install --user pytest (this works)
# pip install -U pytest (not sure if this is needed at all, also doesn't seem to work...)
Hmmm, maybe "install" it?
# python setup.py sdist
# python setup.py test
# python setup.py develop|install
^-- ref: https://docs.pytest.org/en/latest/goodpractices.html
^-- SHOULD HAVE USED `pip install -e .` ???
^-- "develop" creates symlinks & /Users/kent/.pyenv/versions/3.7.2/bin/xiax
# /Users/kent/.pyenv/versions/3.7.2/bin/xiax -s foo WORKS!
# pytest (WORKS NOW ALSO)
# cat ~/.pypirc
From: http://www.discoversdk.com/blog/how-to-create-a-new-python-module
Publish to PyPi (these worked! w/ ~/.pypirc)
- pip install --user twine
- twine upload dist/* -r testpypi
- twine upload dist/*
WHAT ABOUT THE UploadCommand in setup.py?????????
From https://blog.jetbrains.com/pycharm/2017/05/how-to-publish-your-package-on-pypi/
# AH-HA! No need to register via command-line now, just upload now... (after registering via web)
HTTPError: 410 Client Error: Project pre-registration is no longer required or
supported, upload your files instead. for url: https://test.pypi.org/legacy/
TOX (still NOT WORKING)
- https://docs.pytest.org/en/latest/goodpractices.html
- https://blog.ionelmc.ro/2014/05/25/python-packaging
^-- claims that `python setup.py test` is a FAILED EXPERIMENT
Matplotlib screwed my env up:
- don't know when I used these commands (stashing them here for now)
# rm /Users/kent/.pyenv/versions/py37
# rm -rf /Users/kent/.pyenv/versions/3.7.2/envs/py37/
- I'd previously used (what worked before, albeit it wiped out `tox -e py37`
# env PYTHON_CONFIGURE_OPTS="--enable-framework CC=clang" pyenv install 3.7.2
- Reinstalling fixes xiax tox -e py37
# pyenv install 3.7.2
# tox -e py37 (PASSES!)
- But, of course, now yang-next/analyze-issues.py is broken again...
- Trying to install "framework" in a different venv...
# env PYTHON_CONFIGURE_OPTS="--enable-framework CC=clang" pyenv virtualenv 3.7.2 py37-framework
- okay, it shows up in `pyenv versions`, but framework error still shows...
- try to set "local" venv:
# pyenv local py37-framework
- command accepted, now complaining about missing packages...
(inside *that* window!)
# pip install --user numpy
- didn't work, maybe w/o the "--user"?
# pip install numpy
- yes, this worked!
# pip install PyGithub
# pip install matplotlib
- darnit, back to the framework error again!
- this didn't work either:
# /Users/kent/.pyenv/versions/py37-framework/bin/python analyze-issues.py
- reset, removing "local: venv
# rm -rf .python-version
- these still fail:
# python ./analyze-issues.py
# /Users/kent/.pyenv/versions/py37-framework/bin/python analyze-issues.py
- try venv?
# python3.7 -m venv ./myenv
# source ./myenv/bin/activate
# pip install numpy
# pip install PyGithub
# pip install matplotlib
# python ./analyze-issues.py
- darnit, back to the framework error again!
# deactivate
# rm -rf ./myenv
# env PYTHON_CONFIGURE_OPTS="--enable-framework CC=clang" python3.7 -m venv ./myenv
# source ./myenv/bin/activate
# pip install numpy PyGithub matplotlib
# python ./analyze-issues.py
- darnit, back to the framework error again!
- how about relaying on MacOS native?
# deactivate
# PATH=/usr/local/opt/openssl/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
# sudo easy_install pip
# pip install --user numpy PyGithub matplotlib
- DANGER: many people suggest this:
# sudo pip install -U matplotlib (I haven't tried this yet)
- Another idea, how about installing *3.7.1* as framework (diff ver shouldn't conflict, right?)
# env PYTHON_CONFIGURE_OPTS="--enable-framework CC=clang" pyenv install 3.7.1
# pyenv local 3.7.1
# python ./analyze-issues.py
^-- it works!!! (and `tox` too)
^-- and I didn't even have to: pip install numpy PyGithub matplotlib (weird)