Skip to content

Commit 6e87ecc

Browse files
Jonathanlyjwkliao
authored andcommitted
add notes about packaging and testpypi publishing
1 parent 46dc7a0 commit 6e87ecc

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

DEVELOPER_NOTES.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,33 @@
11
## Notes for PnetCDF-python developers
22
---
3-
### Note on python library packaging
3+
### Library packaging and publishing
4+
* Packaging: build source distribution and wheel distribution (optional)
5+
1. Create virtual env and install PnetCDF-C and all python dependencies as developer installation
6+
2. Update version number, cd to repo directory and generate distribution:
7+
```
8+
python3 -m pip install --upgrade build twine
9+
```
10+
```
11+
CC=/path/to/mpicc PNETCDF_DIR=/path/to/pnetcdf/dir python3 -m build
12+
```
13+
* Publish on [TestPyPI](https://packaging.python.org/en/latest/guides/using-testpypi/) for testing
14+
1. Create TestPyPI account and update `.pypirc` as instruction
15+
2. Publish source distribution on TestPyPI
16+
```
17+
python3 -m pip install --upgrade build twine
18+
```
19+
```
20+
python3 -m twine upload --repository testpypi dist/pnetcdf-x.x.x.tar.gz
21+
```
22+
3. Create and activate a new vanilla python env for testing. Make sure PnetCDF-C and mpich is 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.
23+
```
24+
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
25+
```
26+
27+
4. Run test programs
28+
29+
30+
### Library installation
431
* Quick install
532
* Currently, quick install via `pip install pnetcdf` is disabled. Main challenge is that build distribution (using wheels) is platform-specific and multiple wheels need to be generated to cover all mainstream platforms. A working source distribution for `pip install` is easier and has been tested on PyPI (works for all platforms but still needs MPI and PnetCDF-C installation)
633
* `MANIFEST.in` controls files to be included in source distribution (sdist), which will be eventually uploaded to PyPI if we enables quick install in the future. After modifications to `MANIFEST.IN` file, here are steps to check if the files included are valid to build the library.
@@ -39,6 +66,7 @@
3966
* `dependencies` defines python libraries required for running the project and will first check if requirement already satisfied in current environment before installing the latest qualified version of the library.
4067
* `requires` defines libraries required for building the project. `pip install` by default creates and uses isolated building env for building stage which completely ignores current user env. For example, if user already installed mpi4py==3.1.6, "mpi4py>=3.1.4" will still automatically install a mpi4py 4.0.0 in the building env and thereafter use syntax from 4.0.0 to build pnetcdf-python. This caused version mismatch issues between building and running envs when numpy 2.0 and mpi4py 4.0.0 are released. To address this issue, current user guide forces to use current python env for building stage by adding ` -no-build-isolation` arg to `pip install` command.
4168
69+
4270
### Note on configuring Read the Docs tool for user guide generation
4371
* Read the Docs settings
4472
* User guide is automatically generated on main branch changes and opened PR requests. Modify this in Read the Docs dashboard if needed

0 commit comments

Comments
 (0)