From cebcde61aa5f55346bf7f41eba4601bc9e14f29a Mon Sep 17 00:00:00 2001 From: Neill Cox Date: Sun, 22 Oct 2023 20:43:24 +1100 Subject: [PATCH] :construction: Update skeleton to new project --- README.md | 63 +++++-------------- pyproject.toml | 24 +++++-- .../__init__.py | 0 tests/{test_skeleton.py => test_exporter.py} | 4 +- 4 files changed, 34 insertions(+), 57 deletions(-) rename src/{python_skeleton => gitea_gitlab_exporter}/__init__.py (100%) rename tests/{test_skeleton.py => test_exporter.py} (61%) diff --git a/README.md b/README.md index 77b110a..96b82f6 100644 --- a/README.md +++ b/README.md @@ -1,48 +1,13 @@ -# Python Skeleton +# GitLab2Gitea Exporter -This a skeleton for a python project +A command line tool for copying a project from GitLab to Gitea -Includes file layout, pyproject.toml, README.md, license and a hello world script. -Intended as a starting point for future personal projects +## Install -To use: +### Development -Clone this and then delete the git repo (unless you're working on the skeleton) - -## Create a new git repo - -`git init` - -``` -git config --local init.defaultbranch main -git config --local user.name "Neill Cox" -git config --local user.email "neill.cox@ingenious.com.au" -``` - -Configure as necessary. - -## Create a virtualenv - -`python -m venv venv` - -## Activate - -`source venv/bin/activate` - -## Upgrade pip - -`pip install --upgrade pip` - -## Install requirements-dev.txt - -`pip install -r requirements-dev.txt` - -If this was an actual project this would be the time to install the actual requirements - -`pip install -r requirements.txt` - -That's an empty file at the moment so there's no point +`pip install --editable .[dev,test]` ## Check that tests work @@ -51,26 +16,26 @@ That's an empty file at the moment so there's no point Should produce something like: ``` -======================================================== test session starts ========================================================== +===================================================================================== test session starts ===================================================================================== platform linux -- Python 3.11.5, pytest-7.4.2, pluggy-1.3.0 -- /home/ncox/Projects/python-skeleton/venv/bin/python cachedir: .pytest_cache -rootdir: /home/ncox/Projects/python-skeleton +rootdir: /home/ncox/Projects/gitea-gitlab-exporter configfile: pyproject.toml testpaths: tests plugins: cov-4.1.0 collected 1 item -tests/test_skeleton.py::test_hello_word PASSED [100%] +tests/test_exporter.py::test_hello_word PASSED [100%] ---------- coverage: platform linux, python 3.11.5-final-0 ----------- -Name Stmts Miss Cover Missing ---------------------------------------------------------------- -src/python_skeleton/__init__.py 6 1 83% 18 ---------------------------------------------------------------- -TOTAL 6 1 83% +Name Stmts Miss Cover Missing +--------------------------------------------------------------------- +src/gitea_gitlab_exporter/__init__.py 6 1 83% 18 +--------------------------------------------------------------------- +TOTAL 6 1 83% -========================================================== 1 passed in 0.02s =========================================================== +====================================================================================== 1 passed in 0.04s ====================================================================================== ``` ## Install pre-commit hooks: diff --git a/pyproject.toml b/pyproject.toml index 146633f..221b3fa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,12 +3,12 @@ requires = ["hatchling"] build-backend = "hatchling.build" [project] -name = "python_skeleton" +name = "gitea_gitlab_exporter" version = "0.0.1" authors = [ { name="Neill Cox", email="neill@ingenious.com.au" }, ] -description = "A skeleton for a python project" +description = "A tool to copy a project from gitlab to gitea" readme = "README.md" requires-python = ">=3.8" classifiers = [ @@ -17,17 +17,29 @@ classifiers = [ "Operating System :: OS Independent", ] dependencies = [ + "requests" ] [project.urls] -"Homepage" = "https://git.evatt.ingenious.com.au/neillc/python_skeleton" -"Bug Tracker" = "https://git.evatt.ingenious.com.au/neillc/python_skeleton" +"Homepage" = "https://git.evatt.ingenious.com.au/neillc/gitea-gitlab-exporter" +"Bug Tracker" = "https://git.evatt.ingenious.com.au/neillc/gitea-gitlab-exporter" [project.scripts] -hello_world = "python_skeleton:hello_world" +gitlab2gitea = "gitea_gitlab_exporter:exporter" + +[project.optional-dependencies] +dev = [ + "pre-commit", + "black", + "flake8" +] +test = [ + "pytest", + "pytest-cov", +] [tool.pytest.ini_options] -addopts = "-v --cov-report term-missing --cov=python_skeleton" +addopts = "-v --cov-report term-missing --cov=gitea_gitlab_exporter" testpaths = [ "tests", ] diff --git a/src/python_skeleton/__init__.py b/src/gitea_gitlab_exporter/__init__.py similarity index 100% rename from src/python_skeleton/__init__.py rename to src/gitea_gitlab_exporter/__init__.py diff --git a/tests/test_skeleton.py b/tests/test_exporter.py similarity index 61% rename from tests/test_skeleton.py rename to tests/test_exporter.py index d492640..647307d 100644 --- a/tests/test_skeleton.py +++ b/tests/test_exporter.py @@ -1,7 +1,7 @@ -import python_skeleton +import gitea_gitlab_exporter def test_hello_word(capsys): - python_skeleton.hello_world() + gitea_gitlab_exporter.hello_world() captured = capsys.readouterr() assert captured.out == "Hello World!\n"