Skip to content

Commit 57b57df

Browse files
committed
Publish to PyPI using GitHub Actions
1 parent 695522a commit 57b57df

File tree

5 files changed

+75
-2
lines changed

5 files changed

+75
-2
lines changed

.github/workflows/dist.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
build-n-publish:
10+
name: Build and Publish Package
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Set up Python 3
15+
uses: actions/setup-python@v2
16+
with:
17+
python-version: "3.x"
18+
- name: Upgrade setuptools and wheel
19+
run: python -m pip install --user --upgrade setuptools wheel
20+
- name: Build a binary wheel and a source tarball
21+
run: python setup.py sdist bdist_wheel
22+
- name: Publish package to PyPI
23+
uses: pypa/gh-action-pypi-publish@release/v1
24+
with:
25+
password: ${{ secrets.PYPI_PASSWORD }}

mementomap/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__VERSION__ = "0.1.0b1"

main.py renamed to mementomap/__main__.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,13 @@
33
import argparse
44
import gzip
55
import sys
6+
import os
67

7-
from mementomap.mementomap import compact, generate, lookup
8+
if not __package__:
9+
sys.path.insert(1, os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
10+
11+
from mementomap import __VERSION__
12+
from mementomap.cli import compact, generate, lookup
813

914

1015
def run_generate(**kw):
@@ -60,7 +65,7 @@ def run_batchlookup(**kw):
6065
mobj.close()
6166

6267

63-
if __name__ == "__main__":
68+
def main():
6469
parser = argparse.ArgumentParser()
6570
subparsers = parser.add_subparsers()
6671

@@ -105,3 +110,7 @@ def run_batchlookup(**kw):
105110
args.func(**vars(args))
106111
except Exception as e:
107112
parser.print_help()
113+
114+
115+
if __name__ == "__main__":
116+
main()
File renamed without changes.

setup.py

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import setuptools
2+
3+
from mementomap import __VERSION__
4+
5+
with open("README.md", "r") as fh:
6+
long_description = fh.read()
7+
8+
setuptools.setup(
9+
name="mementomap",
10+
version=__VERSION__,
11+
author="Sawood Alam",
12+
author_email="[email protected]",
13+
description="A Tool to Summarize Web Archive Holdings",
14+
long_description=long_description,
15+
long_description_content_type="text/markdown",
16+
url="https://github.com/oduwsdl/MementoMap",
17+
license="MIT License",
18+
packages=setuptools.find_packages(),
19+
provides=[
20+
"mementomap"
21+
],
22+
classifiers=[
23+
"Programming Language :: Python :: 3",
24+
"License :: OSI Approved :: MIT License",
25+
"Operating System :: OS Independent",
26+
"Environment :: Console",
27+
"Topic :: Internet",
28+
"Topic :: Internet :: WWW/HTTP",
29+
"Topic :: Internet :: WWW/HTTP :: Indexing/Search",
30+
"Development Status :: 4 - Beta"
31+
],
32+
python_requires='>=3.6',
33+
entry_points={
34+
"console_scripts": [
35+
"mementomap = mementomap.__main__:main"
36+
]
37+
}
38+
)

0 commit comments

Comments
 (0)