Skip to content

Commit 0b5f766

Browse files
committed
fixed sdist creation
1 parent fae6ebe commit 0b5f766

6 files changed

Lines changed: 36 additions & 22 deletions

File tree

.codeclimate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ exclude_patterns:
2626
- "*.txt"
2727
- "*.yml"
2828
- "*.yaml"
29-
- "build.py"
29+
- "custom_build.py"
3030
- "COPYING"
3131
- "**/__*"
3232
- "**/*.c"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ gimmemotifs/included_tools/
1414
gimmemotifs.egg-info/
1515
src/
1616
test_py/
17+
venv/
1718

1819
# tests
1920
.pytest_cache/
File renamed without changes.

docs/release_checklist.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ git flow release start ${new_version}
4040

4141
```shell
4242
pip wheel -w dist --no-deps --no-cache-dir --use-pep517 -v .
43-
mamba env create -n test -f requirements.yaml
43+
mamba env create --force -n test -f requirements.yaml
4444
mamba activate test
4545
pip install --no-deps --no-cache-dir --use-pep517 -v dist/gimmemotifs*.whl
4646

@@ -52,14 +52,23 @@ pytest -vvv --disable-pytest-warnings
5252

5353
## 5. Upload to pypi testing server
5454

55+
For more info, see https://packaging.python.org/en/latest/tutorials/packaging-projects/#generating-distribution-archives
56+
5557
```
56-
# Check for warnings or errors
57-
$ python setup.py check -r -s
58-
# Create distribution
59-
$ python setup.py sdist
58+
# Create the source distribution
59+
$ python3 -m pip install --upgrade build
60+
$ python3 -m build
61+
62+
# Test the source distribution
63+
$ pip install --no-deps --no-cache-dir --use-pep517 -v dist/gimmemotifs*.tar.gz
64+
$ rm ~/.config/gimmemotifs/gimmemotifs.cfg
65+
$ gimme -h
66+
$ pytest -vvv --disable-pytest-warnings
67+
6068
# Upload to pypi testing server
61-
$ twine upload -r testpypi dist/gimmemotifs-${version}.tar.gz
62-
```
69+
$ python3 -m pip install --upgrade twine
70+
$ python3 -m twine upload --repository testpypi dist/*
71+
```
6372

6473
## 6. Finish release
6574

@@ -77,8 +86,7 @@ git push --follow-tags origin develop master
7786
## 8. Upload to PyPi.
7887

7988
```shell
80-
python setup.py sdist
81-
twine upload dist/gimmemotifs-${new_version}.tar.gz
89+
twine upload dist/*
8290
```
8391

8492
## 9. Finalize the release on Github.

pyproject.toml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,28 +105,33 @@ packages = [
105105
"gimmemotifs.motif",
106106
"gimmemotifs.scanner",
107107
"gimmemotifs.tools",
108+
109+
# only needed in the sdist
110+
"src",
111+
"src.AMD",
112+
"src.BioProspector",
113+
"src.ChIPMunk",
114+
"src.HMS",
115+
"src.Improbizer",
116+
"src.MDmodule",
117+
"src.MotifSampler",
118+
"src.posmo",
108119
]
109120
ext-modules = [
110121
{name = "gimmemotifs.c_metrics", sources=["gimmemotifs/c_metrics.c"]},
111122
]
123+
py-modules = ["custom_build"] # only needed in the sdist
112124

113125
[tool.setuptools.package-data]
114-
data = [
115-
"bg/*",
116-
"cfg/*",
117-
"examples/*",
118-
"motif_databases/*",
119-
"score_dists/*",
120-
"templates/*",
121-
"templates.sortable/*",
122-
]
126+
data = ["**"]
127+
src = ["**"]
123128

124129
[tool.setuptools.exclude-package-data]
125130
gimmemotifs = ["*__pycache__*"]
126131
data = ["*__pycache__*"]
127132

128133
[tool.setuptools.cmdclass]
129-
build_py = "build.custom_build_py" # adds the motif prediction tools
134+
build_py = "custom_build.custom_build_py" # adds the motif prediction tools
130135
# options for automatic cleanup of editable uninstallation:
131136
# editable_wheel = "build.custom_editable_wheel"
132137
# egg_info = "build.custom_egg_info"

test/test_01_setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
def test_black_formatting():
77
try:
88
sp.check_output(
9-
"black --check gimmemotifs/ scripts/ test/ build.py",
9+
"black --check gimmemotifs/ scripts/ test/ custom_build.py",
1010
stderr=sp.STDOUT,
1111
shell=True,
1212
)
@@ -20,7 +20,7 @@ def test_black_formatting():
2020
def test_isort_formatting():
2121
try:
2222
sp.check_output(
23-
"isort --check gimmemotifs/ scripts/ test/ build.py",
23+
"isort --check gimmemotifs/ scripts/ test/ custom_build.py",
2424
stderr=sp.STDOUT,
2525
shell=True,
2626
)

0 commit comments

Comments
 (0)