|
1 |
| -# Cirun Python Client and CLI |
| 1 | +# cirun-py |
2 | 2 |
|
3 |
| -[](https://anaconda.org/conda-forge/cirun) [](https://pypi.org/project/cirun) |
4 |
| -[](https://pypi.org/project/cirun) [](https://anaconda.org/conda-forge/cirun) |
| 3 | +<div align="center"> |
| 4 | + <picture> |
| 5 | + <source media="(prefers-color-scheme: dark)" alt="Cirun logo" height="150" srcset="https://raw.githubusercontent.com/AktechLabs/cirun-docs/refs/heads/main/static/img/cirun-logo-dark.svg"> |
| 6 | + <source media="(prefers-color-scheme: light)" alt="Cirun logo" height="150" srcset="https://raw.githubusercontent.com/AktechLabs/cirun-docs/refs/heads/main/static/img/cirun-logo-light.svg"> |
| 7 | + <img alt="Cirun logo" height="150" src="https://raw.githubusercontent.com/AktechLabs/cirun-docs/refs/heads/main/static/img/cirun-logo-light.svg"> |
| 8 | + </picture> |
5 | 9 |
|
6 |
| ------ |
| 10 | + <h3>Python Client and CLI for the Cirun Platform</h3> |
7 | 11 |
|
8 |
| -**Table of Contents** |
| 12 | + [](https://pypi.org/project/cirun) |
| 13 | + [](https://anaconda.org/conda-forge/cirun) |
| 14 | + [](https://pypi.org/project/cirun) |
| 15 | + [](https://anaconda.org/conda-forge/cirun) |
| 16 | + [](https://opensource.org/licenses/MIT) |
| 17 | + [](https://docs.cirun.io) |
| 18 | +</div> |
9 | 19 |
|
10 |
| -- [Installation](#installation) |
11 |
| -- [Usage](#usage) |
12 |
| -- [License](#license) |
| 20 | +## 🚀 Overview |
13 | 21 |
|
14 |
| -## Installation |
| 22 | +**cirun-py** is a Python client and command-line interface for the [Cirun platform](https://cirun.io), enabling seamless management of your CI/CD infrastructure. Whether you're managing repositories, or connecting cloud providers, cirun-py makes it simple with both a programmatic API and intuitive CLI. |
15 | 23 |
|
16 |
| -```console |
| 24 | +## ✨ Features |
| 25 | + |
| 26 | +- **Dual Interface**: Use as both a Python client library and CLI tool |
| 27 | +- **Repository Management**: Easily activate, deactivate, and list repositories |
| 28 | +- **Cloud Provider Integration**: Connect AWS, Azure, GCP, and other cloud providers |
| 29 | +- **Elegant API**: Clean, Pythonic interface for all Cirun operations |
| 30 | +- **Rich Output Formatting**: Beautiful CLI output for better readability |
| 31 | + |
| 32 | +## 📦 Installation |
| 33 | + |
| 34 | +### Using pip (Recommended) |
| 35 | + |
| 36 | +```bash |
17 | 37 | pip install cirun
|
18 | 38 | ```
|
19 | 39 |
|
20 |
| -or via `conda-forge` |
| 40 | +### Using conda |
21 | 41 |
|
22 |
| -```console |
| 42 | +```bash |
23 | 43 | conda install -c conda-forge cirun
|
24 | 44 | ```
|
25 | 45 |
|
26 |
| -## Usage |
| 46 | +### From Source |
| 47 | + |
| 48 | +```bash |
| 49 | +git clone https://github.com/cirun-io/cirun-py |
| 50 | +cd cirun-py |
| 51 | +pip install -e . |
| 52 | +``` |
27 | 53 |
|
28 |
| -**cirun-py** can be used as a CLI as well as a Python client programmatically. |
| 54 | +## 🏃♂️ Quick Start |
29 | 55 |
|
30 |
| -- Create an API key from the Cirun Dashboard https://cirun.io/admin/api |
31 |
| -- Set that API Key as an environment variable named `CIRUN_API_KEY` |
| 56 | +1. **Get your API key** from the [Cirun dashboard](https://cirun.io/admin/api) |
| 57 | +2. **Set your API key as an environment variable**: |
32 | 58 |
|
33 |
| -```console |
| 59 | +```bash |
34 | 60 | export CIRUN_API_KEY=<your-api-key>
|
35 | 61 | ```
|
36 | 62 |
|
37 |
| -### CLI |
| 63 | +3. **Start using cirun-py!** |
38 | 64 |
|
39 |
| -- List active repositories for Cirun |
| 65 | +## 🧰 Usage |
40 | 66 |
|
41 |
| -```bash |
42 |
| -$ cirun repo list |
43 |
| -────────────────────────────────────────────────────────────────────────────────────────────────────────── |
44 |
| -{ |
45 |
| - "repos": [ |
46 |
| - { |
47 |
| - "repository": "aktech/cirun-openstack-example", |
48 |
| - "active": true, |
49 |
| - "private": false |
50 |
| - }, |
51 |
| - { |
52 |
| - "repository": "aktechlabs/cirun-demo", |
53 |
| - "active": true, |
54 |
| - "private": true |
55 |
| - } |
56 |
| - ] |
57 |
| -} |
58 |
| -────────────────────────────────────────────────────────────────────────────────────────────────────────── |
59 |
| -``` |
| 67 | +### CLI Examples |
60 | 68 |
|
61 |
| -- Active (add) a repository |
| 69 | +#### Repository Management |
62 | 70 |
|
63 | 71 | ```bash
|
64 |
| -$ cirun repo add aktech/sympy |
65 |
| -────────────────────────────────────────────────────────────────────────────────────────────────────────── |
66 |
| -{ |
67 |
| - "name": "aktech/sympy", |
68 |
| - "active": true |
69 |
| -} |
70 |
| -────────────────────────────────────────────────────────────────────────────────────────────────────────── |
71 |
| -``` |
| 72 | +# List active repositories |
| 73 | +cirun repo list |
72 | 74 |
|
73 |
| -- Deactivate (remove) a repository |
| 75 | +# Activate a repository |
| 76 | +cirun repo add username/repo-name |
74 | 77 |
|
75 |
| -```bash |
76 |
| -$ cirun repo remove aktech/sympy |
77 |
| -────────────────────────────────────────────────────────────────────────────────────────────────────────── |
78 |
| -{ |
79 |
| - "name": "aktech/sympy", |
80 |
| - "active": false |
81 |
| -} |
82 |
| -────────────────────────────────────────────────────────────────────────────────────────────────────────── |
| 78 | +# Deactivate a repository |
| 79 | +cirun repo remove username/repo-name |
83 | 80 | ```
|
84 | 81 |
|
85 |
| -- Connect cloud provider with Cirun |
| 82 | +#### Cloud Provider Integration |
86 | 83 |
|
87 | 84 | ```bash
|
| 85 | +# Connect AWS |
88 | 86 | cirun cloud connect aws --access-key AKIXXXXXXXXX --secret-key KFCF3yi+df0n12345678AMASDFGHJ
|
89 | 87 |
|
| 88 | +# Connect Azure |
90 | 89 | cirun cloud connect azure \
|
91 | 90 | --subscription-id 31184337-0346-4782-ae59-eb185fd0cfa1 \
|
92 | 91 | --tenant-id a66e466d-698b-4a91-b9e3-949f9cc04f11 \
|
93 | 92 | --client-id 340d01fc-ba24-43ee-844e-d364899d29e7 \
|
94 | 93 | --client-secret KFCF3yi+df0cirunIsAwesomeIsntIt?n1DFGHJ
|
95 | 94 |
|
| 95 | +# Connect GCP |
96 | 96 | cirun cloud connect gcp --key-file /path/to/service-account-key.json
|
97 | 97 | ```
|
98 | 98 |
|
99 |
| -### Client |
| 99 | +### Python Client Examples |
100 | 100 |
|
101 | 101 | ```python
|
102 | 102 | from cirun import Cirun
|
103 |
| -# Create cirun client object |
104 |
| -# Pass the token or set `CIRUN_API_KEY` environment variable |
105 |
| -c = Cirun(token='cirun-4cabcdbf-275c-4500-890d-712340663ddc') |
106 | 103 |
|
107 |
| -# List repositories |
108 |
| -c.get_repos() |
| 104 | +# Initialize client (pass token or set CIRUN_API_KEY environment variable) |
| 105 | +cirun_client = Cirun(token='cirun-4cabcdbf-275c-4500-890d-712340663ddc') |
109 | 106 |
|
110 |
| -# Active (add) a repository |
111 |
| -c.set_repo('aktech/sympy', active=True) |
| 107 | +# List all repositories |
| 108 | +repos = cirun_client.get_repos() |
| 109 | +print(repos) |
112 | 110 |
|
113 |
| -# Deactivate (remove) a repository |
114 |
| -c.set_repo('aktech/sympy', active=False) |
| 111 | +# Activate a repository |
| 112 | +cirun_client.set_repo('username/repo-name', active=True) |
| 113 | + |
| 114 | +# Deactivate a repository |
| 115 | +cirun_client.set_repo('username/repo-name', active=False) |
115 | 116 | ```
|
116 | 117 |
|
117 |
| -## License |
| 118 | +## ⚙️ Configuration |
| 119 | + |
| 120 | +### Environment Variables |
| 121 | + |
| 122 | +| Variable | Description | Default | |
| 123 | +|----------|-------------|---------| |
| 124 | +| `CIRUN_API_KEY` | API key for authentication | (Required) | |
| 125 | +| `CIRUN_API_URL` | Base URL for Cirun API | https://api.cirun.io/api/v1 | |
| 126 | + |
| 127 | +## 📚 Documentation |
| 128 | + |
| 129 | +For comprehensive documentation, visit: |
| 130 | +- [Cirun Documentation](https://docs.cirun.io/) |
| 131 | +- [Python Client API Reference](https://docs.cirun.io/python) |
| 132 | +- [CLI Command Reference](https://docs.cirun.io/cli) |
| 133 | + |
| 134 | +## 🔍 Troubleshooting |
| 135 | + |
| 136 | +### Common Issues |
| 137 | + |
| 138 | +- **Authentication Errors**: Ensure your API key is correctly set |
| 139 | +- **Connection Issues**: Check your network connection to api.cirun.io |
| 140 | +- **Permission Problems**: Verify you have the required permissions for the operation |
| 141 | + |
| 142 | +## 💬 Support |
| 143 | + |
| 144 | +Get help from our team and community: |
| 145 | + |
| 146 | +- **Slack**: [Join our community](https://slack.cirun.io/) |
| 147 | + |
| 148 | +- **GitHub Issues**: [Report bugs](https://github.com/cirun-io/cirun-py/issues) |
| 149 | + |
| 150 | +## 📜 License |
| 151 | + |
| 152 | +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. |
| 153 | + |
| 154 | +## 🤝 Contributing |
| 155 | + |
| 156 | +We welcome contributions! Here's how: |
| 157 | + |
| 158 | +1. Fork the repository |
| 159 | +2. Create your feature branch (`git checkout -b feature/amazing-feature`) |
| 160 | +3. Commit your changes (`git commit -m 'Add some amazing feature'`) |
| 161 | +4. Push to the branch (`git push origin feature/amazing-feature`) |
| 162 | +5. Open a Pull Request |
| 163 | + |
| 164 | +## 🔄 Related Projects |
118 | 165 |
|
119 |
| -`cirun` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license. |
| 166 | +- [cirun-agent](https://github.com/cirun-io/cirun-agent): Rust agent for on-premise runner provisioning |
| 167 | +- [cirun-docs](https://github.com/cirun-io/cirun-docs): Documentation for the Cirun platform |
0 commit comments