Skip to content

Commit d370b9b

Browse files
authored
Dev Commit (#10)
* Update randomdataset.rst * Update index.rst * Update conf.py and index.rst * Update .gitignore, conf.py, and 3 more files... * File updates and restructuring * Update generator.py * Updates and reorganization * Adding notebook for Exetera example * Update exeteraschema.json * Added Exetera example * CI/CD fix * Cleanup * Adding Codecov support * Update README.md * Tweak * Adding documentation * Adding Documentation * Adding commentary * Notebook update * Remove path line * Update * Added merge example * Adding examples * Fix * Added _version.py file for clean versioning in setup.py This avoids importing the package in the setup.py file, which would fail if dependencies are missing * Fix * Pypi release (#9) * ExeTera Example and Version Changes (#8) * Update randomdataset.rst * Update index.rst * Update conf.py and index.rst * Update .gitignore, conf.py, and 3 more files... * File updates and restructuring * Update generator.py * Updates and reorganization * Adding notebook for Exetera example * Update exeteraschema.json * Added Exetera example * CI/CD fix * Cleanup * Adding Codecov support * Update README.md * Tweak * Adding documentation * Adding Documentation * Adding commentary * Notebook update * Remove path line * Update * Added merge example * Adding examples * Fix * Added _version.py file for clean versioning in setup.py This avoids importing the package in the setup.py file, which would fail if dependencies are missing * Fix * Create python-publish.yml * Update README.md, _version.py, and setup.py
1 parent 7c5cbe6 commit d370b9b

File tree

4 files changed

+67
-5
lines changed

4 files changed

+67
-5
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# This workflow will upload a Python Package using Twine when a release is created
2+
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3+
4+
# This workflow uses actions that are not certified by GitHub.
5+
# They are provided by a third-party and are governed by
6+
# separate terms of service, privacy policy, and support
7+
# documentation.
8+
9+
name: Upload Python Package
10+
11+
on:
12+
release:
13+
types: [published]
14+
15+
jobs:
16+
deploy:
17+
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- uses: actions/checkout@v2
22+
- name: Set up Python
23+
uses: actions/setup-python@v2
24+
with:
25+
python-version: '3.x'
26+
- name: Install dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install build
30+
- name: Build package
31+
run: python -m build
32+
- name: Publish package
33+
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
34+
with:
35+
user: __token__
36+
password: ${{ secrets.PYPI_API_TOKEN }}

README.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,27 @@ A relatively simple set of features which link into the code are set up on this
7474
Both ReadTheDocs and Codecov are integrated with the repo as webhooks. These can be setup through their respective sites
7575
which require Github credentials to link with repos.
7676

77-
This repo mostly follows [GitFlow](http://datasift.github.io/gitflow/IntroducingGitFlow.html) with a `master` branch which is always
78-
the current release of the code, and a `dev` branch that is the development version of the code.
79-
Branch protection rules are in place for `master` which ensure that code can only be committed to the branch through reviewed PRs:
77+
This repo mostly follows [GitFlow](http://datasift.github.io/gitflow/IntroducingGitFlow.html) with a `master` branch
78+
which is always the current release of the code, and a `dev` branch that is the development version of the code.
79+
Branch protection rules are in place for `master` which ensure that code can only be committed to the branch through
80+
reviewed PRs:
8081

8182
* Require pull request reviews before merging
8283
* Require status checks to pass before merging ("build" action selected)
8384
* Require branches to be up to date before merging
8485
* Require linear history
8586
* Include administrators
8687

88+
## PyPI Release
89+
90+
Whenever a new release is made this is uploaded automatically to PyPI using the default Github workflow "Publish Python
91+
Package". To upload to PyPI [these steps](https://packaging.python.org/tutorials/packaging-projects/) explain the
92+
process. For this repo the basic steps are:
93+
94+
1. Create account on pypi.org
95+
2. Create a wheel file with `python setup.py bdist_wheel`, this creates `dist/RandomDataset-0.1.0-py3-none-any.whl`
96+
3. Upload this package manually to PyPI with `python -m twine upload dist/*` (assuming you have twine already installed)
97+
4. Get the API token for the new package and set it to the secret `PYPI_API_TOKEN` in the repository's settings
98+
5. Add the workflow file `.github/workflows/python-publish.yml` from [here](https://github.com/actions/starter-workflows/blob/main/ci/python-publish.yml).
99+
6. Commit changes and create a release for the project, this should upload to PyPI automatically
100+

randomdataset/_version.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,15 @@
22
# Copyright (c) 2021 Eric Kerfoot, KCL, see LICENSE file
33

44
__appname__ = "RandomDataset"
5-
__version_info__ = (0, 1, 0) # global application version, major/minor/patch
5+
__version_info__ = (0, 1, 2) # global application version, major/minor/patch
66
__version__ = "%i.%i.%i" % __version_info__
77
__description__ = "Random dataset generation tool"
88
__author__ = "Eric Kerfoot, KCL"
99
__author_email__ = "eric.kerfoot@kcl.ac.uk"
1010
__copyright__ = "Copyright (c) 2021 Eric Kerfoot, King's College London, all rights reserved. Licensed under MIT License (see LICENSE.txt)."
11+
__url__ = "https://github.com/ericspod/RandomDataset"
12+
__license__ = "MIT"
13+
__long_description__ = """
14+
RandomDataset is a tool for generating randomized tabular data for testing databases, import routines, algorithms, etc.
15+
It's oriented towards creating CSV files primarily for importation into simple database structures or tables.
16+
""".strip()

setup.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@
55
from setuptools import setup, find_packages
66
from pkg_resources import parse_requirements
77

8+
# It's important to note that this file doesn't import randomdataset to get the version information, but interprets
9+
# the _version.py file instead. This prevents the situation when installing using this file without all the depenencies
10+
# already present, this file won't be runnable in this case.
811

912
source_dir = os.path.abspath(os.path.dirname(__file__))
1013

11-
# read the version and other strings from _version.py
14+
# read the version and other data from _version.py
1215
with open(os.path.join(source_dir, "randomdataset/_version.py")) as o:
1316
exec(o.read())
1417

@@ -20,8 +23,11 @@
2023
name=__appname__,
2124
version=__version__,
2225
description=__description__,
26+
long_description=__long_description__,
2327
author=__author__,
2428
author_email=__author_email__,
29+
url=__url__,
30+
license=__license__,
2531
packages=find_packages(),
2632
install_requires=requirements,
2733
entry_points={"console_scripts": ["generate_dataset = randomdataset:generate_dataset"]},

0 commit comments

Comments
 (0)