Skip to content

Commit 69240cb

Browse files
authored
Added packaging and publishing details to DEVELOPER_NOTES.md
1 parent d8288bb commit 69240cb

File tree

1 file changed

+32
-9
lines changed

1 file changed

+32
-9
lines changed

docs/DEVELOPER_NOTES.md

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,30 +59,52 @@ Below is a list of tasks to be done immediately before making a new release
5959
---
6060
### Library Packaging And Publishing
6161
* Currently, pip-install via build distribution is disabled. No wheel files are uploaded to PyPI. Lastest pnetcdf-python package on PyPI: https://pypi.org/project/pnetcdf/
62-
* Packaging: build source distribution and wheel distribution
63-
1. Create virtual env and install PnetCDF-C and all python dependencies as developer installation
64-
2. Update version number, cd to repo directory and generate distribution:
62+
* Packaging: build source distribution and wheel distribution on a local machine following the steps
63+
1. Make sure a python virtual env is created and install PnetCDF-C and all python dependencies as developer installation
6564
```
65+
python -m venv env
66+
source env/bin/activate
67+
pip install --upgrade pip setuptools wheel packaging
68+
pip install numpy Cython
69+
CC=/path/to/mpicc pip install mpi4py
70+
```
71+
2. Download the release tarball as shown in the following example
72+
```
73+
wget https://github.com/Parallel-NetCDF/PnetCDF-Python/archive/refs/tags/v.1.0.0.pre.tar.gz
74+
tar -xfv v.1.0.0.pre.tar.gz
75+
cd PnetCDF-Python
6676
python3 -m pip install --upgrade build twine
6777
```
78+
3. Build the package and generate distribution.
6879
6980
```
7081
CC=/path/to/mpicc PNETCDF_DIR=/path/to/pnetcdf/dir python3 -m build
7182
```
72-
* (Recommended) publish on [TestPyPI](https://packaging.python.org/en/latest/guides/using-testpypi/) for testing. Only upload source distribution archive, as the wheel file (dist/pncpy-x.x.x*.whl) works exclusively for your own system and python version.
73-
1. Create TestPyPI account and update `.pypirc` per instruction
83+
A successful run of this command will generate 2 new files: `dist/pnetcdf-x.x.x.tar.gz` and `dist/pnetcdf-x.x.x-cp39-cp39-linux_x86_64.whl`
84+
85+
* For testing purpose: publish on [TestPyPI](https://packaging.python.org/en/latest/guides/using-testpypi/). Only upload source distribution archive, since the wheel file (dist/pncpy-x.x.x*.whl) works exclusively for your own system and python version and not useful for users.
86+
1. Create TestPyPI account and update `$HOME/.pypirc` on local machine to skip cresendentials
7487
2. Publish source distribution on TestPyPI
7588
```
7689
python3 -m twine upload --repository testpypi dist/pnetcdf-x.x.x.tar.gz
7790
```
78-
3. Create and activate a new vanilla python env for testing. Make sure PnetCDF-C and mpich are installed. Then quick install via the distribution on TestPyPI (no python dependencies required). Note that `-i` redirects pip-install to search pnetcdf-python in testpypi index and `--extra-index-url` redirects pip-install to search dependency libraries (e.g. numpy) in official pypi index.
91+
The commmand will first check if there exists same package name and version number and error out if there exists. After uploading, open your browser, go to `https://test.pypi.org/` and search package name: `pnetcdf` to verify.
92+
3. Next we need to test the uploaded distribution on a local machine
93+
* Need to create a new empty folder. E.g. `mkdir pypi_test`
94+
* Create and activate a new vanilla python env for testing. Make sure PnetCDF-C and mpich are installed. This env shouldn't be the same env used in developer install. i.e. the enviroment does not contain any pre-installed pnetcdf python library
95+
```
96+
python -m venv testenv
97+
source env/bin/activate
98+
```
99+
* Then quick install via the distribution on TestPyPI (no python dependencies required). Note that `-i` redirects pip-install to search pnetcdf-python in testpypi index and `--extra-index-url` redirects pip-install to search dependency libraries (e.g. numpy) in official pypi index.
79100
```
80101
CC=/path/to/mpicc PNETCDF_DIR=/path/to/pnetcdf/dir pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple pnetcdf==x.x.x
81102
```
82-
4. Run pnetcdf-python test programs
103+
This command will download the package from testpypi and install pnetcdf library in the current env
104+
5. Run pnetcdf-python test programs. For example, using the test programs under `https://github.com/Parallel-NetCDF/PnetCDF-Python/tree/main/examples`
83105
84-
* Officially publish on [PyPI](https://pypi.org/) for testing
85-
1. Create TestPyPI account and update `.pypirc` per instruction
106+
* Officially publish on [PyPI](https://pypi.org/) WARNING: after upload to pypi, we cannot overwrite or change the published package!
107+
1. Create PyPI account and update `.pypirc` per instruction
86108
2. Publish source distribution on PyPI
87109
```
88110
python3 -m twine upload dist/pnetcdf-x.x.x.tar.gz
@@ -91,6 +113,7 @@ Below is a list of tasks to be done immediately before making a new release
91113
```
92114
CC=/path/to/mpicc PNETCDF_DIR=/path/to/pnetcdf/dir pip install pnetcdf
93115
```
116+
4. To verify the official publishing of latest pnetcdf verion, open the browser and go to `https://pypi.org/project/pnetcdf/` to check the latest release.
94117
95118
96119
### Library installation

0 commit comments

Comments
 (0)