Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save oumar90/68f2eec7334d3605b17cef9bbd7bf0d5 to your computer and use it in GitHub Desktop.
Save oumar90/68f2eec7334d3605b17cef9bbd7bf0d5 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![](https://indianpythonista.files.wordpress.com/2017/01/pypi.png)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Setting up the package"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"weather-report/\n",
" setup.py\n",
" README.md\n",
" LICENSE\n",
" MANIFEST.in\n",
" \n",
" weather_reporter/\n",
" cli.py\n",
" utils.py"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 1. setup.py"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from setuptools import setup\n",
"\n",
"def readme():\n",
" with open('README.md') as f:\n",
" README = f.read()\n",
" return README\n",
"\n",
"\n",
"setup(\n",
" name=\"weather-reporter\",\n",
" version=\"1.0.0\",\n",
" description=\"A Python package to get weather reports for any location.\",\n",
" long_description=readme(),\n",
" long_description_content_type=\"text/markdown\",\n",
" url=\"https://github.com/nikhilkumarsingh/weather-reporter\",\n",
" author=\"Nikhil Kumar Singh\",\n",
" author_email=\"nikhilksingh97@gmail.com\",\n",
" license=\"MIT\",\n",
" classifiers=[\n",
" \"License :: OSI Approved :: MIT License\",\n",
" \"Programming Language :: Python :: 3\",\n",
" \"Programming Language :: Python :: 3.7\",\n",
" ],\n",
" packages=[\"weather_reporter\"],\n",
" include_package_data=True,\n",
" install_requires=[\"requests\"],\n",
" entry_points={\n",
" \"console_scripts\": [\n",
" \"weather-reporter=weather_reporter.cli:main\",\n",
" ]\n",
" },\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 2. README.md"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Weather Reporter\n",
"\n",
"A Python package to get weather reports for any location.\n",
"\n",
"## Usage\n",
"\n",
"Following query on terminal will provide you the weather details of \"delhi\" for next 3 days.\n",
"\n",
"```\n",
"weather-reporter -q delhi -d 3\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 3. LICENSE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Copyright <YEAR> <AUTHOR>\n",
"\n",
"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:\n",
"\n",
"The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n",
"\n",
"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."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 4. MANIFEST.in"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"include README.md LICENSE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"---------\n",
"# Publishing to PyPI"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 1. Building package\n",
"\n",
"```\n",
"python setup.py sdist bdist_wheel\n",
"```\n",
"\n",
"[Wheels](https://pythonwheels.com/)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 2. Check distribution\n",
"\n",
"```\n",
"twine check dist/*\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 3. [TestPyPI: Test Python package publishing with the Test Python Package Index](https://test.pypi.org/)\n",
"\n",
"```\n",
"twine upload --repository-url https://test.pypi.org/legacy/ dist/*\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 4. [PyPI: Find, install and publish Python packages with the Python Package Index](https://pypi.org/)\n",
"\n",
"```\n",
"twine upload --repository-url https://upload.pypi.org/legacy/ dist/*\n",
"```"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.7"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment