Skip to content

Commit 613ae57

Browse files
authored
Prepare Publishing (#5)
Documentation: * Update README.md Publishing: * Create publish.yml * Create pyproject.toml * Create setup.py Repackaging: * Combine all source files into a single package * Combine all test files into a single package * Move __main__.py into treescriptify package
1 parent 0efbd80 commit 613ae57

17 files changed

+116
-18
lines changed

.github/workflows/publish.yml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Create and Publish repository Packages
2+
3+
name: Publish Packages on Release
4+
5+
on:
6+
release:
7+
types: [ created ]
8+
9+
jobs:
10+
publish:
11+
runs-on: ubuntu-latest
12+
environment:
13+
name: deployment
14+
url: https://pypi.org/p/treescriptify
15+
16+
permissions:
17+
contents: read
18+
packages: write
19+
id-token: write
20+
21+
name: Publish Release
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Set up Python
26+
uses: actions/setup-python@v4
27+
with:
28+
python-version: "3.12"
29+
30+
- name: Install build requirements
31+
run: |
32+
python -m pip install build setuptools twine --user
33+
34+
- name: Build a binary wheel and a source tarball
35+
run: python -m build --sdist --wheel --outdir dist/
36+
37+
- name: Sign Distributions
38+
uses: dk96-os/[email protected]
39+
with:
40+
inputs: >-
41+
./dist/*.tar.gz
42+
./dist/*.whl
43+
verify: true
44+
45+
- name: Publish package distributions to PyPI
46+
uses: pypa/gh-action-pypi-publish@release/v1
47+
with:
48+
repository-url: https://pypi.org/p/treescriptify
49+
print-hash: true
50+
verbose: true

README.md

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
1-
# TreeScriptify
2-
Get Started fast with a TreeScript generated from an existing directory.
1+
# Treescriptify
2+
Get Started fast with TreeScript generated from an existing directory.
33

44
## How To Use
5-
Run `python <path-to-tsfy-dir>` command in a directory to treescript-ify.
5+
Run the main script in a directory to treescript-ify it.
66

7-
1. You can pipe program output to a file, or
7+
1. Pipe program output to a file, or
88
2. Display it on-screen for copy-paste workflow integration.
99

10+
## How To Install
11+
You can manually install a release (if you want), or use pip.
12+
13+
`pip install treescriptify`
14+
1015
## Program Architecture
16+
The following diagram shows how the program components work together to process the data.
1117
![tsfy](https://github.com/DK96-OS/tsfy/assets/69859316/84f127f0-cf19-418b-be78-572fbb96868c)
1218

13-
19+
Note: All source modules are contained in the treescriptify package. The input package is merely symbolic in this diagram.

input/__init__.py

Whitespace-only changes.

pyproject.toml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["setuptools>=61.0", "wheel"]
3+
build-backend = "setuptools.build_meta"

setup.py

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
"""Setup Package Configuration
2+
"""
3+
from setuptools import setup, find_packages
4+
5+
6+
setup(
7+
name="treescriptify-this",
8+
version="0.1",
9+
description="Create TreeScript from an existing filesystem tree.",
10+
long_description=open('README.md').read(),
11+
long_description_content_type='text/markdown',
12+
author="DK96-OS",
13+
url="https://github.com/DK96-OS/treescriptify-this",
14+
project_urls={
15+
"Issues": "https://github.com/DK96-OS/treescriptify-this/issues",
16+
"Source Code": "https://github.com/DK96-OS/treescriptify-this"
17+
},
18+
license="GPLv2",
19+
packages=find_packages(exclude=['test']),
20+
entry_points={
21+
'console_scripts': [
22+
'treescriptify=treescriptify_this.__main__:main',
23+
'treescriptify_this=treescriptify_this.__main__:main',
24+
'treescriptify-this=treescriptify_this.__main__:main',
25+
],
26+
},
27+
classifiers=[
28+
'Natural Language :: English',
29+
'Operating System :: OS Independent',
30+
'Intended Audience :: Developers',
31+
'License :: OSI Approved :: GNU General Public License v2 (GPLv2)',
32+
'Programming Language :: Python :: 3',
33+
'Programming Language :: Python :: 3.8',
34+
'Programming Language :: Python :: 3.9',
35+
'Programming Language :: Python :: 3.10',
36+
'Programming Language :: Python :: 3.11',
37+
'Programming Language :: Python :: 3.12',
38+
],
39+
)

test/input/__init__.py

Whitespace-only changes.

test/input/test_argument_parser.py test/test_argument_parser.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"""
33
import pytest
44

5-
from input.input_data import InputData
6-
from input.argument_parser import parse_args
5+
from treescriptify.input_data import InputData
6+
from treescriptify.argument_parser import parse_args
77

88

99
@pytest.mark.parametrize(
File renamed without changes.
File renamed without changes.

test/treescriptify/test_tree_runner.py test/test_tree_runner.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import pytest
44
import subprocess
55

6-
from input.input_data import InputData
6+
from treescriptify.input_data import InputData
77
from treescriptify.tree_runner import _check_arguments, get_tree_json
88

99

treescriptify/__init__.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
"""TreeScriptify Package
22
"""
3-
from input.input_data import InputData
4-
from treescriptify.tree_runner import get_tree_json
5-
from treescriptify.tree_reader import generate_from_json
6-
from treescriptify.script_writer import generate_script
3+
from .input_data import InputData
4+
from .tree_runner import get_tree_json
5+
from .tree_reader import generate_from_json
6+
from .script_writer import generate_script
77

88

99
def tsfy(data: InputData) -> str:

__main__.py treescriptify/__main__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"""
44
from sys import argv
55

6-
from input.argument_parser import parse_args
7-
from treescriptify import tsfy
6+
from .argument_parser import parse_args
7+
from . import tsfy
88

99

1010
def main():

input/argument_parser.py treescriptify/argument_parser.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"""
33
from argparse import ArgumentParser
44

5-
from input.input_data import InputData
5+
from treescriptify.input_data import InputData
66

77

88
def parse_args(arguments: list[str]) -> InputData:
File renamed without changes.

treescriptify/script_writer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"""
33
from typing import Generator
44

5-
from treescriptify.tree_node_data import TreeNodeData
5+
from .tree_node_data import TreeNodeData
66

77

88
def generate_script(tree_nodes: Generator[TreeNodeData, None, None]) -> Generator[str, None, None]:

treescriptify/tree_reader.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import json
44
from typing import Generator
55

6-
from treescriptify.tree_node_data import TreeNodeData
6+
from .tree_node_data import TreeNodeData
77

88

99
def generate_from_json(json_string: str) -> Generator[TreeNodeData, None, None]:

treescriptify/tree_runner.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"""
33
import subprocess
44

5-
from input.input_data import InputData
5+
from treescriptify.input_data import InputData
66

77

88
def get_tree_json(data: InputData) -> str:

0 commit comments

Comments
 (0)