Skip to content

Commit 5ea1f50

Browse files
committed
[pyproject] simplified distribution setup
1 parent a535200 commit 5ea1f50

File tree

3 files changed

+29
-36
lines changed

3 files changed

+29
-36
lines changed

.github/workflows/python-package.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ jobs:
3131
python -m pip install ruff
3232
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
3333
python -m pip install moarchiving
34+
# flat setup only works when we exclude notebooks* in pyproject.toml
35+
# which then fails to locally discover the src-layout correctly
36+
mkdir src
37+
ln -s ../cma src/cma
3438
python -m pip install . # or install numpy and further dependencies?
3539
- name: Lint with flake8
3640
run: |

pyproject.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
requires = [
1010
"setuptools >=79",
1111
# "setuptools-scm", # if we want to use git versions for versioning
12-
"wheel", # setuptools doesn't need wheel anymore, see https://pypi.org/project/wheel/
12+
# "wheel", # setuptools doesn't need wheel anymore, see https://pypi.org/project/wheel/
1313
]
1414
build-backend = "setuptools.build_meta"
1515

@@ -60,10 +60,11 @@ classifiers = [
6060
# packages = ["cma", "cma.utilities"] # fails when they are in an src/ folder
6161
include-package-data = false # true is default, false doesn't change anything
6262

63-
[tool.setuptools.packages.find] # for where=. works only in a clean folder
64-
# where = ["src"] # this doesn't work, it always takes the root too?
65-
include = ["cma*"]
66-
exclude = ["notebooks*"]
63+
# [tool.setuptools.packages.find] # for where=. works only in a clean folder
64+
# without any directives: finds src folder implying a standard (nonflat) layout
65+
# # where = ["src"] # this doesn't work, it always takes the root too?
66+
# include = ["cma*"] # cma/* ?
67+
# exclude = ["notebooks*"] # , "cma_*" ?
6768

6869
# namespaces = false
6970

setup-howto.py

Lines changed: 19 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -40,27 +40,20 @@
4040
less pydoctor-messages.txt # less +G = check for errors (which are at the end!)
4141
4242
5.
43-
Make and check the distribution from a (usual) dirty code folder ==> install-folder::
43+
Make and check the distribution assuming a clean src/ folder (ln -s ../cma src/cma, was: from a (usual) dirty code folder ==> install-folder)::
4444
45-
./script-prepare-distribution.sh
46-
47-
==>
48-
backup install-folder --move # CAVEAT: not the homebrew tool
49-
mkdir install-folder
50-
backup cma --move # backup is a self-coded minitool
51-
git checkout -- cma
52-
cp -rp cma pyproject.toml LICENSE README.rst install-folder
53-
backup --recover # recover above moved folder (and backup current, just in case)
54-
git tag in-install-folder # mark commit to be the code in install-folder
45+
CAVEAT trouble shooting: remove folders (/bin/rm -r) when they have been created
46+
- ./cma-4.4...
47+
- src/cma.egg-info... (may not be necessary)
48+
- cma.egg-info (may not be necessary)
5549
56-
cd install-folder
5750
python -m build > dist_call_output.txt; less dist_call_output.txt
51+
git tag -f last-build # not sure whether this is useful
5852
59-
twine check dist/*
60-
less +G dist_call_output.txt # errors are shown in the end
53+
twine check dist/* # needs py314
6154
tar -tf dist/cma-4.4.0.tar.gz | tree --fromfile | less
62-
# ==> 5 directories, 36 files, check that the distribution folders are clean
63-
# not really useful anymore as we copy into a clean folder
55+
# ==> 7 directories, 40 files, check that the distribution folders are clean
56+
# was: ==> 5 directories, 36 files, check that the distribution folders are clean
6457
6558
# see https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html#summary
6659
@@ -71,22 +64,16 @@
7164
Draft a release on GitHub: click on releases and then new draft. Use above text added in README.md.
7265
7366
7.b
74-
Upload the distribution in ``install-folder``::
75-
76-
twine upload dist/* # upload everything given the install folder was clean
77-
78-
# optional, before the above: test upload:
79-
cd .. # back to src
80-
backup test-install-folder # not really necessary
81-
cp -rp install-folder test-install-folder
82-
cd test-install-folder
83-
mv cma cmae
84-
# in pyproject.toml:
85-
# change "name = cma" and "version = {attr = "cma.__version__"}" to cmae
86-
python -m build > dist_call_output.txt ...
67+
Upload the distribution (was: in ``install-folder``)::
68+
69+
# optional (test upload):
70+
in pyproject.toml: change "name = cma" to = cmae
71+
python -m build > dist_call_outpute.txt
8772
twine upload --repository testpypi dist/cmae*
88-
cd ../install-folder
73+
open https://test.pypi.org/project/cmae
8974
75+
twine upload dist/*4.4.4*
76+
9077
7.c
9178
Create and push a tag, mainly to avoid changing any remote branch to pick for release draft::
9279
@@ -117,7 +104,8 @@
117104
Anaconda::
118105
119106
# edit version number in tools/conda.recipe/meta.yaml
120-
conda-build -q tools/conda.recipe # takes about 1/2 hour
107+
./script-prepare-distribution.sh # make clean install-folder
108+
conda-build -q tools/conda.recipe # takes about 1/2 hour, currently again broken
121109
122110
"""
123111
# from distutils.core import setup

0 commit comments

Comments
 (0)