# Dynamic metadata populated by entry-points

**URL:** <https://discuss.python.org/t/dynamic-metadata-populated-by-entry-points/36917>\
**Category:** Packaging\
**Created:** [October 22, 2023, 11:46pm UTC](https://discuss.python.org/t/dynamic-metadata-populated-by-entry-points/36917 "2023-10-22T23:46:27Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![abravalheri](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/abravalheri/32/4990_2.png) [@abravalheri](https://discuss.python.org/u/abravalheri)\
**Post date:** [October 24, 2023, 8:05am UTC](https://discuss.python.org/t/dynamic-metadata-populated-by-entry-points/36917/12 "2023-10-24T08:05:02Z")

</div>

> [@bignose](#):
>
> But for now, in order to satisfy the PEP 517 build tools and the pending deadline at the end of this month,

Consider the following:

```toml
# pyproject.toml

[build-system]
# ...

[project]
name = # ... 
author = # ...
keywords = # ...
license = # ...
urls = # ...
classifiers = #...
requires-python = # ...
dynamic = ["version", "description", "readme"]

```

```python
# setup.py
from setuptools import setup

def derive_version():
      ...

def derive_description():
      ...

def derive_readme():
      ...

setup(
   version=derive_version(),
   description=derive_description(),
   long_description=derive_readme(), # unfortunately the nomenclature varies a bit,
                                      # but PEP 621 text shows the equivalence.
)

```

After replacing the placeholders in the TOML with the actual data, this should give you a valid configuration\[1\].

It is not deprecated and it is a well-known/supported pattern.  
(Also it if you have a `build-system` table in your `pyproject.toml`, adding a `[project]` table is optional, you can also keep using `setup.py` to configure your build - again not deprecated, supported and PEP 517-ready).

* * *

1. Remembering to add `os.path.dirname( __file__ )` to `sys.path` if you need to do local imports. Since `setup.py` is not directly run with `python setup.py`, Python does not automatically add the directory containing the script to `sys.path`, [as it does when you run scripts](https://docs.python.org/3/using/cmdline.html#cmdarg-script).

---

_[View the full topic](https://discuss.python.org/t/dynamic-metadata-populated-by-entry-points/36917)._
