Skip to content

Commit ad48cf7

Browse files
authored
Refactor: Modernized code infrastructure, remove unused files (#30)
1 parent ff01641 commit ad48cf7

13 files changed

Lines changed: 760 additions & 151 deletions

.github/workflows/python-publish.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ name: Upload Python Package
1010

1111
on:
1212
workflow_dispatch:
13+
inputs:
14+
branch:
15+
description: 'Branch to run from (use "v0" to publish from v0)'
16+
required: false
17+
default: 'main'
1318
release:
1419
types: [published]
1520

@@ -23,7 +28,14 @@ jobs:
2328
# IMPORTANT: this permission is mandatory for trusted publishing
2429
id-token: write
2530
steps:
26-
- uses: actions/checkout@v4
31+
- name: Checkout (release or default)
32+
if: ${{ github.event_name != 'workflow_dispatch' }}
33+
uses: actions/checkout@v4
34+
- name: Checkout (manual dispatch branch)
35+
if: ${{ github.event_name == 'workflow_dispatch' }}
36+
uses: actions/checkout@v4
37+
with:
38+
ref: ${{ github.event.inputs.branch }}
2739
- name: Set up Python
2840
uses: actions/setup-python@v4
2941
with:

.github/workflows/python.yml

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,48 @@ name: phrasetms_client Python package
77

88
on:
99
push:
10-
branches: [ main ]
10+
branches: [ main, v0 ]
1111
pull_request:
12-
branches: [ main ]
12+
branches: [ main, v0 ]
1313

1414
jobs:
15-
build:
15+
build-main:
16+
name: Build (main)
17+
if: |
18+
(github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'main') || (github.ref == 'refs/heads/main')
19+
runs-on: ubuntu-22.04
20+
strategy:
21+
matrix:
22+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
23+
steps:
24+
- uses: actions/checkout@v3
25+
- name: Set up Python ${{ matrix.python-version }}
26+
uses: actions/setup-python@v4
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
- name: Install dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip install flake8 pytest
33+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
34+
- name: Lint with flake8
35+
run: |
36+
# stop the build if there are Python syntax errors or undefined names
37+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
38+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
39+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
40+
- name: Test with pytest
41+
run: |
42+
pytest
1643
44+
build-v0:
45+
name: Build (v0)
46+
if: |
47+
(github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'v0') || (github.ref == 'refs/heads/v0')
1748
runs-on: ubuntu-22.04
1849
strategy:
1950
matrix:
2051
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
21-
2252
steps:
2353
- uses: actions/checkout@v3
2454
- name: Set up Python ${{ matrix.python-version }}

.gitignore

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,5 @@ venv/
4949
.python-version
5050
.pytest_cache
5151

52-
# Translations
53-
*.mo
54-
*.pot
55-
56-
# Django stuff:
57-
*.log
58-
59-
# Sphinx documentation
60-
docs/_build/
61-
6252
# PyBuilder
6353
target/
64-
65-
#Ipython Notebook
66-
.ipynb_checkpoints

.gitlab-ci.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

.openapi-generator-ignore

Lines changed: 0 additions & 23 deletions
This file was deleted.

.travis.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ Python client for Phrase TMS.
44

55
This Python package was initially automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project.
66

7-
## Requirements.
7+
## Requirements
88

9-
Python 3.7+
9+
Python 3.9+
1010

1111
## Installation & Usage
1212

docs.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
## Documentation for API Endpoints
42

53
All URIs are relative to *https://cloud.memsource.com/web*

git_push.sh

Lines changed: 0 additions & 57 deletions
This file was deleted.

pyproject.toml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,43 @@ classifiers = [
1111
"Intended Audience :: Developers",
1212
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
1313
"Operating System :: OS Independent",
14-
"Programming Language :: Python :: 3.7",
15-
"Programming Language :: Python :: 3.8",
1614
"Programming Language :: Python :: 3.9",
1715
"Programming Language :: Python :: 3.10",
1816
"Programming Language :: Python :: 3.11",
17+
"Programming Language :: Python :: 3.12",
18+
"Programming Language :: Python :: 3.13",
1919
]
2020
repository = "https://github.com/Martin005/phrasetms-python"
2121
keywords = ["Phrase TMS API", "Phrase TMS"]
2222

2323
[tool.poetry.dependencies]
24-
python = "^3.7"
24+
python = "^3.9"
2525

2626
urllib3 = ">= 1.25.3"
2727
python-dateutil = ">=2.8.2"
2828
pydantic = "^1.10.5, <2"
2929
aenum = ">=3.1.11"
3030

31+
[project]
32+
name = "phrasetms_client"
33+
version = "0.3.14"
34+
description = "Phrase TMS API"
35+
readme = "README.md"
36+
requires-python = ">=3.9"
37+
dependencies = [
38+
"setuptools >= 21.0.0",
39+
"python-dateutil >= 2.5.3",
40+
"urllib3 >= 1.25.3",
41+
"pydantic >= 2.0.0",
42+
]
43+
44+
[dependency-groups]
45+
dev = [
46+
"pytest >= 7.2.1",
47+
"tox >= 3.9.0",
48+
"flake8 >= 4.0.0",
49+
]
50+
3151
[tool.poetry.dev-dependencies]
3252
pytest = ">=7.2.1"
3353
tox = ">=3.9.0"
@@ -39,3 +59,4 @@ build-backend = "setuptools.build_meta"
3959

4060
[tool.pylint.'MESSAGES CONTROL']
4161
extension-pkg-whitelist = "pydantic"
62+

0 commit comments

Comments
 (0)