Package: outcome-pypicloud-access-github
pypicloud-access-githubThis package provides a Github-based authentication backend forpypicloud.The package binds the PyPICloud instance to a GitHub Organization, and uses GitHub users, teams, and permissions to provide authentication and access control.UsageInstallationYou can install the package directly from pypi, alongside yourpypicloudinstallation.poetryaddoutcome-pypicloud-access-githubOr, if you want to usememcachefor caching.poetryaddoutcome-pypicloud-access-github[memcache]ConfigurationYou need to configure PyPICloud to use the auth backend, in theserver.ini:pypi.auth=outcome.pypicloud_access_github.Poetryauth.otc.github.organization=<INSERT YOUR ORGANIZATION NAME HERE>auth.otc.github.token=<INSERT YOUR TOKEN HERE>You can see a samplehere.CachingRetrieving the authentication information from GitHub can be a relatively slow process, depending on the size of your organization. The plugin implements an internal TTL cache usingdogpile.cacheto avoid hitting GitHub on each request.By default the cache backend is an in-memory cache, that is not shared across threads or processes. You can configure the cache to use amemcacheinstance that will be shared amongst threads/processes.auth.otc.github.cache.backend=memory# Use the memory backendauth.otc.github.cache.expiration=300# Expire the cache items after 300sFormemcache:auth.otc.github.cache.backend=memcache# Use the memcache backendauth.otc.github.cache.expiration=300# Expire the cache items after 300sauth.otc.github.cache.memcache.url=127.0.0.1:11211# The server:port of your memcache instanceOptionsThe full list of configuration options:OptionDefaultDescriptionauth.otc.github.tokenNoneThe Github Token used to query Github for the auth informationauth.otc.github.organizationNoneThe Github Organization name to use as a directoryauth.otc.github.repo_pattern.*A pattern that will be interpreted as a regular expression to filter repository namesauth.otc.github.repo_include_list[]A list of repository names to include. Names not in the list will be excludedauth.otc.github.repo_exclude_list[]A list of repository names to exclude. Names in the list will be excludedauth.otc.github.cache.backendmemoryThe cache backend to use, can bememoryormemcacheauth.otc.github.cache.expiration300The TTL for each cache keyauth.otc.github.cache.memcache.url127.0.0.1:11211The url of the memcache serverGithub TokenYou can create a Personal Access Token from yourDeveloper Settings. The token must haverepo,admin:org, andread:userpermissions.Publishing & Pulling PackagesYou can use your standard tools to publish to the repository (see here forPoetry). The username will be the GitHub username of the user, and the token will be a Personal Access Token assigned to that user. The token only requiresread:userscopes as it is only used to verify the identity of the user.How GitHub concepts are mapped to PyPICloudAuthorization & AuthenticationThe GitHub ACL elements are mapped pretty intuitively onto PyPICloud ACL elements.Users login with their username and PAT (the backend ensures that the username matches the token)Permissions are defined by the GitHub roles applied either on the Team, Repository, or Organization levelsThe permissions are mapped as follows:GitHub RolePyPI Permissionsadminread,writemaintainread,writetriagereadreadreadwriteread,writePackagesThe backend considers each repository to be a potential package (the backend isn't designed for monorepos). The backend will attempt to retrieve package information from the repository. Currently, the backend only supportsPoetrypackages, usingpyproject.toml, but it is easy to support other file formats by creating a new subclass of theoutcome.pypicloud_access_github.access.Accessclass (seepoetry.pyas an example.)For example, the repository for this library contains apyproject.tomlwith the following:[tool.poetry]name="outcome-pypicloud-access-github"version="0.1.0"description="An Github-based access backend for pypicloud."The backend will read this file and determine that the package is namedoutcome-pypicloud-access-github.DevelopmentRemember to run./pre-commit.shwhen you clone the repository.TestingThe testing is mainly made up of integration tests, read thetesting READMEfor more details.