Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extended setup.py #7

Open
mottosso opened this issue Jun 22, 2019 · 0 comments
Open

Extended setup.py #7

mottosso opened this issue Jun 22, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@mottosso
Copy link
Owner

Goal

Extend and/or override part or all of a package from PyPI with Rez-specific functionality.

Motivation

Rez is more capable than you're average Python package. For instance, they both support scripts on PATH, but only Rez is able to explicitly define the entirety of an environment upon entering a solved context.

Examples

  • Add commands() - Gain full control over the resulting environment
  • Replace name - E.g. replace Qt.py with Qt_py to avoid dots amongst your package
  • Replace version - Add extended support for versions, other than those possible via PEP 440 of just 3 dot-separated numbers and limited set of supported pre-release identifiers.

Implementation

Per default, a pip-package does not require a package.py which is instead generated based on properties made available by the wheel. However, if a wheel also contains a package.py, then those properties are instead used to augment it.

Provided by wheel

  • name
  • version
  • requires
  • commands(): env.PYTHONPATH.prepend("{root}/python")

For example, if a wheel contains the following.

my_project/setup.py

setup(
  name="my_project",
  version="1.0.0",
  install_requires=["my_other_project>=1.2"]
)

my_project/package.py

name = "my_special_project"

Then the resulting package.py would be.

name = "my_special_project"
version = "1.0.0"
requires = ["my_other_project>=1.2"]

def commands():
  env.PYTHONPATH.prepend("{root}/python")

What you end up with is a package compatible with PyPI, with extended support for when that package is used with Rez. Win-win.

@mottosso mottosso added the enhancement New feature or request label Jun 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant