Reference#
build#
Create .conda packages from wheels.
Create wheels from pypa projects.
- conda_pypi.build.build_conda(whl, build_path, output_path, python_executable, project_path=None, is_editable=False)[source]#
- Parameters:
build_path (Path)
output_path (Path)
project_path (Path | None)
- Return type:
Path
- conda_pypi.build.build_pypa(path, output_path, prefix, distribution='editable')[source]#
- Parameters:
distribution – “editable” or “wheel”
path (Path)
prefix (Path)
- conda_pypi.build.paths_json(base)[source]#
Build simple paths.json with only ‘hardlink’ or ‘symlink’ types.
- Parameters:
base (Path | str)
conda_build_utils#
- class conda_pypi.conda_build_utils.PathType(value)[source]#
Bases:
Enum
Refers to if the file in question is hard linked or soft linked. Originally designed to be used in paths.json
- directory = 'directory'#
- hardlink = 'hardlink'#
- linked_package_record = 'linked_package_record'#
- pyc_file = 'pyc_file'#
- softlink = 'softlink'#
- unix_python_entry_point = 'unix_python_entry_point'#
- windows_python_entry_point_exe = 'windows_python_entry_point_exe'#
- windows_python_entry_point_script = 'windows_python_entry_point_script'#
translate#
Convert Python *.dist-info/METADATA to conda info/index.json
- class conda_pypi.translate.CondaMetadata(metadata: importlib.metadata._meta.PackageMetadata, console_scripts: List[str], package_record: conda_pypi.translate.PackageRecord, about: Dict[str, Any])[source]#
Bases:
object
- Parameters:
metadata (PackageMetadata)
console_scripts (List[str])
package_record (PackageRecord)
about (Dict[str, Any])
- about: Dict[str, Any]#
- console_scripts: List[str]#
- link_json()[source]#
info/link.json used for console scripts; None if empty.
Note the METADATA file aka PackageRecord does not list console scripts.
- Return type:
dict | None
- metadata: PackageMetadata#
- package_record: PackageRecord#
- class conda_pypi.translate.FileDistribution(raw_text)[source]#
Bases:
Distribution
From a file e.g. a single .metadata fetched from pypi instead of a *.dist-info folder.
- class conda_pypi.translate.PackageRecord(name: str, version: str, subdir: str, depends: List[str], extras: Dict[str, List[str]], build_number: int = 0, build_text: str = 'pypi', license_family: str = '', license: str = '', noarch: str = '', timestamp: int = 0)[source]#
Bases:
object
- Parameters:
name (str)
version (str)
subdir (str)
depends (List[str])
extras (Dict[str, List[str]])
build_number (int)
build_text (str)
license_family (str)
license (str)
noarch (str)
timestamp (int)
- property build#
- build_number: int = 0#
- build_text: str = 'pypi'#
- depends: List[str]#
- extras: Dict[str, List[str]]#
- license: str = ''#
- license_family: str = ''#
- name: str#
- noarch: str = ''#
- property stem#
- subdir: str#
- timestamp: int = 0#
- version: str#
editable#
Convert a dependency tree from pypi into .conda packages
- class conda_pypi.convert_tree.ConvertTree(prefix, override_channels=False, repo=None, finder=None)[source]#
Bases:
object
- Parameters:
prefix (Optional[Union[pathlib.Path, str]])
repo (Optional[pathlib.Path])
finder (Optional[PackageFinder])
- convert_tree(requested, max_attempts=20)[source]#
Preform a solve on the list of requested packages and converts the full dependency tree to conda packages if required. The converted packages will be stored in the local conda-pypi channel.
- Parameters:
requested (List[MatchSpec]) – The list of requested packages.
max_attempts (int) – max number of times to try to execute the solve.
- Returns:
A two-tuple of PackageRef sequences. The first is the group of packages to remove from the environment, in sorted dependency order from leaves to roots. The second is the group of packages to add to the environment, in sorted dependency order from roots to leaves.
- Return type:
tuple[tuple[PrefixRecord, …], tuple[PrefixRecord, …]] | None
- class conda_pypi.convert_tree.ReloadingLibMambaSolver(prefix, channels, subdirs=(), specs_to_add=(), specs_to_remove=(), repodata_fn='repodata.json', command=<conda.auxlib._Null object>)[source]#
Bases:
LibMambaSolver
Reload channels as we add newly converted packages. LibMambaIndexHelper appears to be addressing C++ singletons or global state.
- Parameters:
prefix (PathType)
channels (Iterable[Channel | str])
subdirs (Iterable[str])
specs_to_add (Iterable[MatchSpec | str])
specs_to_remove (Iterable[MatchSpec | str])
repodata_fn (str)
command (str | _Null)
index#
Interface to conda-index.
installer#
Install a wheel / install a conda.
- conda_pypi.installer.install_ephemeral_conda(prefix, package)[source]#
Install [editable] conda package without adding it to the environment’s package cache, since we don’t want to accidentally re-install “a link to a source checkout” elsewhere.
Installing packages directly from a file does not resolve dependencies. Should we automatically install the project’s dependencies also?
- Parameters:
prefix (Path)
package (Path)
downloader#
Fetch matching wheels from pypi.
- conda_pypi.downloader.find_and_fetch(finder, target, package)[source]#
Find package on PyPI, download best link to target.
- Parameters:
finder (PackageFinder)
target (Path)
package (str)
synth#
Generate repodata.json converted from wheel metadata.
- class conda_pypi.synth.Package(*, build='', build_number=0, depends=[], extras={}, md5=None, name='', sha256=None, size=0, subdir='', timestamp=0, version='')[source]#
Bases:
BaseModel
- Parameters:
build (str)
build_number (int)
depends (List[str])
extras (Dict[str, List[str]])
md5 (str | None)
name (str)
sha256 (str | None)
size (int)
subdir (str)
timestamp (int)
version (str)
- build: str#
- build_number: int#
- depends: List[str]#
- extras: Dict[str, List[str]]#
- md5: str | None#
- model_config: ClassVar[ConfigDict] = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str#
- sha256: str | None#
- size: int#
- subdir: str#
- timestamp: int#
- version: str#
- class conda_pypi.synth.RepoData(*, info, packages, repodata_version)[source]#
Bases:
BaseModel
- Parameters:
info (dict)
packages (Dict[str, Package])
repodata_version (int)
- info: dict#
- model_config: ClassVar[ConfigDict] = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- repodata_version: int#
- conda_pypi.synth.compatible_wheel(filename)[source]#
Compare filename with supported tags, determine if wheel is compatible.
An installer would rank the wheels based on the order of sys_tags().
- conda_pypi.synth.create_api(config_file=<typer.models.OptionInfo object>, repo_dir=<typer.models.OptionInfo object>, populate=<typer.models.OptionInfo object>)[source]#
Create a repodata.json file based on the list of projects provided.
- Parameters:
config_file (str)
repo_dir (str)
populate (bool)
- conda_pypi.synth.extract_version_of_project(project_page, version, download, download_dir)[source]#
Extract the version and details of the project from the project page.
- Parameters:
project_page (ProjectPage)
version (str)
download (bool)
download_dir (str)