Skip to content

Commit

Permalink
find extras example
Browse files Browse the repository at this point in the history
  • Loading branch information
dholth committed Jul 12, 2024
1 parent 5f39732 commit ec43149
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion grayskull/strategy/py_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
from importlib.metadata import PathDistribution
from pathlib import Path

import build
from conda.exceptions import InvalidMatchSpec
from conda.models.match_spec import MatchSpec
from packaging.requirements import Requirement
from souschef.recipe import Recipe

import build
from grayskull.config import Configuration
from grayskull.strategy.abstract_strategy import AbstractStrategy
from grayskull.strategy.pypi import compose_test_section
Expand All @@ -36,6 +36,18 @@ def fetch_data(recipe: Recipe, config: Configuration, sections=None):
# without invoking pip e.g. setuptools_scm[toml]
print("Requires for build:", build_system_requires, requires_for_build)

# Example of finding extra dependencies for a distribution 'scm' (is
# there a dict API?) Subtract "has non-extra marker" dependencies from
# this set.
#
# for e in scm.metadata.get_all('provides-extra'):
# print (e, [x for x in r if x.marker and x.marker.evaluate({'extra':e})])
#
# docs [<Requirement('entangled-cli[rich]; extra == "docs"')>, <Requirement('mkdocs; extra == "docs"')>, <Requirement('mkdocs-entangled-plugin; extra == "docs"')>, <Requirement('mkdocs-material; extra == "docs"')>, <Requirement('mkdocstrings[python]; extra == "docs"')>, <Requirement('pygments; extra == "docs"')>]
# rich [<Requirement('rich; extra == "rich"')>]
# test [<Requirement('build; extra == "test"')>, <Requirement('pytest; extra == "test"')>, <Requirement('rich; extra == "test"')>, <Requirement('wheel; extra == "test"')>]
# toml []

# build the project's metadata "dist-info" directory
metadata_path = Path(project.metadata_path(output_directory=output))

Expand Down

0 comments on commit ec43149

Please sign in to comment.