-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpublishing_to_PyPI_workflow.txt
More file actions
168 lines (130 loc) · 4.85 KB
/
publishing_to_PyPI_workflow.txt
File metadata and controls
168 lines (130 loc) · 4.85 KB
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
UPDATE SPRINGABLE VERSION AND PUBLISHING TO PYPI
* set DEBUG in gui_settings to False
* update springable package __init__ file (src/springable/__init__.py): change variable __version__
* update _readme_no_toc.md. Copy-paste text to https://bitdowntoc.derlin.ch/ --> Copy-paste output text to README.md
* update pyproject.toml: change springable version
* to exclude packages (not modules): in pyproject.toml
[tool.setuptools.packages.find]
where = ["src"]
exclude = ["springable.my_package_to_exclude"]
* to exclude modules (.py files): in MANIFEST.in
exclude src/springable/my_module_to_exclude.py
* to include data files:
in pyproject.toml:
[tool.setuptools]
include-package-data = true
in MANIFEST.in:
include src/springable/examples-spring-model-CSV-files/*.csv
include src/springable/gallery-spring-model-CSV-files/*.csv
* commit and push
* python packages build and twine must be installed in the developer environment
(venv) $ python -m pip install build twine
* create a source archive and a wheel
(venv) $ python -m build
--> a dist directory must be have been created in the main directory.
It must contain the wheel .whl and the archive .tar.gz
* To confirm the package has been built correctly
Window PowerShell
(venv) PS> cd .\dist
(venv) PS> Copy-Item .\xxx.whl yyy.zip
(venv) PS> Expand-Archive yyy.zip
(venv) PS> tree .\yyy\ /F
You should get something like this
───springable
│ │ behavior_creation.py
│ │ simulation.py
│ │ visualization.py
│ │ __init__.py
│ │
│ ├───graphics
│ │ │ animation.py
│ │ │ default_graphics_settings.py
│ │ │ drawing.py
│ │ │ plot.py
│ │ │ visual_helpers.py
│ │ │ __init__.py
│ │ │
│ │ └───figure_utils
│ │ figure_formatting.py
│ │ __init__.py
│ │
│ ├───gui
│ │ control_panel_interface.py
│ │ drawing_interface.py
│ │ gui_event_handler.py
│ │ gui_settings.py
│ │ gui_utils.py
│ │ start_behavior_creation_app.py
│ │ __init__.py
│ │
│ ├───mechanics
│ │ │ assembly.py
│ │ │ element.py
│ │ │ load.py
│ │ │ mechanical_behavior.py
│ │ │ model.py
│ │ │ node.py
│ │ │ shape.py
│ │ │ static_solver.py
│ │ │ __init__.py
│ │ │
│ │ └───math_utils
│ │ bezier_curve.py
│ │ smooth_zigzag_curve.py
│ │ __init__.py
│ │
│ └───readwrite
│ fileio.py
│ interpreting.py
│ keywordmapping.py
│ keywords.py
│ simpleeval.py
│ __init__.py
│
└───springable-0.1.0.dist-info
LICENSE
METADATA
RECORD
top_level.txt
WHEEL
* check if the wheel and archive can be rendered by PyPI using twine
(venv) $ twine check dist/*
both .tar.gz and .whl should be tagged with 'Passed' in the output
(for the .zip archive, it will be tagged with 'ERROR'. Not a problem, it is not used by PyPI))
* upload to TestPyPI to check whether everything works properly (delete the .zip and expanded zip beforehand)
(venv) $ twine upload -r testpypi dist/*
--> View at: https://test.pypi.org/project/springable/a.b.c/
* make a new, fresh python virtual enviroment and activate it
python -m venv new_venv
new_venv\Scripts\activate
* install springable from testPyPI using
(new_venv) python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple springable
* check whether it was installed properly and check to see if simulations can be runned properly, etc
(new_venv) python
>>> import springable
>>> help(springable)
Help on package springable:
NAME
springable
DESCRIPTION
This is
_ _ _
(_) | | | |
___ _ __ _ __ _ _ __ __ _ __ _| |__ | | ___
/ __| '_ \| '__| | '_ \ / _` |/ _` | '_ \| |/ _ \
\__ \ |_) | | | | | | | (_| | (_| | |_) | | __/
|___/ .__/|_| |_|_| |_|\__, |\__,_|_.__/|_|\___|
| | __/ |
|_| |___/
springable -- explore the richness of nonlinear mechanics with simple springs!
Code: https://github.com/ducarme/springable
Documentation: https://ducarme.github.io/springable/
Releases: https://pypi.org/project/springable/
Paul Ducarme, 2024-2025
...
* if everything ok, upload to PyPI
>>> twine upload dist/*
useful resources:
[1] https://realpython.com/pypi-publish-python-package/
[2] https://stackoverflow.com/questions/34514703/pip-install-from-pypi-works-but-from-testpypi-fails-cannot-find-requirements
[3] https://setuptools.pypa.io/en/latest/userguide/datafiles.html