Skip to content

Commit 7d5ba26

Browse files
author
github-actions
committed
[BUILD]: 8bc4e861be525fc801ae297ac76b52216c049a87
1 parent 8f18487 commit 7d5ba26

File tree

4 files changed

+16
-63
lines changed

4 files changed

+16
-63
lines changed

.github/workflows/build-single-exchange.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,11 @@ jobs:
4848
env:
4949
PYPI_API_SECRET: ${{ secrets.PYPI_API_SECRET }}
5050
run: |
51-
cd build || echo "already in build"
51+
cd build || echo ""
5252
npm run pypi-publish
5353
5454
- name: Upload to PyPI
5555
run: |
56-
dir
5756
cd ./temp_pypi
5857
python -m twine upload dist/*
5958
env:

README.md

Lines changed: 2 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,3 @@
1-
# kucoin-python
2-
Python SDK (sync and async) for Kucoin with Rest and WS capabilities.
3-
4-
You can check Kucoin's docs here: [Docs](https://ccxt.com)
5-
6-
7-
You can check the SDK docs here: [SDK](https://docs.ccxt.com/#/exchanges/kucoin)
8-
9-
*This package derives from CCXT and allows you to call pretty much every endpoint by either using the unified CCXT API or calling the endpoints directly*
10-
11-
## Installation
12-
13-
```
14-
pip install kucoin-api
15-
```
16-
17-
## Usage
18-
19-
### Async
20-
21-
```Python
22-
from kucoin-api import KucoinAsync
23-
24-
async def main():
25-
instance = KucoinAsync({})
26-
order = await instance.create_order(__EXAMPLE_SYMBOL__, "limit", "buy", 1, 100000)
27-
```
28-
29-
### Sync
30-
31-
```Python
32-
from kucoin-api import KucoinSync
33-
34-
def main():
35-
instance = KucoinSync({})
36-
order = instance.create_order(__EXAMPLE_SYMBOL__, "limit", "buy", 1, 100000)
37-
```
38-
39-
### Websockets
40-
41-
```Python
42-
from kucoin-api import KucoinWs
43-
44-
async def main():
45-
instance = KucoinWs({})
46-
while True:
47-
orders = await instance.watch_orders(__EXAMPLE_SYMBOL__)
48-
```
1+
# central repo for single exchanges
492

3+
this is dev.repo, not meant to be used by end users.

build/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"license": "ISC",
1313
"dependencies": {
1414
"fs": "^0.0.1-security",
15-
"path": "^0.12.7"
15+
"path": "^0.12.7",
16+
"semver": "^7.7.1"
1617
},
1718
"devDependencies": {
1819
"tsx": "^4.19.3"

build/pypi.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as fs from 'fs'
22
import path from 'path'
3+
import * as semver from 'semver';
34

45
import { argvs, mkdir, jsonFromFile, exchangeArgv, execSync, cp, capitalize, regexAll } from './utils';
56

@@ -35,16 +36,16 @@ class pypi {
3536
// copy readme
3637
cp (this.rootDir + `/README.md`, this.tempPyDir + '/README.md');
3738
// write pyproject.toml
39+
const verion = this.defineVersion ();
3840
fs.writeFileSync(this.tempPyDir + '/pyproject.toml', this.pyprojectTolmContent(pypiPackageNameSanitized));
3941
this.pythonPackageBuild ();
40-
// this.twinePublish ();
4142
}
4243

4344
sanitizeFolderName (name:string) {
4445
return name.replace(/-/g, '_');
4546
}
4647

47-
pyprojectTolmContent(pypiPackageNameSanitized:string) {
48+
pyprojectTolmContent(pypiPackageNameSanitized:string, newVersion: string) {
4849
const content = '' +
4950
`[build-system]\n` +
5051
`requires = ["hatchling"]\n` +
@@ -55,7 +56,7 @@ class pypi {
5556
`\n` +
5657
`[project]\n` +
5758
`name = "${pypiPackageNameSanitized}"\n` +
58-
`version = "0.0.1"\n` +
59+
`version = "` + newVersion + `"\n` +
5960
`authors = [\n` +
6061
` { name="Example Author", email="[email protected]" },\n` +
6162
`]\n` +
@@ -76,21 +77,19 @@ class pypi {
7677
return content;
7778
}
7879

80+
defineVersion () {
81+
const res = execSync(`pip index versions ` + this.exchangeConfigs[this.exchange].__PYTHON_PACKAGE_NAME__);
82+
const versions = res.toString().trim();
83+
const currentVersion = versions.match(/\((\S+)\)/);
84+
const newVersion = semver.inc(currentVersion, 'patch');
85+
return newVersion;
86+
}
7987

8088
pythonPackageBuild () {
8189
const res = execSync(`cd ${this.tempPyDir} && python -m build`);
8290
console.log(res.toString());
8391
}
8492

85-
twinePublish () {
86-
const res = execSync(`cd ${this.tempPyDir} && twine upload dist/*`, {
87-
env: {
88-
TWINE_USERNAME: '__token__',
89-
TWINE_PASSWORD: this.pypiApiSecret
90-
}
91-
});
92-
console.log(res.toString());
93-
}
9493
}
9594

9695
// check if environment variabele exist

0 commit comments

Comments
 (0)