diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..731d3f0 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1 @@ +include helloworld/VERSION.txt \ No newline at end of file diff --git a/README b/README deleted file mode 100644 index 86957ac..0000000 --- a/README +++ /dev/null @@ -1,5 +0,0 @@ -Hello, World -============ - -A simple program, and an example of how to structure a python project. -You can simply start the praogram by typing "python main.py" in the helloworld folder. diff --git a/README.md b/README.md new file mode 100644 index 0000000..facdc94 --- /dev/null +++ b/README.md @@ -0,0 +1,40 @@ +Hello, World +============ + +A simple program, and an example of how to structure a python project. Demonstrates a basic package +file structure (using [flat layout]) and a way to define a [single package version] shared between +package metadata and program runtime. + +See also: the Python Packaging User Guide at https://packaging.python.org/ offers more complete +examples and explanations. + +[flat layout]: https://packaging.python.org/en/latest/discussions/src-layout-vs-flat-layout/ +[single package version]: https://packaging.python.org/en/latest/guides/single-sourcing-package-version/ + +Basic usage +----------- + +You can install the package using `pip` and then run the main script from the command line as +`helloworld_in_python` or import it in python via `import helloworld`: + +```shell +$ cd python-helloworld/ # Dir containing this repo's root +$ pip install . +$ helloworld_in_python +Hello, world +$ helloworld_in_python --version +helloworld 0.1 +$ python +>>> import helloworld +>>> helloworld.__version__ +'0.1' +``` + +You can also try it without installing by running `python helloworld.py` in the repository root: + +```shell +$ python helloworld.py +Hello, world +$ python helloworld.py --version +helloworld 0.1 +``` diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..ed95f86 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,28 @@ +[build-system] +# pyproject.toml support added in 61.0.0, but for some reason fails to process +# this file until version 62. +requires = ["setuptools >= 62"] +build-backend = "setuptools.build_meta" + +[project] +name = "helloworld" +# version is populated by setuptools in setup.py (from VERSION.txt) +dynamic = ["version"] +description = "The familiar example program in Python" +# Newer versions of setuptools (that can detect metadata in pyproject.toml) +# don't seem to support python 2 anymore. +requires-python = ">= 3" +readme = "README.md" +license = { file = "LICENSE" } +authors = [ + { name = "A. Developer", email = "author@example.com" } +] +keywords = ["example", "documentation", "tutorial"] + +[project.urls] +Homepage = "http://github.com/dbarnett/python-helloworld" +Repository = "http://github.com/dbarnett/python-helloworld" + +# command-line executables to expose +[project.scripts] +helloworld_in_python = "helloworld.main:main" \ No newline at end of file diff --git a/setup.py b/setup.py index 779fa6d..b706eb0 100644 --- a/setup.py +++ b/setup.py @@ -8,25 +8,5 @@ version = f.read().strip() setup( - name = "helloworld", # what you want to call the archive/egg version = version, - packages=["helloworld"], # top-level python modules you can import like - # 'import foo' - dependency_links = [], # custom links to a specific project - install_requires=[], - extras_require={}, # optional features that other packages can require - # like 'helloworld[foo]' - package_data = {"helloworld": ["VERSION.txt"]}, - author="David Barnett", - author_email = "davidbarnett2@gmail.com", - description = "The familiar example program in Python", - license = "Apache 2.0", - keywords= "example documentation tutorial", - url = "http://github.com/dbarnett/python-helloworld", - entry_points = { - "console_scripts": [ # command-line executables to expose - "helloworld_in_python = helloworld.main:main", - ], - "gui_scripts": [] # GUI executables (creates pyw on Windows) - } )