Skip to content

Commit a8ec923

Browse files
author
Rustem
committed
publish project workflows
1 parent 6d9b82d commit a8ec923

6 files changed

Lines changed: 206 additions & 1 deletion

File tree

.github/workflows/publish.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch: # Allows manual trigger
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
14+
15+
steps:
16+
- uses: actions/checkout@v3
17+
18+
- name: Set up Python ${{ matrix.python-version }}
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: ${{ matrix.python-version }}
22+
23+
- name: Install package
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install -e .
27+
28+
- name: Test basic functionality
29+
run: |
30+
textnano --help || echo "CLI not fully configured yet"
31+
python -c "import textnano; print('Import successful')"
32+
33+
publish:
34+
needs: test
35+
runs-on: ubuntu-latest
36+
if: github.event_name == 'release'
37+
38+
steps:
39+
- uses: actions/checkout@v3
40+
41+
- name: Set up Python
42+
uses: actions/setup-python@v4
43+
with:
44+
python-version: '3.10'
45+
46+
- name: Install dependencies
47+
run: |
48+
python -m pip install --upgrade pip
49+
pip install build twine
50+
51+
- name: Build package
52+
run: python -m build
53+
54+
- name: Check package
55+
run: twine check dist/*
56+
57+
- name: Publish to PyPI
58+
env:
59+
TWINE_USERNAME: __token__
60+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
61+
run: twine upload dist/*

.github/workflows/test0publish.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Test Publish to TestPyPI
2+
3+
on:
4+
push:
5+
branches: [ main, master, develop ]
6+
pull_request:
7+
branches: [ main, master ]
8+
workflow_dispatch: # Allows manual trigger
9+
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
25+
- name: Install package
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install -e .
29+
30+
- name: Test basic functionality
31+
run: |
32+
textnano --help || echo "CLI not fully configured yet"
33+
python -c "import textnano; print('Import successful')"
34+
35+
test-publish:
36+
needs: test
37+
runs-on: ubuntu-latest
38+
# Only publish on manual trigger or push to main/master
39+
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'))
40+
41+
steps:
42+
- uses: actions/checkout@v3
43+
44+
- name: Set up Python
45+
uses: actions/setup-python@v4
46+
with:
47+
python-version: '3.10'
48+
49+
- name: Install dependencies
50+
run: |
51+
python -m pip install --upgrade pip
52+
pip install build twine
53+
54+
- name: Build package
55+
run: python -m build
56+
57+
- name: Check package
58+
run: twine check dist/*
59+
60+
- name: Publish to TestPyPI
61+
env:
62+
TWINE_USERNAME: __token__
63+
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
64+
run: |
65+
python -m twine upload --repository testpypi dist/* --skip-existing

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ __pycache__
77

88
# Datasets and test folders
99
dataset/
10+
dist/
1011
test_dataset/
1112
test_main/
1213
final_test/

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Rustem
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

MANIFEST.in

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# Include documentation
22
include README.md
3-
include QUICKSTART.md
43
include LICENSE
54

65
# Include package data
76
recursive-include textnano *.py
7+
recursive-include textnano *.txt
8+
recursive-include textnano *.json
89

910
# Exclude unnecessary files
11+
recursive-exclude textnano/examples *
1012
global-exclude __pycache__
1113
global-exclude *.py[co]
1214
global-exclude .DS_Store

pyproject.toml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
[build-system]
2+
requires = ["setuptools>=61.0", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "textnano"
7+
version = "0.1.0"
8+
description = "A minimal text dataset builder inspired by lazynlp. Perfect for ML students who just want clean text datasets quickly."
9+
readme = "README.md"
10+
requires-python = ">=3.7"
11+
license = {text = "MIT"}
12+
keywords = ["nlp", "machine-learning", "dataset", "text-processing", "web-scraping", "data-cleaning"]
13+
authors = [
14+
{name = "Rustem", email = "r.kamun@gmail.com"}
15+
]
16+
classifiers = [
17+
"Development Status :: 4 - Beta",
18+
"Intended Audience :: Developers",
19+
"Intended Audience :: Science/Research",
20+
"License :: OSI Approved :: MIT License",
21+
"Programming Language :: Python :: 3",
22+
"Programming Language :: Python :: 3.7",
23+
"Programming Language :: Python :: 3.8",
24+
"Programming Language :: Python :: 3.9",
25+
"Programming Language :: Python :: 3.10",
26+
"Programming Language :: Python :: 3.11",
27+
"Programming Language :: Python :: 3.12",
28+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
29+
"Topic :: Text Processing",
30+
"Topic :: Software Development :: Libraries :: Python Modules",
31+
]
32+
33+
dependencies = [] # Zero dependencies as advertised!
34+
35+
[project.optional-dependencies]
36+
dev = [
37+
"pytest>=7.0",
38+
"black>=22.0",
39+
"flake8>=4.0",
40+
]
41+
42+
[project.urls]
43+
Homepage = "https://github.com/Rustem/textnano"
44+
Documentation = "https://github.com/Rustem/textnano#readme"
45+
Repository = "https://github.com/Rustem/textnano"
46+
"Bug Tracker" = "https://github.com/Rustem/textnano/issues"
47+
48+
[project.scripts]
49+
textnano = "textnano.cli:main"
50+
51+
[tool.setuptools]
52+
packages = ["textnano"]
53+
54+
[tool.setuptools.package-data]
55+
textnano = ["*.txt", "*.json"]

0 commit comments

Comments
 (0)