The recommended workflow for sharing code across multiple Transforms Python repositories is publishing a Python library package—specifically, a Conda ↗ library. Publishing Python libraries is supported in Transforms Python 1.23.1+.
Here are the required steps for publishing a Python library:
Create a new repository that will contain the Python code for your shared library.
Name your repository. Your library will be named after the repository name when initialized. Other code repositories will use this name to discover and use your library. You can rename it later by accessing the gradle.properties
file and editing the condaPackageName
parameter (this file is hidden, so you may need to select "Show hidden files" in the file editor first).
Note that the condaPackageName
can only contain ASCII lowercase letters, numbers, or hyphens. Any sequence of non-alphanumeric/non-hyphen characters will be replaced by a single hyphen (for example my_library repo
will be published as my-library-repo
, and Foobar _baz$$$
will be published as foobar-baz-
).
Click the Create button in the Python Library template section.
Create a package: Any folder in your library containing an __init__.py
file will be published as a package. Your repository will be initialized with such a folder - rename it and add additional packages if needed.
Create modules: Within your package folder, you can add Python files that contain your code. These modules will later be imported by other repositories.
build.gradle
file.Note that tag names must conform to SLS versioning, as specified in the SLS Versions documentation ↗.
By default, changes to your library will only be published when you create a tag. You can create a tag for the current state of one of your branches, or for a specific commit. Once checks pass your library will be published and users will be able to upgrade to the newest version.
Consuming repositories do not automatically upgrade to use the newest version when a new version is published. To manually upgrade your repository to use the newest version, see the documentation on discovering and using Python libraries and on Conda lock files for re-resolving the Conda environment.
Your library at this point should be available for other apps and repositories to consume. Read more about discovering and using Python packages.