diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml new file mode 100644 index 0000000..dfc96bd --- /dev/null +++ b/.github/workflows/pylint.yml @@ -0,0 +1,24 @@ +name: Pylint + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pylint + - name: Analysing the code with pylint + run: | + pylint $(git ls-files '*.py') diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml new file mode 100644 index 0000000..c19ce10 --- /dev/null +++ b/.github/workflows/python-app.yml @@ -0,0 +1,43 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Python application + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + pytest diff --git a/main.py b/main.py index 43830f9..ae517db 100644 --- a/main.py +++ b/main.py @@ -319,5 +319,8 @@ def send_draft(draft_id: int, drafts_file: str = DRAFTS_FILE): typer.echo(f"Draft with ID {draft_id} sent and removed from drafts.") +def main(): + app() + if __name__ == "__main__": - app() \ No newline at end of file + main() diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..f04a8b4 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,25 @@ +[build-system] +requires = ["setuptools>=80.0,<81.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "threads-cli" +version = "1.1.2" +maintainers = [ + { name = "Peter Lord", email = "hello@ptrlrd.com" } +] +authors = [ + { name = "Peter Lord", email = "hello@ptrlrd.com" }, + { name = "Muhammad Amin Boubaker", email = "muhammadaminboubaker@gmail.com" } +] +description = "CLI tool for interacting with Meta Threads" +readme = "README.md" +requires-python = ">=3.8, <3.14" +dependencies = [ + "requests>=2.32,<3.0", + "typer>=0.12.3,<1.0", + "rich>=13.7,<14.0", + "python-dotenv>=1.0,<2.0" +] +[project.scripts] +threads-cli = "main:main" diff --git a/requirements.txt b/requirements.txt index 55f5a34..9b8da84 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ -typer==0.12.3 -rich==13.7.1 -python-dotenv==1.0.1 +requests>=2.32 +typer==0.12 +rich==13.7 +python-dotenv==1.0 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..6068493 --- /dev/null +++ b/setup.py @@ -0,0 +1,3 @@ +from setuptools import setup + +setup()