🚧 Update skeleton to new project

This commit is contained in:
Neill Cox 2023-10-22 20:43:24 +11:00
parent b2822e4541
commit cebcde61aa
4 changed files with 34 additions and 57 deletions

View file

@ -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) `pip install --editable .[dev,test]`
## 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
## Check that tests work ## 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: 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 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 cachedir: .pytest_cache
rootdir: /home/ncox/Projects/python-skeleton rootdir: /home/ncox/Projects/gitea-gitlab-exporter
configfile: pyproject.toml configfile: pyproject.toml
testpaths: tests testpaths: tests
plugins: cov-4.1.0 plugins: cov-4.1.0
collected 1 item 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 ----------- ---------- coverage: platform linux, python 3.11.5-final-0 -----------
Name Stmts Miss Cover Missing Name Stmts Miss Cover Missing
--------------------------------------------------------------- ---------------------------------------------------------------------
src/python_skeleton/__init__.py 6 1 83% 18 src/gitea_gitlab_exporter/__init__.py 6 1 83% 18
--------------------------------------------------------------- ---------------------------------------------------------------------
TOTAL 6 1 83% TOTAL 6 1 83%
========================================================== 1 passed in 0.02s =========================================================== ====================================================================================== 1 passed in 0.04s ======================================================================================
``` ```
## Install pre-commit hooks: ## Install pre-commit hooks:

View file

@ -3,12 +3,12 @@ requires = ["hatchling"]
build-backend = "hatchling.build" build-backend = "hatchling.build"
[project] [project]
name = "python_skeleton" name = "gitea_gitlab_exporter"
version = "0.0.1" version = "0.0.1"
authors = [ authors = [
{ name="Neill Cox", email="neill@ingenious.com.au" }, { 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" readme = "README.md"
requires-python = ">=3.8" requires-python = ">=3.8"
classifiers = [ classifiers = [
@ -17,17 +17,29 @@ classifiers = [
"Operating System :: OS Independent", "Operating System :: OS Independent",
] ]
dependencies = [ dependencies = [
"requests"
] ]
[project.urls] [project.urls]
"Homepage" = "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/python_skeleton" "Bug Tracker" = "https://git.evatt.ingenious.com.au/neillc/gitea-gitlab-exporter"
[project.scripts] [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] [tool.pytest.ini_options]
addopts = "-v --cov-report term-missing --cov=python_skeleton" addopts = "-v --cov-report term-missing --cov=gitea_gitlab_exporter"
testpaths = [ testpaths = [
"tests", "tests",
] ]

View file

@ -1,7 +1,7 @@
import python_skeleton import gitea_gitlab_exporter
def test_hello_word(capsys): def test_hello_word(capsys):
python_skeleton.hello_world() gitea_gitlab_exporter.hello_world()
captured = capsys.readouterr() captured = capsys.readouterr()
assert captured.out == "Hello World!\n" assert captured.out == "Hello World!\n"