sys-config is a Python package created with william-cass-wright/cookiecutter-pypackage-slim... kinda
PROJECT DEVELOPMENT NOTES
Summary
how to use
- command line tool (component of
smgmt)- transfer AWS Secrets to local (or visversa)
- crawl
~/.config&~directories for credentials/configs- systematically extract and transform for command line
- within CLI project (used to implement
mmgmt)- init new project after binary install
- explicitly call config file (endpoint usage pattern)
- function dectorator (on top of command/endpoint)
- within context???
- other types of projects???
value to include in config file?
- pypi tokens
- api keys
- dev and prod split
- app specific references within file system
components
- file crawler
- extractor
- click interface (class inheritance --> factory design pattern?)
Usage
implementation example within media-mgmt-cli:
from .config import ConfigHandler
class AwsStorageMgmt:
def __init__(self):
self.s3_resour = boto3.resource("s3")
self.s3_client = boto3.client("s3")
self.config = ConfigHandler(project_name="media_mgmt_cli")
if self.config.check_config_exists():
self.configs = self.config.get_configs()
self.bucket = self.configs.get("aws_bucket", None)
self.object_prefix = self.configs.get("aws_bucket_path", None)
else:
echo("config file does not exist, run `mmgmt configure`")
def upload_file(self, file_name, object_name=None):
"""
...
"""
echo(
f"uploading: {file_name} \nto S3 bucket: {self.configs.get('aws_bucket')}/{self.configs.get('aws_bucket_path')}/{file_name}"
)
...
Future Work
- setup sys-config
Project Examples
Publishing Notes
make install
#* Installation
.PHONY: install
install:
poetry lock -n && poetry export --without-hashes > requirements.txt
poetry install -n
-poetry run mypy --install-types --non-interactive ./
- bump version
poetry version [major, minor, bug]
only updates within pyproject.toml
- publish
a. trigger pre-commit
git add .
git commit -m "new release"
b. fix issues, commit again, then tag
git tag -a v0.2.0 -m "sys-config rewrite"
git push -u origin publish-branch
c. publish with poetry
poetry publish --dry-run --build
poetry publish --build
- test
jupyter lab
python -m pip install sys-config
REPL
import sys_config
parser = sys_config.ConfigHandler()
parser.__dict__
# results
parser.__dir__()
# results
{'project_name': 'tmp',
'home_path': PosixPath('/Users/willcasswrig'),
'config_path': PosixPath('/Users/willcasswrig/.config/tmp'),
'config_file_path': PosixPath('/Users/willcasswrig/.config/tmp/config'),
'verbose': False,
'parser': <configparser.ConfigParser at 0x7f8c224ec430>}
['project_name',
'home_path',
'config_path',
'config_file_path',
'verbose',
'parser',
'__module__',
'__init__',
'crud_create',
'create_config_file',
'crud_update',
'update_parser',
'crud_delete_file',
'crud_read',
'read_dict',
'get_config_exists',
'get_parser_sections',
'write_config_file',
'set_config_path',
'reset_config_path',
'__dict__',
'__weakref__',
'__doc__',
'__new__',
'__repr__',
'__hash__',
'__str__',
'__getattribute__',
'__setattr__',
'__delattr__',
'__lt__',
'__le__',
'__eq__',
'__ne__',
'__gt__',
'__ge__',
'__reduce_ex__',
'__reduce__',
'__subclasshook__',
'__init_subclass__',
'__format__',
'__sizeof__',
'__dir__',
'__class__']
errors
parser.crud_read()
82 def crud_read(self):
---> 83 self.read_dict(self.__dict__, self.__class__.__name__)
TypeError: Object of type PosixPath is not JSON serializable
parser.crud_create()
Signature: parser.crud_create()
Docstring: <no docstring>
File: ~/miniconda/envs/jl2/lib/python3.10/site-packages/sys_config/main.py
Type: method
add docstring
Metadata
Release files for sys-config 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sys-config-0.2.1.tar.gz | 17.8 kB | Without provenance | Details for sys-config-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sys_config-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for sys_config-0.2.1-py3-none-any.whl |
Total release size: 33.9 kB
Release files / sys-config-0.2.1.tar.gz
| Download URL | sys-config-0.2.1.tar.gz |
|---|---|
| Size | 17.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
af063cb33082c1223d8208e289766319b0a0297094b3bc82e738beb9ecebe4ba
|
|
BLAKE2b-256 checksum How to use checksums |
02bc802a6461172bd333fe112024779d14e6f94121ad55aec33026634ee0a64c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.14 CPython/3.10.8 Darwin/21.6.0
|
Release files / sys_config-0.2.1-py3-none-any.whl
| Download URL | sys_config-0.2.1-py3-none-any.whl |
|---|---|
| Size | 16.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b0422b5e0df78736a0307556bef8253865efe8644dc97cd0c42160ae564d1dc5
|
|
BLAKE2b-256 checksum How to use checksums |
c572232fc8d450dbd6a731374d230a4802067535f5f904c9b5ae5becebc1f2c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.14 CPython/3.10.8 Darwin/21.6.0
|
Security for sys-config 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.