Skip to content

Commit

Permalink
Merge pull request #34 from statisticsnorway/feature/add-publish-work…
Browse files Browse the repository at this point in the history
…flow

Add workflow for publishing to PyPi
  • Loading branch information
bjornandre authored Nov 28, 2022
2 parents 84f8611 + 96a55ea commit ec89797
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 233 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Publish package to PyPI
on:
push:
tags:
- "*.*.*"
jobs:
build:
runs-on: ubuntu-latest
environment: PyPI
steps:
- uses: actions/checkout@v3
- name: Build and publish to pypi
uses: JRubics/[email protected]
with:
pypi_token: ${{ secrets.PYPI_API_TOKEN }}
ignore_dev_requirements: "yes"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,5 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/
/tests/output/*.*
/pytest.xml
/pytest-coverage.txt
242 changes: 9 additions & 233 deletions demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 7,
"execution_count": null,
"id": "0590e9d3-e978-43de-b17d-695b93105143",
"metadata": {},
"outputs": [],
Expand All @@ -12,267 +12,43 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": null,
"id": "10374bb7-ed85-47b2-87bf-964436f54786",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/bjornandre/Library/Caches/pypoetry/virtualenvs/dapla-toolbelt-iCf-zdcD-py3.10/lib/python3.10/site-packages/google/auth/_default.py:83: UserWarning: Your application has authenticated using end user credentials from Google Cloud SDK without a quota project. You might receive a \"quota exceeded\" or \"API not enabled\" error. We recommend you rerun `gcloud auth application-default login` and make sure a quota project is added. Or you can use service accounts instead. For more information about service accounts, see https://cloud.google.com/docs/authentication/\n",
" warnings.warn(_CLOUD_SDK_CREDENTIALS_WARNING)\n"
]
},
{
"data": {
"text/plain": [
"['/airline',\n",
" '/dnscensus2013',\n",
" '/github-data',\n",
" '/iris',\n",
" '/nyc-taxi',\n",
" '/nyc-taxi/2015.parquet',\n",
" '/nyc-taxi/csv',\n",
" '/nyc-taxi/csv/2014',\n",
" '/nyc-taxi/csv/2015',\n",
" '/nyc-taxi/csv/2016',\n",
" '/nyc-taxi/nyc.parquet',\n",
" '/nyc-taxi/taxi.parquet',\n",
" '/orc',\n",
" '/packages',\n",
" '/projects-data',\n",
" '/projects-data/tensorboard']"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"# Show contents of folder recursively\n",
"dp.show('gs://anaconda-public-data')"
]
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": null,
"id": "4d987875-af1b-4c0d-9a6e-2ad16bc3b223",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/bjornandre/Library/Caches/pypoetry/virtualenvs/dapla-toolbelt-iCf-zdcD-py3.10/lib/python3.10/site-packages/google/auth/_default.py:83: UserWarning: Your application has authenticated using end user credentials from Google Cloud SDK without a quota project. You might receive a \"quota exceeded\" or \"API not enabled\" error. We recommend you rerun `gcloud auth application-default login` and make sure a quota project is added. Or you can use service accounts instead. For more information about service accounts, see https://cloud.google.com/docs/authentication/\n",
" warnings.warn(_CLOUD_SDK_CREDENTIALS_WARNING)\n"
]
},
{
"data": {
"text/plain": [
"[{'Size': 4636,\n",
" 'Name': '/iris/iris.csv',\n",
" 'Created': '2017-04-05T21:51:42.503Z',\n",
" 'Updated': '2017-04-05T21:51:42.503Z'}]"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"# Show file or folder detalis\n",
"dp.details('gs://anaconda-public-data/iris/iris.csv')"
]
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": null,
"id": "c3ce598a-031c-4b40-92a0-36cd44cfd0d9",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/bjornandre/Library/Caches/pypoetry/virtualenvs/dapla-toolbelt-iCf-zdcD-py3.10/lib/python3.10/site-packages/google/auth/_default.py:83: UserWarning: Your application has authenticated using end user credentials from Google Cloud SDK without a quota project. You might receive a \"quota exceeded\" or \"API not enabled\" error. We recommend you rerun `gcloud auth application-default login` and make sure a quota project is added. Or you can use service accounts instead. For more information about service accounts, see https://cloud.google.com/docs/authentication/\n",
" warnings.warn(_CLOUD_SDK_CREDENTIALS_WARNING)\n"
]
},
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>petal_length</th>\n",
" <th>sepal_length</th>\n",
" <th>petal_width</th>\n",
" <th>sepal_width</th>\n",
" <th>species</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>5.1</td>\n",
" <td>3.5</td>\n",
" <td>1.4</td>\n",
" <td>0.2</td>\n",
" <td>Iris-setosa</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>4.9</td>\n",
" <td>3.0</td>\n",
" <td>1.4</td>\n",
" <td>0.2</td>\n",
" <td>Iris-setosa</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>4.7</td>\n",
" <td>3.2</td>\n",
" <td>1.3</td>\n",
" <td>0.2</td>\n",
" <td>Iris-setosa</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>4.6</td>\n",
" <td>3.1</td>\n",
" <td>1.5</td>\n",
" <td>0.2</td>\n",
" <td>Iris-setosa</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>5.0</td>\n",
" <td>3.6</td>\n",
" <td>1.4</td>\n",
" <td>0.2</td>\n",
" <td>Iris-setosa</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>146</th>\n",
" <td>6.7</td>\n",
" <td>3.0</td>\n",
" <td>5.2</td>\n",
" <td>2.3</td>\n",
" <td>Iris-virginica</td>\n",
" </tr>\n",
" <tr>\n",
" <th>147</th>\n",
" <td>6.3</td>\n",
" <td>2.5</td>\n",
" <td>5.0</td>\n",
" <td>1.9</td>\n",
" <td>Iris-virginica</td>\n",
" </tr>\n",
" <tr>\n",
" <th>148</th>\n",
" <td>6.5</td>\n",
" <td>3.0</td>\n",
" <td>5.2</td>\n",
" <td>2.0</td>\n",
" <td>Iris-virginica</td>\n",
" </tr>\n",
" <tr>\n",
" <th>149</th>\n",
" <td>6.2</td>\n",
" <td>3.4</td>\n",
" <td>5.4</td>\n",
" <td>2.3</td>\n",
" <td>Iris-virginica</td>\n",
" </tr>\n",
" <tr>\n",
" <th>150</th>\n",
" <td>5.9</td>\n",
" <td>3.0</td>\n",
" <td>5.1</td>\n",
" <td>1.8</td>\n",
" <td>Iris-virginica</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>151 rows × 5 columns</p>\n",
"</div>"
],
"text/plain": [
" petal_length sepal_length petal_width sepal_width species\n",
"0 5.1 3.5 1.4 0.2 Iris-setosa\n",
"1 4.9 3.0 1.4 0.2 Iris-setosa\n",
"2 4.7 3.2 1.3 0.2 Iris-setosa\n",
"3 4.6 3.1 1.5 0.2 Iris-setosa\n",
"4 5.0 3.6 1.4 0.2 Iris-setosa\n",
".. ... ... ... ... ...\n",
"146 6.7 3.0 5.2 2.3 Iris-virginica\n",
"147 6.3 2.5 5.0 1.9 Iris-virginica\n",
"148 6.5 3.0 5.2 2.0 Iris-virginica\n",
"149 6.2 3.4 5.4 2.3 Iris-virginica\n",
"150 5.9 3.0 5.1 1.8 Iris-virginica\n",
"\n",
"[151 rows x 5 columns]"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"# Read a csv file into a Pandas dataframe\n",
"dp.read_pandas('gs://anaconda-public-data/iris/iris.csv', file_format=\"csv\")"
]
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"id": "b39ea535-f801-445a-b1d7-6dd9013c08da",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/bjornandre/Library/Caches/pypoetry/virtualenvs/dapla-toolbelt-iCf-zdcD-py3.10/lib/python3.10/site-packages/google/auth/_default.py:83: UserWarning: Your application has authenticated using end user credentials from Google Cloud SDK without a quota project. You might receive a \"quota exceeded\" or \"API not enabled\" error. We recommend you rerun `gcloud auth application-default login` and make sure a quota project is added. Or you can use service accounts instead. For more information about service accounts, see https://cloud.google.com/docs/authentication/\n",
" warnings.warn(_CLOUD_SDK_CREDENTIALS_WARNING)\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"b'petal_length,sepal_length,petal_width,sepal_width,species\\n'\n"
]
}
],
"outputs": [],
"source": [
"from dapla import FileClient\n",
"\n",
Expand Down

0 comments on commit ec89797

Please sign in to comment.