Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,19 @@ updates:
directory: "/"
patterns: ["*"]
multi-ecosystem-group: "dependencies"
cooldown:
default-days: 7

- package-ecosystem: "pre-commit"
directory: "/"
patterns: ["*"]
multi-ecosystem-group: "dependencies"
cooldown:
default-days: 7

- package-ecosystem: "pip"
directory: "/"
patterns: ["*"]
multi-ecosystem-group: "dependencies"
cooldown:
default-days: 7
49 changes: 49 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: CI
on:
pull_request:
push:
branches:
- main
workflow_call:
inputs:
attest-package:
description: "Create GitHub provenance attestation for the package."
default: "false"
type: string
outputs:
artifact-basename:
description: "Base name of the uploaded artifacts; use for artifact retrieval."
value: ${{ jobs.package.outputs.artifact-basename }}

# Cancel active CI runs for a PR before starting another run
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

defaults:
run:
shell: bash # https://github.com/beeware/briefcase/pull/912

env:
FORCE_COLOR: "1"

jobs:
pre-commit:
name: Pre-commit checks
uses: beeware/.github/.github/workflows/pre-commit-run.yml@main
with:
pre-commit-source: "--group pre-commit"

package:
name: Package setuptools_dynamic_requires
needs: [ pre-commit ]
permissions:
id-token: write
attestations: write
contents: read
uses: beeware/.github/.github/workflows/python-package-create.yml@main
with:
attest: ${{ inputs.attest-package }}
26 changes: 26 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Upload Python Package

on:
release:
types: published

permissions: {}

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: dsaltares/fetch-gh-release-asset@aa2ab1243d6e0d5b405b973c89fa4d06a2d0fff7 # 1.1.2
with:
version: tags/${{ github.event.release.tag_name }}
# This next line is *not* a bash filename expansion - it's a regex.
# We need to match all files that start with std-nslog or
# std_nslog, but not the "Source code" zip and tarball.
file: setuptools_dynamic_requires.*
regex: true
target: dist/

- name: Publish release to production PyPI
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
64 changes: 64 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Create Release

on:
push:
tags:
- "v*"

permissions: {}

jobs:
ci:
name: CI
permissions:
contents: read
id-token: write
attestations: write
uses: $/.github/workflows/ci.yml
with:
attest-package: "true"

release:
name: Create Release
needs: [ci]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Set build variables
run: |
echo "VERSION=${GITHUB_REF_NAME#v}" | tee -a $GITHUB_ENV

- name: Get packages
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: "dist-*"
merge-multiple: true
path: dist

- name: Create Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
shell: bash
run: gh release create "$GITHUB_REF_NAME" --draft --title "$VERSION" dist/*

test-publish:
name: Publish test package
needs: [ci, release]
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- name: Get packages
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: "dist-*"
merge-multiple: true
path: dist

- name: Publish release to Test PyPI
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
with:
repository-url: https://test.pypi.org/legacy/
33 changes: 9 additions & 24 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,21 @@ repos:
- id: check-docstring-first
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/asottile/pyupgrade
rev: v3.22.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.16.5
hooks:
- id: pyupgrade
args: [--py39-plus]
- repo: https://github.com/PyCQA/isort
rev: 9.0.2
- id: ruff-format
- id: ruff-check
args: [--fix]
- repo: https://github.com/rvben/rumdl-pre-commit
rev: v0.2.62
hooks:
- id: isort
# Docformatter 1.7.5 isn't compatible with Pre-commit 4.0
# - repo: https://github.com/PyCQA/docformatter
# rev: v1.7.5
# hooks:
# - id: docformatter
# args: [--in-place, --black]
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 26.10.1
hooks:
- id: black
language_version: python3
- repo: https://github.com/PyCQA/flake8
rev: 7.5.0
hooks:
- id: flake8
- id: rumdl
- repo: https://github.com/codespell-project/codespell
rev: v2.4.3
hooks:
- id: codespell
# remove toml extra once Python 3.10 is no longer supported
additional_dependencies: ['.[toml]']
args: ["--skip=CODE_OF_CONDUCT.md"]
- repo: https://github.com/zizmorcore/zizmor-pre-commit
rev: v1.31.1
hooks:
Expand Down
42 changes: 11 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
[<img src="http://beeware.org/static/images/defaultlogo.png" width="72px" alt="Generic BeeWare Logo">](https://beeware.org/)

# setuptools_dynamic_dependencies

[![Python Versions](https://img.shields.io/pypi/pyversions/setuptools_dynamic_dependencies.svg)](https://pypi.python.org/pypi/setuptools_dynamic_dependencies)
[![PyPI Version](https://img.shields.io/pypi/v/setuptools_dynamic_dependencies.svg)](https://pypi.python.org/pypi/setuptools_dynamic_dependencies)
[![Maturity](https://img.shields.io/pypi/status/setuptools_dynamic_dependencies.svg)](https://pypi.python.org/pypi/setuptools_dynamic_dependencies)
[![BSD License](https://img.shields.io/pypi/l/setuptools_dynamic_dependencies.svg)](https://github.com/beeware/setuptools_dynamic_dependencies/blob/master/LICENSE)
[![Discord server](https://img.shields.io/discord/836455665257021440?label=Discord%20Chat&logo=discord&style=plastic)](https://beeware.org/bee/chat/)
[![Generic BeeWare project logo](https://beeware.org/static/images/defaultlogo.png)](https://beeware.org/)

[![Python Versions](https://img.shields.io/pypi/pyversions/setuptools_dynamic_dependencies.svg)](https://pypi.python.org/pypi/setuptools_dynamic_dependencies) [![PyPI Version](https://img.shields.io/pypi/v/setuptools_dynamic_dependencies.svg)](https://pypi.python.org/pypi/setuptools_dynamic_dependencies) [![Maturity](https://img.shields.io/pypi/status/setuptools_dynamic_dependencies.svg)](https://pypi.python.org/pypi/setuptools_dynamic_dependencies) [![BSD License](https://img.shields.io/pypi/l/setuptools_dynamic_dependencies.svg)](https://github.com/beeware/setuptools_dynamic_dependencies/blob/master/LICENSE) [![Discord server](https://img.shields.io/discord/836455665257021440?label=Discord%20Chat&logo=discord&style=plastic)](https://beeware.org/bee/chat/)

`setuptools_dynamic_dependencies` is a setuptools plugin that allows you to define project
requirements that are dynamically dependent on other properties (such as project
version). This can be useful in monorepositories which contain a "core" package and a
number of "backend" packages, and you want to enforce a version dependency between the
backend and the core.
`setuptools_dynamic_dependencies` is a setuptools plugin that allows you to define project requirements that are dynamically dependent on other properties (such as project version). This can be useful in monorepositories which contain a "core" package and a number of "backend" packages, and you want to enforce a version dependency between the backend and the core.

## Usage

You *must* be using a `pyproject.toml`-based project configuration. `setup.cfg` and
`setup.py` configurations are not supported.
You *must* be using a `pyproject.toml`-based project configuration. `setup.cfg` and `setup.py` configurations are not supported.

Add `setuptools_dynamic_dependencies` to the `build-system` requirements for your project:

Expand All @@ -29,21 +20,16 @@ Declare "dependencies" as being dynamic in your `[project]` table:
[project]
dynamic = ["dependencies"]

Then, add a `[tool.setuptools_dynamic_dependencies]` section to your configuration. In
this section, add an `dependencies` key for any requirements. In the following example,
`dynamic-package` will be pinned to the same version as the package being built:
Then, add a `[tool.setuptools_dynamic_dependencies]` section to your configuration. In this section, add an `dependencies` key for any requirements. In the following example, `dynamic-package` will be pinned to the same version as the package being built:

[tool.setuptools_dynamic_requires]
dependencies = [
"dynamic-package == {version}"
]

So - if this was the `pyproject.toml` for "myproject", and you were building v1.2.3, the
dependency would be set to `dynamic_package == 1.2.3`. This `version` value can come
from a `setuptool_scm` dynamic version, if required.
So - if this was the `pyproject.toml` for "myproject", and you were building v1.2.3, the dependency would be set to `dynamic_package == 1.2.3`. This `version` value can come from a `setuptool_scm` dynamic version, if required.

You can also specify a `[tool.setuptools_dynamic_dependencies.optional-dependencies]` to
define dynamic optional requirements:
You can also specify a `[tool.setuptools_dynamic_dependencies.optional-dependencies]` to define dynamic optional requirements:

[tool.setuptools_dynamic_dependencies.optional-dependencies]
feature = [
Expand All @@ -52,19 +38,13 @@ define dynamic optional requirements:

## Community

`setuptools_dynamic_dependencies` is part of the [BeeWare suite](http://beeware.org). You
can talk to the community through:
`setuptools_dynamic_dependencies` is part of the [BeeWare suite](http://beeware.org). You can talk to the community through:

- [@beeware@fosstodon.org on Mastodon](https://fosstodon.org/@beeware)
- [Discord](https://beeware.org/bee/chat/)

We foster a welcoming and respectful community as described in our [BeeWare
Community Code of Conduct](http://beeware.org/community/behavior/).
We foster a welcoming and respectful community as described in our [BeeWare Community Code of Conduct](http://beeware.org/community/behavior/).

## Contributing

If you experience problems with `setuptools_dynamic_dependencies`, [log them on
GitHub](https://github.com/beeware/setuptools_dynamic_dependencies/issues). If you want
to contribute, please [fork the
project](https://github.com/beeware/setuptools_dynamic_dependencies) and [submit a pull
request](https://github.com/beeware/setuptools_dynamic_dependencies/pulls).
If you experience problems with `setuptools_dynamic_dependencies`, [log them on GitHub](https://github.com/beeware/setuptools_dynamic_dependencies/issues). If you want to contribute, please [fork the project](https://github.com/beeware/setuptools_dynamic_dependencies) and [submit a pull request](https://github.com/beeware/setuptools_dynamic_dependencies/pulls).
63 changes: 56 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dynamic = ["version"]
name = "setuptools_dynamic_dependencies"
description = "A setuptools plugin that allows for dependencies that are dependent on the package's version number."
readme = "README.md"
requires-python = ">= 3.10"
requires-python = ">= 3.11"
license.file = "LICENSE"
authors = [
{name="Russell Keith-Magee", email="russell@keith-magee.com"},
Expand All @@ -31,11 +31,12 @@ classifiers = [
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: 3.15",
"Programming Language :: Python :: 3.16",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Software Development :: Libraries",
"Topic :: System :: Software Distribution",
Expand Down Expand Up @@ -65,14 +66,62 @@ dev = [
"setuptools_scm == 10.3.4",
{include-group = "pre-commit"},
]
[tool.ruff.lint]
# In addition to the default rules, these additional rules will be used:
extend-select = [
"E", # pycodestyle
"W", # pycodestyle
"F", # pyflakes
"UP", # pyupgrade
"B", # flake8-bugbear
"YTT", # flake8-2020
"ASYNC", # flake8-async
"C4", # flake8-comprehensions
"I", # isort
# The SIM rules are *very* opinionated, and don't necessarily make for better code.
# They may be worth occasionally turning on just to see if something could actually
# use improvement.
# "SIM", # flake8-simplify
]

[tool.ruff.lint.isort]
combine-as-imports = true

[tool.rumdl]
flavor = "mkdocs"
include = ["**/*.md"]
exclude = [
"comment.md",
"CODE_OF_CONDUCT.md",
"examples/example.podium/slides.md",
"changes/*.md",
]
respect-gitignore = true

# Disable rules:
# MD014: Forces commands in codeblocks to show output
# MD033: No inline HTML
disable = [
"MD014",
"MD033",
]

[tool.rumdl.per-file-ignores]
"docs/en/reference/index.md" = ["MD022", "MD025"]

[tool.rumdl.MD013] # Line length
line_length = 999999
reflow = true
reflow_mode = "normalize"

[tool.rumdl.MD026] # Remove punctuation at the end of headings
punctuation = ",;:"

[tool.rumdl.MD061] # Fail on certain strings.
#terms = ["TODO"]

[tool.setuptools]
py-modules = ["setuptools_dynamic_dependencies"]

[tool.setuptools_scm]
# An empty table is needed to enable setuptools_scm

[tool.isort]
profile = "black"
split_on_trailing_comma = true
combine_as_imports = true
Loading