Skip to content

Commit 19dfabf

Browse files
authored
Merge pull request #90 from algorandfoundation/docs/use-package
docs: document how to install the alpha packages
2 parents 9b3069a + ea486a0 commit 19dfabf

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

packages/README.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Language Specific Packages
2+
3+
This section of the monorepo contains the language specific published packages which may or may not be built from shared rust code.
4+
5+
## Installation
6+
7+
Whilst we are building out the capabilities, we will likely be making a lot of breaking changes.
8+
As such we will only be releasing alpha versions of the packages for integration with internal tooling.
9+
At this point anything is open to change, so because of that we'll only publish these packages to internal package sources.
10+
11+
See below for the installation instructions for each supported language:
12+
13+
### Python
14+
15+
The Python packages are published as wheels on the GitHub release. These can be installed directly.
16+
17+
For a binary wheel with multiple target platforms like [algokit_transact](https://github.com/algorandfoundation/algokit-core/releases/tag/python%2Falgokit_transact%401.0.0-alpha.1), you can use the below config.
18+
19+
```toml
20+
[tool.poetry.dependencies]
21+
algokit_transact = [
22+
{ url = "https://github.com/algorandfoundation/algokit-core/releases/download/python%2Falgokit_transact%401.0.0-alpha.1/algokit_transact-1.0.0a1-py3-none-macosx_10_12_x86_64.whl", markers = "sys_platform == 'darwin' and platform_machine == 'x86_64'" },
23+
{ url = "https://github.com/algorandfoundation/algokit-core/releases/download/python%2Falgokit_transact%401.0.0-alpha.1/algokit_transact-1.0.0a1-py3-none-macosx_11_0_arm64.whl", markers = "sys_platform == 'darwin' and platform_machine == 'arm64'" },
24+
{ url = "https://github.com/algorandfoundation/algokit-core/releases/download/python%2Falgokit_transact%401.0.0-alpha.1/algokit_transact-1.0.0a1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", markers = "sys_platform == 'linux' and platform_machine == 'x86_64'" },
25+
{ url = "https://github.com/algorandfoundation/algokit-core/releases/download/python%2Falgokit_transact%401.0.0-alpha.1/algokit_transact-1.0.0a1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", markers = "sys_platform == 'linux' and platform_machine == 'aarch64'" },
26+
{ url = "https://github.com/algorandfoundation/algokit-core/releases/download/python%2Falgokit_transact%401.0.0-alpha.1/algokit_transact-1.0.0a1-py3-none-win_amd64.whl", markers = "sys_platform == 'win32' and platform_machine == 'AMD64'" }
27+
]
28+
```
29+
30+
For a non binary wheel like [algod_api](https://github.com/algorandfoundation/algokit-core/releases/tag/python%2Falgod_api%401.0.0-alpha.2), you can use the below config.
31+
32+
```toml
33+
[tool.poetry.dependencies]
34+
algokit_algod_api = { url = "https://github.com/algorandfoundation/algokit-core/releases/download/python%2Falgod_api%401.0.0-alpha.2/algokit_algod_api-1.0.0a2-py3-none-any.whl" }
35+
```
36+
37+
### TypeScript
38+
39+
The TypeScript packages are published to the GitHub packages NPM repository.
40+
41+
For example [algokit_transact](https://github.com/algorandfoundation/algokit-core/pkgs/npm/algokit-transact).
42+
43+
GitHub packages (the product) has some constaints, namely:
44+
45+
- It requires authentication to install a package
46+
- It enforce packages scopes, which must match the GitHub username (`algorandfoundation` in our case).
47+
48+
Unfortunately for us, the package scope in GitHub packages matches the official NPM registry and NPM itself does not support configuring multiple registries for a single package scope, so we need to be a little crafty when installing/updating the alpha packages we're installing from GitHub packages.
49+
50+
To install, follow the below:
51+
52+
1. Create a new [personal access token](https://github.com/settings/tokens/new) with `read:packages` permission and your preference of expiration time.
53+
2. Add the following to `~/.npmrc`:
54+
55+
```
56+
@algorandfoundation:registry=https://npm.pkg.github.com
57+
//npm.pkg.github.com/:_authToken={TOKEN}
58+
```
59+
60+
3. Install the package hosted in GitHub packages, which will update your NPM package lock file.
61+
62+
```
63+
npm install @algorandfoundation/[email protected]
64+
```
65+
66+
4. Remove `@algorandfoundation:registry=https://npm.pkg.github.com` from `~/.npmrc`, so NPM hosted `@algorandfoundation` packages can be resolved.
67+
68+
Note: You will need to perform steps 2-4 each time your either install a package for the first time or update a GitHub package hosted dependency. Installing from the lock file only requires the token.

0 commit comments

Comments
 (0)