Skip to content

Commit

Permalink
Added setup.py
Browse files Browse the repository at this point in the history
PEP-440 versioning with git cli
Readme
  • Loading branch information
IliaFeldgun committed Nov 8, 2023
1 parent 22f71ca commit 37a36d1
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
*.swp
build
dist
rackattack.egg-info
rackattack_api.egg-info
images.fortests
.coverage
attic
.idea/
.vscode/
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Rackattack API
API for provisioning rackattack hosts


```python
from rackattack.ssh import connection

def get_connection(ip, username, password, timeout=5 * 60):
node = connection.Connection(ip, username, password)
node.waitForTCPServer(timeout=timeout, interval=60)
node.connect()
return node

node = get_connection("192.168.1.1", "root", "password")
date = node.run.script("date")

```
41 changes: 41 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import setuptools
import subprocess
import re


def version():
git_describe_cmd = ["git", "describe", "--tags", "HEAD"]
git_head_tag = subprocess.check_output(git_describe_cmd).strip().decode("utf-8")
python_version = git_head_tag
unofficial_tag = re.search(r"(?=.*)-(\d+)-", python_version)
if unofficial_tag:
pep_440_suffix = ".dev{}+".format(unofficial_tag.group(1))
python_version = python_version.replace(unofficial_tag.group(0), pep_440_suffix)
return python_version


with open("README.md", "r") as fh:
long_description = fh.read()

setuptools.setup(
name="rackattack_api",
packages=setuptools.find_packages(where="py"),
package_dir={"": "py"},
version=version(),
python_requires="<=2.7.18",
install_requires=["twisted", "greenlet"],
author="Stratoscale",
author_email="zcompute@zadarastorage.com",
description="API for provisioning rackattack hosts",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/Stratoscale/rackattack-api",
project_urls={
"Bug Tracker": "https://github.com/Stratoscale/rackattack-api/issues",
},
classifiers=[
"Programming Language :: Python :: 2",
"License :: Apache License 2.0",
"Operating System :: OS Independent",
],
)

0 comments on commit 37a36d1

Please sign in to comment.