From 190b54b4268a412f9cb3a98dccadfca245afa72a Mon Sep 17 00:00:00 2001 From: Emmanuel Bigeon Date: Mon, 28 Sep 2020 15:18:12 -0400 Subject: [PATCH] [feat] Structure --- MANIFEST.in | 4 + Pipfile | 19 ++++ Pipfile.lock | 154 ++++++++++++++++++++++++++++++ README.md | 17 ++++ groupid/__init__.py | 10 ++ groupid/artifactid/DESCRIPTION.md | 0 groupid/artifactid/__init__.py | 12 +++ groupid/artifactid/app.py | 6 ++ setup.py | 45 +++++++++ 9 files changed, 267 insertions(+) create mode 100644 MANIFEST.in create mode 100644 Pipfile create mode 100644 Pipfile.lock create mode 100644 README.md create mode 100644 groupid/__init__.py create mode 100644 groupid/artifactid/DESCRIPTION.md create mode 100644 groupid/artifactid/__init__.py create mode 100644 groupid/artifactid/app.py create mode 100644 setup.py diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..9bb6617 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,4 @@ +# Include non py files +# include resources +recursive-include groupid *.md +recursive-include groupid *.json diff --git a/Pipfile b/Pipfile new file mode 100644 index 0000000..caee504 --- /dev/null +++ b/Pipfile @@ -0,0 +1,19 @@ +[[source]] +name = "bigeon.net-pypi" +url = "https://nexus.code.bigeon.net/repository/python/simple" +verify_ssl = true + +[[source]] +url = "https://pypi.org/simple" +verify_ssl = true +name = "pypi-source" + +[dev-packages] +pylint = "*" +coverage = "*" +toml = "*" + +[packages] + +[requires] +python_version = "3.8" diff --git a/Pipfile.lock b/Pipfile.lock new file mode 100644 index 0000000..8ede413 --- /dev/null +++ b/Pipfile.lock @@ -0,0 +1,154 @@ +{ + "_meta": { + "hash": { + "sha256": "afe8af74ca9c4f14d496cb93fc6a609759302448ef832c9b0b3430e55cbacd52" + }, + "pipfile-spec": 6, + "requires": { + "python_version": "3.8" + }, + "sources": [ + { + "name": "bigeon.net-pypi", + "url": "https://nexus.code.bigeon.net/repository/python/simple", + "verify_ssl": true + }, + { + "name": "pypi-source", + "url": "https://pypi.org/simple", + "verify_ssl": true + } + ] + }, + "default": {}, + "develop": { + "astroid": { + "hashes": [ + "sha256:2f4078c2a41bf377eea06d71c9d2ba4eb8f6b1af2135bec27bbbb7d8f12bb703", + "sha256:bc58d83eb610252fd8de6363e39d4f1d0619c894b0ed24603b881c02e64c7386" + ], + "markers": "python_version >= '3.5'", + "version": "==2.4.2" + }, + "colorama": { + "hashes": [ + "sha256:7d73d2a99753107a36ac6b455ee49046802e59d9d076ef8e47b61499fa29afff", + "sha256:e96da0d330793e2cb9485e9ddfd918d456036c7149416295932478192f4436a1" + ], + "markers": "sys_platform == 'win32'", + "version": "==0.4.3" + }, + "coverage": { + "hashes": [ + "sha256:0203acd33d2298e19b57451ebb0bed0ab0c602e5cf5a818591b4918b1f97d516", + "sha256:0f313707cdecd5cd3e217fc68c78a960b616604b559e9ea60cc16795c4304259", + "sha256:1c6703094c81fa55b816f5ae542c6ffc625fec769f22b053adb42ad712d086c9", + "sha256:1d44bb3a652fed01f1f2c10d5477956116e9b391320c94d36c6bf13b088a1097", + "sha256:280baa8ec489c4f542f8940f9c4c2181f0306a8ee1a54eceba071a449fb870a0", + "sha256:29a6272fec10623fcbe158fdf9abc7a5fa032048ac1d8631f14b50fbfc10d17f", + "sha256:2b31f46bf7b31e6aa690d4c7a3d51bb262438c6dcb0d528adde446531d0d3bb7", + "sha256:2d43af2be93ffbad25dd959899b5b809618a496926146ce98ee0b23683f8c51c", + "sha256:381ead10b9b9af5f64646cd27107fb27b614ee7040bb1226f9c07ba96625cbb5", + "sha256:47a11bdbd8ada9b7ee628596f9d97fbd3851bd9999d398e9436bd67376dbece7", + "sha256:4d6a42744139a7fa5b46a264874a781e8694bb32f1d76d8137b68138686f1729", + "sha256:50691e744714856f03a86df3e2bff847c2acede4c191f9a1da38f088df342978", + "sha256:530cc8aaf11cc2ac7430f3614b04645662ef20c348dce4167c22d99bec3480e9", + "sha256:582ddfbe712025448206a5bc45855d16c2e491c2dd102ee9a2841418ac1c629f", + "sha256:63808c30b41f3bbf65e29f7280bf793c79f54fb807057de7e5238ffc7cc4d7b9", + "sha256:71b69bd716698fa62cd97137d6f2fdf49f534decb23a2c6fc80813e8b7be6822", + "sha256:7858847f2d84bf6e64c7f66498e851c54de8ea06a6f96a32a1d192d846734418", + "sha256:78e93cc3571fd928a39c0b26767c986188a4118edc67bc0695bc7a284da22e82", + "sha256:7f43286f13d91a34fadf61ae252a51a130223c52bfefb50310d5b2deb062cf0f", + "sha256:86e9f8cd4b0cdd57b4ae71a9c186717daa4c5a99f3238a8723f416256e0b064d", + "sha256:8f264ba2701b8c9f815b272ad568d555ef98dfe1576802ab3149c3629a9f2221", + "sha256:9342dd70a1e151684727c9c91ea003b2fb33523bf19385d4554f7897ca0141d4", + "sha256:9361de40701666b034c59ad9e317bae95c973b9ff92513dd0eced11c6adf2e21", + "sha256:9669179786254a2e7e57f0ecf224e978471491d660aaca833f845b72a2df3709", + "sha256:aac1ba0a253e17889550ddb1b60a2063f7474155465577caa2a3b131224cfd54", + "sha256:aef72eae10b5e3116bac6957de1df4d75909fc76d1499a53fb6387434b6bcd8d", + "sha256:bd3166bb3b111e76a4f8e2980fa1addf2920a4ca9b2b8ca36a3bc3dedc618270", + "sha256:c1b78fb9700fc961f53386ad2fd86d87091e06ede5d118b8a50dea285a071c24", + "sha256:c3888a051226e676e383de03bf49eb633cd39fc829516e5334e69b8d81aae751", + "sha256:c5f17ad25d2c1286436761b462e22b5020d83316f8e8fcb5deb2b3151f8f1d3a", + "sha256:c851b35fc078389bc16b915a0a7c1d5923e12e2c5aeec58c52f4aa8085ac8237", + "sha256:cb7df71de0af56000115eafd000b867d1261f786b5eebd88a0ca6360cccfaca7", + "sha256:cedb2f9e1f990918ea061f28a0f0077a07702e3819602d3507e2ff98c8d20636", + "sha256:e8caf961e1b1a945db76f1b5fa9c91498d15f545ac0ababbe575cfab185d3bd8" + ], + "index": "bigeon.net-pypi", + "version": "==5.3" + }, + "isort": { + "hashes": [ + "sha256:171c5f365791073426b5ed3a156c2081a47f88c329161fd28228ff2da4c97ddb", + "sha256:ba91218eee31f1e300ecc079ef0c524cea3fc41bfbb979cbdf5fd3a889e3cfed" + ], + "markers": "python_version >= '3.6' and python_version < '4.0'", + "version": "==5.5.2" + }, + "lazy-object-proxy": { + "hashes": [ + "sha256:0c4b206227a8097f05c4dbdd323c50edf81f15db3b8dc064d08c62d37e1a504d", + "sha256:194d092e6f246b906e8f70884e620e459fc54db3259e60cf69a4d66c3fda3449", + "sha256:1be7e4c9f96948003609aa6c974ae59830a6baecc5376c25c92d7d697e684c08", + "sha256:4677f594e474c91da97f489fea5b7daa17b5517190899cf213697e48d3902f5a", + "sha256:48dab84ebd4831077b150572aec802f303117c8cc5c871e182447281ebf3ac50", + "sha256:5541cada25cd173702dbd99f8e22434105456314462326f06dba3e180f203dfd", + "sha256:59f79fef100b09564bc2df42ea2d8d21a64fdcda64979c0fa3db7bdaabaf6239", + "sha256:8d859b89baf8ef7f8bc6b00aa20316483d67f0b1cbf422f5b4dc56701c8f2ffb", + "sha256:9254f4358b9b541e3441b007a0ea0764b9d056afdeafc1a5569eee1cc6c1b9ea", + "sha256:9651375199045a358eb6741df3e02a651e0330be090b3bc79f6d0de31a80ec3e", + "sha256:97bb5884f6f1cdce0099f86b907aa41c970c3c672ac8b9c8352789e103cf3156", + "sha256:9b15f3f4c0f35727d3a0fba4b770b3c4ebbb1fa907dbcc046a1d2799f3edd142", + "sha256:a2238e9d1bb71a56cd710611a1614d1194dc10a175c1e08d75e1a7bcc250d442", + "sha256:a6ae12d08c0bf9909ce12385803a543bfe99b95fe01e752536a60af2b7797c62", + "sha256:ca0a928a3ddbc5725be2dd1cf895ec0a254798915fb3a36af0964a0a4149e3db", + "sha256:cb2c7c57005a6804ab66f106ceb8482da55f5314b7fcb06551db1edae4ad1531", + "sha256:d74bb8693bf9cf75ac3b47a54d716bbb1a92648d5f781fc799347cfc95952383", + "sha256:d945239a5639b3ff35b70a88c5f2f491913eb94871780ebfabb2568bd58afc5a", + "sha256:eba7011090323c1dadf18b3b689845fd96a61ba0a1dfbd7f24b921398affc357", + "sha256:efa1909120ce98bbb3777e8b6f92237f5d5c8ea6758efea36a473e1d38f7d3e4", + "sha256:f3900e8a5de27447acbf900b4750b0ddfd7ec1ea7fbaf11dfa911141bc522af0" + ], + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", + "version": "==1.4.3" + }, + "mccabe": { + "hashes": [ + "sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42", + "sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f" + ], + "version": "==0.6.1" + }, + "pylint": { + "hashes": [ + "sha256:bb4a908c9dadbc3aac18860550e870f58e1a02c9f2c204fdf5693d73be061210", + "sha256:bfe68f020f8a0fece830a22dd4d5dddb4ecc6137db04face4c3420a46a52239f" + ], + "index": "bigeon.net-pypi", + "version": "==2.6.0" + }, + "six": { + "hashes": [ + "sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259", + "sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced" + ], + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", + "version": "==1.15.0" + }, + "toml": { + "hashes": [ + "sha256:926b612be1e5ce0634a2ca03470f95169cf16f939018233a670519cb4ac58b0f", + "sha256:bda89d5935c2eac546d648028b9901107a595863cb36bae0c73ac804a9b4ce88" + ], + "index": "bigeon.net-pypi", + "version": "==0.10.1" + }, + "wrapt": { + "hashes": [ + "sha256:b62ffa81fb85f4332a4f609cab4ac40709470da05643a082ec1eb88e6d9b97d7" + ], + "version": "==1.12.1" + } + } +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..3c98f4c --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +# Python project archetype + +This project is an archetype much like the maven interpretation of archetypes +(structures for projects). The main difference is that it should be customized +manually rather than through properties. + +## Setup as project +After retrieving the archetype (through copy, git...) it should be setup to fit +the project. The following changes should be performed: + +- rename the `groupid` package +- rename the `artifactid` package +- change the `groupid` in `MANIFEST.in` to the actual identifier +- change the `groupid.artifactid` import in `setup.py` + +Additionnaly, one should fill in the `DESCRIPTION.md` and rewrite this +`README.md` file. diff --git a/groupid/__init__.py b/groupid/__init__.py new file mode 100644 index 0000000..53e3396 --- /dev/null +++ b/groupid/__init__.py @@ -0,0 +1,10 @@ +"""Organisation package for unicity of namespace. + +In each python archive, this package should contain only the actual module package and this file that allows merging of +python sub-packages + +.. seealso:: https://stackoverflow.com/questions/26058978/ +""" + +from pkgutil import extend_path +__path__ = extend_path(__path__, __name__) diff --git a/groupid/artifactid/DESCRIPTION.md b/groupid/artifactid/DESCRIPTION.md new file mode 100644 index 0000000..e69de29 diff --git a/groupid/artifactid/__init__.py b/groupid/artifactid/__init__.py new file mode 100644 index 0000000..0393114 --- /dev/null +++ b/groupid/artifactid/__init__.py @@ -0,0 +1,12 @@ +"""Python project specific package. + +""" + +# Project constants for reference throughout the project. +from pathlib import Path + +PACKAGE_NAME = "groupid-artifactid" +PACKAGE_DESCRIPTION = "Some one-liner description of the package purpose." +PACKAGE_VERSION = "1.0.0" +PACKAGE_LONG_DESCRIPTION = open(str(Path(__file__).parent)+"/DESCRIPTION.md").read() +PACKAGE_MAINTAINER_CONTACT = "someone@somewhere.com" diff --git a/groupid/artifactid/app.py b/groupid/artifactid/app.py new file mode 100644 index 0000000..ca1065f --- /dev/null +++ b/groupid/artifactid/app.py @@ -0,0 +1,6 @@ +""" + +""" + +if __name__ == "__main__": + print("Hello") diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..386f2e5 --- /dev/null +++ b/setup.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python + +"""Project building script. + +""" +from typing import List + +import setuptools +import toml + +from groupid import artifactid as artifact + + +def get_requirements() -> List[str]: + with open("Pipfile", "r") as file: + pipfile = file.read() + toml_dict = toml.loads(pipfile) + + packages = toml_dict["packages"] + deps = list() + for key in packages: + if packages[key] == "*" or type(packages[key]) != str: + deps.append(key) + else: + deps.append(key + " " + packages[key]) + return deps + + +setuptools.setup( + name=artifact.PACKAGE_NAME, + version=artifact.PACKAGE_VERSION, + author=artifact.PACKAGE_AUTHOR, + author_email=artifact.PACKAGE_MAINTAINER_CONTACT, + description=artifact.PACKAGE_DESCRIPTION, + long_description=artifact.PACKAGE_LONG_DESCRIPTION, + long_description_content="text/markdown", + url=artifact.PACKAGE_URL, + install_requires=get_requirements(), + packages=setuptools.find_packages(exclude=["*.test.*", "*.test", "test.*", "test"]), + include_package_data=True, + classifiers=[ + "License :: Other/Proprietary License", + "Programming Language :: Python :: 3.8" + ] +)