Skip to content

Commit

Permalink
Prepare for PyPi release
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Benkevich committed Apr 19, 2017
1 parent 0648b65 commit 174a1e3
Show file tree
Hide file tree
Showing 10 changed files with 118 additions and 1 deletion.
20 changes: 20 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2017 Alert Logic Inc.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
recursive-include alertlogic *
26 changes: 26 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
REPO_TEST ?= pypitest
REPO ?= pypi

.PHONY: dist register register_prod upload upload_prod install uninstall
.DEFAULT_GOAL := dist

dist:
python setup.py sdist

register:
python setup.py register -r $(REPO_TEST)

register_prod:
python setup.py register -r $(REPO)

upload:
python setup.py sdist upload -r $(REPO_TEST)

upload_prod:
python setup.py sdist upload -r $(REPO)

install:
python setup.py install

uninstall:
pip uninstall alertlogic-cli -y
1 change: 1 addition & 0 deletions README
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,48 @@ cd tests
configuration enables two log handlers to write messages to the stream and
to the syslog. Please provide the command line argument `--logging_config_file`
pointing on your custom configuration file to enable your custom log handlers.

* Building and publishing to the PyPi

In order to build, publish and test the package you need to create `~/.pypirc`:
```
[distutils]
index-servers =
pypi
pypitest
[pypi]
repository=https://pypi.python.org/pypi
username=alertlogic
password=password
[pypitest]
repository=https://testpypi.python.org/pypi
username=alertlogic
password=password
```

After it is created the following commands allow you to build upload and test the package:

* `make dist` - buids the package and puts it into `dist/` subfolder
* `make upload` - uploads to the `testpypi` server under alertlogic organization
* `make install` - installs the package locally(not from PyPi, to install from PyPi use pip)
* `make uninstall` - removes the package from the system
* `make register` - register the package with testpypi
* `make register_prod` - register the package with pypi
* `make upload` - build and upload version of the package to the testpypi
* `make upload_prod` - build and upload version of the package to the pypi(then can be installed as `pip install alertlogic-cli`)

In order to install the package remotely from testpypi, after it is uploaded,
use the following command:

`pip install -i https://testpypi.python.org/pypi alertlogic-cli`


In order to manipulate previous releases(delete, hide, etc.) PyPi web interface to be used:
https://pypi.python.org/pypi - for the production
https://testpypi.python.org/pypi - for the testpypi


General documentation is listed here:
https://packaging.python.org/distributing/
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion alertlogic/dynapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
import logging
import os.path

API_DATA_DIR = os.path.abspath(os.path.dirname(__file__)+"/../api_data")
API_DATA_DIR = os.path.abspath(os.path.dirname(__file__)+"/api_data")

API_SERVICES = ["sources"]

log = logging.getLogger()
Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[metadata]
description-file = share/README.md
21 changes: 21 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from distutils.core import setup
from setuptools import find_packages
VERSION = '1.0.0'
setup(
name = 'alertlogic_cli',
packages=find_packages(exclude=['contrib', 'docs', 'tests*']),
scripts = ['alertlogic-cli'],
version = VERSION,
license='MIT',
include_package_data=True,
install_requires=[
'requests',
],
description = 'Command Line Client for Alertlogic Services.',
author = 'Alert Logic Inc.',
author_email = '[email protected]',
url = 'https://github.com/alertlogic/alertlogic-cli',
download_url = "https://github.com/alertlogic/alertlogic-cli/archive/%s.tar.gz" % (VERSION),
keywords = ['cli', 'alertlogic'],
classifiers = [],
)

0 comments on commit 174a1e3

Please sign in to comment.