thousands-france-27863
01/26/2023, 10:15 PMpoetry version xxx
(patch, minor, major). So each publish library has its own cadence depending on the changes.
I don’t see anything option in pants to allow versioning (specially individually) but I might be missing something. Is this, or another similar option, supported?
As an alternative, I was thinking it might just be ok to add a macro that runs just before the package state (but only if the system has detected changes).
Having an individual version and increasing the version number for all packages is also an option, but that means we deploy all libraries all the time (even if there aren’t changes) what ain’t ideal.
Other options/ideas welcomed!
Thanks in advance!happy-kitchen-89482
01/26/2023, 11:24 PMthousands-france-27863
01/27/2023, 5:55 AM[tool.poetry]
name = "library_1"
version = "2.0.0"
description = "my internal library"
authors = ["<mailto:blabla@blablabla.com|blabla@blablabla.com>"]
readme = "README.md"
repository = "<https://ohhh-this-url-is-amazing/but-is-not-real>"
[tool.poetry.dependencies]
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
I have created a publish macro like this:
# flake8: noqa: F821
def poetry_distribution(name, **kwargs):
resources(name="package_data", sources=["pyproject.toml", "README.md"])
python_distribution(
name="dist",
dependencies=[":package_data", f"src/python/{name}/src", "//:root"],
provides=python_artifact(name=name),
generate_setup=False,
)
Then I have BUILD file on the same folder with the following
poetry_distribution(
name="name-of-my-library",
)
├── BUILD
├── dependencies.lock
├── dist
│ ├── library-1-2.0.0-py2.py3-none-any.whl
│ ├── library-1-2.0.0.tar.gz
│ ├── library-2-5.0.0-py2.py3-none-any.whl
│ ├── library-2-5.0.0.tar.gz
│ ├── library-3-3.0.0-py2.py3-none-any.whl
│ ├── library-3-3.0.0.tar.gz
│ ├── library-4-2.0.0-py2.py3-none-any.whl
│ └── library-4-2.0.0.tar.gz
├── pants
├── pants.toml
├── pants_plugins
│ ├── BUILD
│ └── macros.py <- This is where I have put the macro
├── pyproject.toml
├── setup.cfg
└── src
└── python
├── library-1
│ ├── BUILD
│ ├── README.md
│ ├── pyproject.toml
│ ├── src
│ │ ├── BUILD
│ │ └── library-1.py
│ └── test
│ ├── BUILD
│ └── test_library-1.py
├── library-2
│ ├── BUILD
│ ├── README.md
│ ├── pyproject.toml
│ └── src
│ ├── BUILD
│ ├── library-2.py
│ ├── test_something_else_library-2.py
│ └── test_library-2.py
├── library-3
│ ├── BUILD
│ ├── README.md
│ ├── pyproject.toml
│ └── src
│ ├── BUILD
│ ├── __init__.py
│ ├── library-3.py
│ └── test_library-3.py
└── ppl_library-4
├── BUILD
├── README.md
├── pyproject.toml
└── src
├── BUILD
├── ppl_library-4.py
└── test_library-4.py
[source]
root_patterns = ['/src/python/*/src', '/']
And, this also in the pants.toml to configure the macro:
build_file_prelude_globs = ["pants_plugins/macros.py"]
happy-kitchen-89482
01/27/2023, 6:22 PMpoetry_distribution
macro is pretty neat!pyproject.toml
when that project's code changes, and then also change the references to that project in its dependers?thousands-france-27863
01/30/2023, 6:49 AMhappy-kitchen-89482
01/30/2023, 2:58 PMthousands-france-27863
01/30/2023, 2:59 PM