Skip to content

Commit ee3e77f

Browse files
maresbjsnyde0
authored andcommitted
Use Hatchling build-backend and fix README for PyPI (pymc-labs#1051)
1 parent 96b8e70 commit ee3e77f

File tree

4 files changed

+42
-36
lines changed

4 files changed

+42
-36
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div align="center">
22

3-
![PyMC-Marketing Logo](https://github.com/pymc-labs/pymc-marketing/blob/main/docs/source/_static/marketing-logo-light.jpg)
3+
![PyMC-Marketing Logo](docs/source/_static/marketing-logo-light.jpg)
44

55
</div>
66

@@ -27,10 +27,10 @@ Unlock the power of **Marketing Mix Modeling (MMM)** and **Customer Lifetime Val
2727
This repository is supported by [PyMC Labs](https://www.pymc-labs.com).
2828

2929
<center>
30-
<img src="https://github.com/pymc-labs/pymc-marketing/blob/main/docs/source/_static/labs-logo-light.png" width="50%" />
30+
<img src="docs/source/_static/labs-logo-light.png" width="50%" />
3131
</center>
3232

33-
For businesses looking to integrate PyMC-Marketing into their operational framework, [PyMC Labs](https://www.pymc-labs.com) offers expert consulting and training. Our team is proficient in state-of-the-art Bayesian modeling techniques, with a focus on Marketing Mix Models (MMMs) and Customer Lifetime Value (CLV). For more information see [here](#-schedule-a-free-consultation-for-mmm--clv-strategy).
33+
For businesses looking to integrate PyMC-Marketing into their operational framework, [PyMC Labs](https://www.pymc-labs.com) offers expert consulting and training. Our team is proficient in state-of-the-art Bayesian modeling techniques, with a focus on Marketing Mix Models (MMMs) and Customer Lifetime Value (CLV). For more information see [here](README.md#-schedule-a-free-consultation-for-mmm--clv-strategy).
3434

3535
Explore these topics further by watching our video on [Bayesian Marketing Mix Models: State of the Art](https://www.youtube.com/watch?v=xVx91prC81g).
3636

@@ -54,7 +54,7 @@ For a comprehensive installation guide, refer to the [official PyMC installation
5454

5555
### Docker
5656

57-
We provide a `Dockerfile` to build a Docker image for PyMC-Marketing so that is accessible from a Jupyter Notebook. See [here](/scripts/docker/README.md) for more details.
57+
We provide a `Dockerfile` to build a Docker image for PyMC-Marketing so that is accessible from a Jupyter Notebook. See [here](scripts/docker/README.md) for more details.
5858

5959
## In-depth Bayesian Marketing Mix Modeling (MMM) in PyMC
6060

@@ -111,12 +111,12 @@ mmm.fit(X,y)
111111
mmm.plot_components_contributions();
112112
```
113113

114-
![](https://github.com/pymc-labs/pymc-marketing/blob/main/docs/source/_static/mmm_plot_components_contributions.png)
114+
![](docs/source/_static/mmm_plot_components_contributions.png)
115115

116116
Once the model is fitted, we can further optimize our budget allocation as we are including diminishing returns and carry-over effects in our model.
117117

118118
<center>
119-
<img src="/docs/source/_static/mmm_plot_plot_channel_contributions_grid.png" width="80%" />
119+
<img src="docs/source/_static/mmm_plot_plot_channel_contributions_grid.png" width="80%" />
120120
</center>
121121

122122
Explore a hands-on [simulated example](https://pymc-marketing.readthedocs.io/en/stable/notebooks/mmm/mmm_example.html) for more insights into MMM with PyMC-Marketing.
@@ -166,19 +166,19 @@ beta_geo_model.fit()
166166

167167
Once fitted, we can use the model to predict the number of future purchases for known customers, the probability that they are still alive, and get various visualizations plotted.
168168

169-
![](https://github.com/pymc-labs/pymc-marketing/blob/main/docs/source/_static/expected_purchases.png)
169+
![](docs/source/_static/expected_purchases.png)
170170

171171
See the Examples section for more on this.
172172

173173
## Why PyMC-Marketing vs other solutions?
174174

175175
PyMC-Marketing is and will always be free for commercial use, licensed under [Apache 2.0](LICENSE). Developed by core developers behind the popular PyMC package and marketing experts, it provides state-of-the-art measurements and analytics for marketing teams.
176176

177-
Due to its open-source nature and active contributor base, new features are constantly added. Are you missing a feature or want to contribute? Fork our repository and submit a pull request. If you have any questions, feel free to [open an issue](https://github.com/your-repo/issues).
177+
Due to its open-source nature and active contributor base, new features are constantly added. Are you missing a feature or want to contribute? Fork our repository and submit a pull request. If you have any questions, feel free to [open an issue](https://github.com/pymc-labs/pymc-marketing/issues).
178178

179179
### Thanks to our contributors!
180180

181-
[![https://github.com/pymc-devs/pymc/graphs/contributors](https://contrib.rocks/image?repo=pymc-labs/pymc-marketing)](https://github.com/pymc-labs/pymc-marketing/graphs/contributors)
181+
[![https://github.com/pymc-labs/pymc-marketing/graphs/contributors](https://contrib.rocks/image?repo=pymc-labs/pymc-marketing)](https://github.com/pymc-labs/pymc-marketing/graphs/contributors)
182182

183183

184184
## Marketing AI Assistant: MMM-GPT with PyMC-Marketing

pymc_marketing/version.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,4 @@
1313
# limitations under the License.
1414
"""Version of the package."""
1515

16-
import os
17-
18-
here = os.path.dirname(os.path.realpath(__file__))
19-
20-
21-
def read_version() -> str:
22-
"""Read the version from the version file."""
23-
version_file = os.path.join(here, "version.txt")
24-
with open(version_file, encoding="utf-8") as buff:
25-
return buff.read().splitlines()[0]
26-
27-
28-
__version__ = read_version()
16+
__version__ = "0.9.0"

pymc_marketing/version.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

pyproject.toml

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
[build-system]
2-
build-backend = "setuptools.build_meta"
3-
requires = ["setuptools>=61.0"]
2+
build-backend = "hatchling.build"
3+
requires = ["hatchling<2", "hatch-fancy-pypi-readme"]
44

55
[project]
66
name = "pymc-marketing"
77
description = "Marketing Statistical Models in PyMC"
88
requires-python = ">=3.10"
9-
readme = "README.md"
109
license = { file = "LICENSE" }
11-
dynamic = ["version"]
10+
dynamic = ["version", "readme"]
1211
maintainers = [{ name = "PyMC Labs", email = "[email protected]" }]
1312
classifiers = [
1413
"Development Status :: 5 - Production/Stable",
@@ -80,17 +79,37 @@ test = [
8079
"mlflow>=2.0.0",
8180
]
8281

83-
[tool.setuptools]
84-
packages = [
85-
"pymc_marketing",
86-
"pymc_marketing.mmm",
87-
"pymc_marketing.mmm.components",
88-
"pymc_marketing.clv",
89-
"pymc_marketing.clv.models",
82+
[tool.hatch.build.targets.sdist]
83+
exclude = [
84+
"docs",
9085
]
9186

92-
[tool.setuptools.dynamic]
93-
version = { file = "pymc_marketing/version.txt" }
87+
[tool.hatch.version]
88+
path = "pymc_marketing/version.py"
89+
90+
# <https://github.com/hynek/hatch-fancy-pypi-readme>
91+
[tool.hatch.metadata.hooks.fancy-pypi-readme]
92+
content-type = "text/markdown"
93+
94+
[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
95+
path = "README.md"
96+
97+
[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
98+
# Image links should go to the raw content on GitHub
99+
# <https://stackoverflow.com/a/46875147>
100+
pattern = '\[(.*?)\]\(((?!https?://)\S+\.(png|jpe?g|svg|gif))\)'
101+
replacement = '[\1](https://raw.githubusercontent.com/pymc-labs/pymc-marketing/main/\g<2>)'
102+
103+
[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
104+
# Handle also HTML image tags
105+
pattern = '''(<img\b[^>]*\bsrc=)(['"])((?!https?://)[^'"]+)(['"][^>]*>)'''
106+
replacement = '<img src="https://raw.githubusercontent.com/pymc-labs/pymc-marketing/main/\g<3>\g<4>'
107+
108+
[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
109+
# Remaining non-image relative links map to the normal absolute GitHub URL
110+
# <https://stackoverflow.com/a/46875147>
111+
pattern = '\[(.*?)\]\(((?!https?://)\S+)\)'
112+
replacement = '[\1](https://github.com/pymc-labs/pymc-marketing/tree/main/\g<2>)'
94113

95114
[project.urls]
96115
repository = "https://github.com/pymc-labs/pymc-marketing"

0 commit comments

Comments
 (0)