Skip to content

Commit

Permalink
Use Hatchling build-backend and fix README for PyPI (#1051)
Browse files Browse the repository at this point in the history
  • Loading branch information
maresb authored Sep 20, 2024
1 parent e60aaca commit f70db33
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 36 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div align="center">

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

</div>

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

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

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).
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).

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

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

### Docker

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.
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.

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

Expand Down Expand Up @@ -111,12 +111,12 @@ mmm.fit(X,y)
mmm.plot_components_contributions();
```

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

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.

<center>
<img src="/docs/source/_static/mmm_plot_plot_channel_contributions_grid.png" width="80%" />
<img src="docs/source/_static/mmm_plot_plot_channel_contributions_grid.png" width="80%" />
</center>

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.
Expand Down Expand Up @@ -166,19 +166,19 @@ beta_geo_model.fit()

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.

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

See the Examples section for more on this.

## Why PyMC-Marketing vs other solutions?

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.

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).
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).

### Thanks to our contributors!

[![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)
[![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)


## Marketing AI Assistant: MMM-GPT with PyMC-Marketing
Expand Down
14 changes: 1 addition & 13 deletions pymc_marketing/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,4 @@
# limitations under the License.
"""Version of the package."""

import os

here = os.path.dirname(os.path.realpath(__file__))


def read_version() -> str:
"""Read the version from the version file."""
version_file = os.path.join(here, "version.txt")
with open(version_file, encoding="utf-8") as buff:
return buff.read().splitlines()[0]


__version__ = read_version()
__version__ = "0.9.0"
1 change: 0 additions & 1 deletion pymc_marketing/version.txt

This file was deleted.

45 changes: 32 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
[build-system]
build-backend = "setuptools.build_meta"
requires = ["setuptools>=61.0"]
build-backend = "hatchling.build"
requires = ["hatchling<2", "hatch-fancy-pypi-readme"]

[project]
name = "pymc-marketing"
description = "Marketing Statistical Models in PyMC"
requires-python = ">=3.10"
readme = "README.md"
license = { file = "LICENSE" }
dynamic = ["version"]
dynamic = ["version", "readme"]
maintainers = [{ name = "PyMC Labs", email = "[email protected]" }]
classifiers = [
"Development Status :: 5 - Production/Stable",
Expand Down Expand Up @@ -80,17 +79,37 @@ test = [
"mlflow>=2.0.0",
]

[tool.setuptools]
packages = [
"pymc_marketing",
"pymc_marketing.mmm",
"pymc_marketing.mmm.components",
"pymc_marketing.clv",
"pymc_marketing.clv.models",
[tool.hatch.build.targets.sdist]
exclude = [
"docs",
]

[tool.setuptools.dynamic]
version = { file = "pymc_marketing/version.txt" }
[tool.hatch.version]
path = "pymc_marketing/version.py"

# <https://github.com/hynek/hatch-fancy-pypi-readme>
[tool.hatch.metadata.hooks.fancy-pypi-readme]
content-type = "text/markdown"

[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
path = "README.md"

[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
# Image links should go to the raw content on GitHub
# <https://stackoverflow.com/a/46875147>
pattern = '\[(.*?)\]\(((?!https?://)\S+\.(png|jpe?g|svg|gif))\)'
replacement = '[\1](https://raw.githubusercontent.com/pymc-labs/pymc-marketing/main/\g<2>)'

[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
# Handle also HTML image tags
pattern = '''(<img\b[^>]*\bsrc=)(['"])((?!https?://)[^'"]+)(['"][^>]*>)'''
replacement = '<img src="https://raw.githubusercontent.com/pymc-labs/pymc-marketing/main/\g<3>\g<4>'

[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
# Remaining non-image relative links map to the normal absolute GitHub URL
# <https://stackoverflow.com/a/46875147>
pattern = '\[(.*?)\]\(((?!https?://)\S+)\)'
replacement = '[\1](https://github.com/pymc-labs/pymc-marketing/tree/main/\g<2>)'

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

0 comments on commit f70db33

Please sign in to comment.