Skip to content

Commit

Permalink
Publish package to PyPi
Browse files Browse the repository at this point in the history
  • Loading branch information
gatkin committed Jul 30, 2019
1 parent 276d570 commit eb703f8
Show file tree
Hide file tree
Showing 5 changed files with 160 additions and 39 deletions.
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,20 @@ lint: type-check
python -m pydocstyle nrdash/
python -m pylint --rcfile nrdash/.pylintrc nrdash/

package:
rm -R dist/ && rm -R build/ && rm -R nrdash.egg-info/ && python setup.py sdist bdist_wheel

per-commit: lint coverage

publish-coverage:
coveralls

publish-pypi: package
python3 -m twine upload --verbose --username ${PYPI_USERNAME} --password ${PYPI_PASSWORD} --repository-url https://upload.pypi.org/legacy/ dist/*

publish-pypi-test: package
python3 -m twine upload --verbose --username ${PYPI_TEST_USERNAME} --password ${PYPI_TEST_PASSWORD} --repository-url https://test.pypi.org/legacy/ dist/*

test:
python -m pytest -vv

Expand Down
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ mypy = "==0.720"
black = "==19.3b0"
coverage = "*"
coveralls = "*"
twine = "*"

[requires]
python_version = "3.7"
142 changes: 103 additions & 39 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,27 @@ jobs:
workingDirectory: '$(System.DefaultWorkingDirectory)'
env:
COVERALLS_REPO_TOKEN: $(COVERALLS_REPO_TOKEN)

- job: Publish
dependsOn:
- Build
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/')) # Only publish on tags
pool:
vmImage: 'Ubuntu 16.04'

steps:
- task: UsePythonVersion@0
displayName: Setup Python
inputs:
versionSpec: '3.7'

- bash: 'make install'
displayName: Install Dependencies
workingDirectory: '$(System.DefaultWorkingDirectory)'

- bash: 'make publish-pypi'
displayName: Publish Package to PyPi
workingDirectory: '$(System.DefaultWorkingDirectory)'
env:
PYPI_USERNAME: $(PYPI_USERNAME)
PYPI_PASSWORD: $(PYPI_PASSWORD)
23 changes: 23 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import setuptools


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


setuptools.setup(
name="nrdash",
description="New Relic Dashboard Builder",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/gatkin/nrdashboards",
version="0.0.2rc1",
author="Greg Atkin",
author_email="greg.scott.atkin@gmail.com",
license="MIT",
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
]
)

0 comments on commit eb703f8

Please sign in to comment.