Skip to content

Commit 5acf38c

Browse files
committed
changed setup and realese workflow
1 parent 4a45d13 commit 5acf38c

File tree

3 files changed

+35
-85
lines changed

3 files changed

+35
-85
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Release
13-
uses: patrick-kidger/action_update_python_project@v2
13+
uses: patrick-kidger/action_update_python_project@v1
1414
with:
1515
python-version: "3.11"
1616
test-script: |
1717
python -m pip install pytest
1818
cp -r ${{ github.workspace }}/test ./test
19-
python -m test
19+
pytest --verbose --disable-warnings
2020
pypi-token: ${{ secrets.pypi_token }}
2121
github-user: KyloRen1
2222
github-token: ${{ github.token }}

setup.py

Lines changed: 29 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,38 @@
1-
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*-
1+
import re
2+
import pathlib
3+
import setuptools
34

4-
# Note:
5-
# To use the "upload" functionality of this file, you must:
6-
# $ pipenv install twine --dev
7-
# To publish the package:
8-
# $ setup.py
95

10-
import os
11-
import sys
12-
from shutil import rmtree
13-
from setuptools import find_packages, setup, Command
6+
_here = pathlib.Path()
147

15-
NAME = "ua-datasets"
16-
DESCRIPTION = "A collection of ukrainian language datasets"
17-
URL = "https://github.com/fido-ai/ua-datasets"
18-
# EMAIL = "me@example.com"
19-
AUTHOR = "FIdo AI"
20-
REQUIRES_PYTHON = ">=3.7.0"
21-
VERSION = "0.0.1"
22-
REQUIRED = [
23-
]
24-
EXTRAS = {
25-
# Optional packages
26-
}
8+
name = "ua-datasets"
9+
author = "FIdo AI"
10+
description = "A collection of ukrainian language datasets"
11+
python_requires = ">=3.7.0"
12+
url = "https://github.com/fido-ai/" + name
2713

28-
here = os.path.abspath(os.path.dirname(__file__))
29-
print(here)
3014

31-
# Import the README and use it as the long-description.
32-
# Note: this will only work if "README.md" is present in your MANIFEST.in file!
33-
try:
34-
with open(os.path.join(here, "README.md"), encoding="utf-8") as f:
35-
LONG_DESCRIPTION = f.read()
36-
except FileNotFoundError:
37-
LONG_DESCRIPTION = DESCRIPTION
15+
with open(_here / name.replace('-', '_') / "__init__.py") as f:
16+
meta_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", f.read(), re.M)
17+
if meta_match:
18+
version = meta_match.group(1)
19+
else:
20+
raise RuntimeError("Unable to find __version__ string")
3821

22+
with open(_here / "README.md" , "r") as f:
23+
readme = f.read()
3924

40-
class UploadCommand(Command):
41-
"""Support setup.py upload"""
4225

43-
description = "Build and publish the package"
44-
user_options = []
45-
46-
@staticmethod
47-
def status(s):
48-
"""Prints things in bold."""
49-
print("\033[1m{0}\033[0m".format(s))
50-
51-
def initialize_options(self):
52-
pass
53-
54-
def finalize_options(self):
55-
pass
56-
57-
def run(self):
58-
try:
59-
self.status("Removing previous builds...")
60-
rmtree(os.path.join(here, "dist"))
61-
except OSError:
62-
pass
63-
64-
self.status("Building Source and Wheel (universal) distribution...")
65-
os.system("{0} setup.py sdist bdist_wheel --universal".format(sys.executable))
66-
67-
self.status("Uploading the package to PyPI via Twine...")
68-
os.system("twine upload dist/*")
69-
70-
self.status("Pushing git tags...")
71-
os.system("git tag v{0}".format(VERSION))
72-
os.system("git push --tags")
73-
74-
sys.exit()
75-
76-
77-
setup(
78-
name=NAME,
79-
version=VERSION,
80-
description=DESCRIPTION,
81-
long_description=LONG_DESCRIPTION,
26+
setuptools.setup(
27+
name=name,
28+
version=version,
29+
author=author,
30+
description=description,
31+
long_description=readme,
8232
long_description_content_type="text/markdown",
83-
author=AUTHOR,
84-
# author_email=EMAIL,
85-
python_requires=REQUIRES_PYTHON,
86-
url=URL,
87-
packages=find_packages(exclude=["tests", "*.tests", "*.tests.*", "tests.*"]),
88-
install_requires=REQUIRED,
89-
extras_require=EXTRAS,
33+
python_requires=python_requires,
34+
url=url,
35+
install_requires=[],
9036
include_package_data=True,
9137
license="MIT", # Don't forget to change classifiers if you change the license
9238
classifiers=[
@@ -99,7 +45,7 @@ def run(self):
9945
"Programming Language :: Python :: 3",
10046
"Programming Language :: Python :: 3.7",
10147
],
102-
cmdclass={
103-
"upload": UploadCommand,
104-
},
48+
packages=setuptools.find_packages(
49+
exclude=["tests", "*.tests", "*.tests.*", "tests.*"]
50+
),
10551
)

ua_datasets/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
from ua_datasets.question_answering import UaSquadDataset
22
from ua_datasets.text_classification import NewsClassificationDataset
33
from ua_datasets.token_classification import MovaInstitutePOSDataset
4+
5+
6+
7+
__version__ = '0.0.2'

0 commit comments

Comments
 (0)