diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-05-05 08:39:55 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-05-05 08:39:55 +0000 |
| commit | 3ceba385dee54a17205b7f2f2c9ec2424afe8559 (patch) | |
| tree | 832a1d27698cf1139210b343cefbfdcc9d7c2aa1 | |
| parent | ff7f72002407d8428d55af1a58a5281d03e95699 (diff) | |
automatic import of python-milieuopeneuler20.03
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-milieu.spec | 402 | ||||
| -rw-r--r-- | sources | 1 |
3 files changed, 404 insertions, 0 deletions
@@ -0,0 +1 @@ +/milieu-0.1.9.tar.gz diff --git a/python-milieu.spec b/python-milieu.spec new file mode 100644 index 0000000..e812a7e --- /dev/null +++ b/python-milieu.spec @@ -0,0 +1,402 @@ +%global _empty_manifest_terminate_build 0 +Name: python-milieu +Version: 0.1.9 +Release: 1 +Summary: A helping hand to manage your settings among different environments +License: UNKNOWN +URL: https://github.com/clarete/milieu +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/30/1d/5fa46f8634af5a4bc93eaf9a000de32258088e69b8901f6cdb5193c453a6/milieu-0.1.9.tar.gz +BuildArch: noarch + + +%description +A helping hand to manage your settings among different environments + +## Intro + +Managing application configuration that runs on multiple environments +can be tough. So **milieu** comes to help you pretend you have only +one settings file that magically works whenever you deploy. + +## Production + +The system environment is the first place **milieu** will try to find +things. So, when the application runs inside of an environment with the right +variables set, it will just work. + +So, if you know you have the environment variable `DATABASE_URI` like this: + +```bash +$ export DATABASE_URI=mysql://root@localhost:3306/mydb +``` + +The application settings glue code will look like this: + +```python +>>> from milieu import Environment +>>> env = Environment() +>>> dburi = env.get_uri('DATABASE_URI') +>>> dburi.host +u'localhost' +>>> dburi.port +3306 +``` + +## Local + +If you just want to load things from a file locally, the +`Environment.from_file()` constructor will help you out. + +```python +>>> from milieu import Environment +>>> env = Environment.from_file('/etc/app.cfg') +>>> env.get_bool('BOOL_FLAG') +True +>>> env.get_float('FLOAT_VAL') +3.14 +``` + +The file `app.cfg` will look like this: + +```yaml +BOOL_FLAG: True + +FLOAT_VAL: 3.14 +``` + +## From a folder + +You can also load variables from a folder, where each file will be an +environment variable and the file's content will be the value. Just +like [envdir](http://cr.yp.to/daemontools/envdir.html). + +Now, say that you have the folder `/etc/envdir/app` and this folder +contains the file `MYSQL_CONN_URI` with a database URL inside of +it. Just like this one here: +`mysql://root:secret@localhost:3306/mydb`. + +To read that directory and load the variable properly, you just have +to do the following: + +```python +>>> from milieu import Environment +>>> env = Environment.from_folder('/etc/envdir/app') +>>> uri = env.get_uri('MYSQL_CONN_URI') +>>> uri.host +'localhost' +>>> uri.port +3306 +>>> uri.user +'root' +>>> uri.password +'secret' +``` + +# Hacking on it + +## Install dev dependencies + +```console +pip install -r requirements-dev.txt +``` + +## Run tests + +```console +make test +``` + +## Change it + +Make sure you write tests for your new features and keep the test +coverage in 100% + +## Release it + +After you already made your commits, run: + +```console +make release +``` + +follow the instructions and do the +[harlem shake](http://www.youtube.com/watch?v=8vJiSSAMNWw) + +%package -n python3-milieu +Summary: A helping hand to manage your settings among different environments +Provides: python-milieu +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-milieu +A helping hand to manage your settings among different environments + +## Intro + +Managing application configuration that runs on multiple environments +can be tough. So **milieu** comes to help you pretend you have only +one settings file that magically works whenever you deploy. + +## Production + +The system environment is the first place **milieu** will try to find +things. So, when the application runs inside of an environment with the right +variables set, it will just work. + +So, if you know you have the environment variable `DATABASE_URI` like this: + +```bash +$ export DATABASE_URI=mysql://root@localhost:3306/mydb +``` + +The application settings glue code will look like this: + +```python +>>> from milieu import Environment +>>> env = Environment() +>>> dburi = env.get_uri('DATABASE_URI') +>>> dburi.host +u'localhost' +>>> dburi.port +3306 +``` + +## Local + +If you just want to load things from a file locally, the +`Environment.from_file()` constructor will help you out. + +```python +>>> from milieu import Environment +>>> env = Environment.from_file('/etc/app.cfg') +>>> env.get_bool('BOOL_FLAG') +True +>>> env.get_float('FLOAT_VAL') +3.14 +``` + +The file `app.cfg` will look like this: + +```yaml +BOOL_FLAG: True + +FLOAT_VAL: 3.14 +``` + +## From a folder + +You can also load variables from a folder, where each file will be an +environment variable and the file's content will be the value. Just +like [envdir](http://cr.yp.to/daemontools/envdir.html). + +Now, say that you have the folder `/etc/envdir/app` and this folder +contains the file `MYSQL_CONN_URI` with a database URL inside of +it. Just like this one here: +`mysql://root:secret@localhost:3306/mydb`. + +To read that directory and load the variable properly, you just have +to do the following: + +```python +>>> from milieu import Environment +>>> env = Environment.from_folder('/etc/envdir/app') +>>> uri = env.get_uri('MYSQL_CONN_URI') +>>> uri.host +'localhost' +>>> uri.port +3306 +>>> uri.user +'root' +>>> uri.password +'secret' +``` + +# Hacking on it + +## Install dev dependencies + +```console +pip install -r requirements-dev.txt +``` + +## Run tests + +```console +make test +``` + +## Change it + +Make sure you write tests for your new features and keep the test +coverage in 100% + +## Release it + +After you already made your commits, run: + +```console +make release +``` + +follow the instructions and do the +[harlem shake](http://www.youtube.com/watch?v=8vJiSSAMNWw) + +%package help +Summary: Development documents and examples for milieu +Provides: python3-milieu-doc +%description help +A helping hand to manage your settings among different environments + +## Intro + +Managing application configuration that runs on multiple environments +can be tough. So **milieu** comes to help you pretend you have only +one settings file that magically works whenever you deploy. + +## Production + +The system environment is the first place **milieu** will try to find +things. So, when the application runs inside of an environment with the right +variables set, it will just work. + +So, if you know you have the environment variable `DATABASE_URI` like this: + +```bash +$ export DATABASE_URI=mysql://root@localhost:3306/mydb +``` + +The application settings glue code will look like this: + +```python +>>> from milieu import Environment +>>> env = Environment() +>>> dburi = env.get_uri('DATABASE_URI') +>>> dburi.host +u'localhost' +>>> dburi.port +3306 +``` + +## Local + +If you just want to load things from a file locally, the +`Environment.from_file()` constructor will help you out. + +```python +>>> from milieu import Environment +>>> env = Environment.from_file('/etc/app.cfg') +>>> env.get_bool('BOOL_FLAG') +True +>>> env.get_float('FLOAT_VAL') +3.14 +``` + +The file `app.cfg` will look like this: + +```yaml +BOOL_FLAG: True + +FLOAT_VAL: 3.14 +``` + +## From a folder + +You can also load variables from a folder, where each file will be an +environment variable and the file's content will be the value. Just +like [envdir](http://cr.yp.to/daemontools/envdir.html). + +Now, say that you have the folder `/etc/envdir/app` and this folder +contains the file `MYSQL_CONN_URI` with a database URL inside of +it. Just like this one here: +`mysql://root:secret@localhost:3306/mydb`. + +To read that directory and load the variable properly, you just have +to do the following: + +```python +>>> from milieu import Environment +>>> env = Environment.from_folder('/etc/envdir/app') +>>> uri = env.get_uri('MYSQL_CONN_URI') +>>> uri.host +'localhost' +>>> uri.port +3306 +>>> uri.user +'root' +>>> uri.password +'secret' +``` + +# Hacking on it + +## Install dev dependencies + +```console +pip install -r requirements-dev.txt +``` + +## Run tests + +```console +make test +``` + +## Change it + +Make sure you write tests for your new features and keep the test +coverage in 100% + +## Release it + +After you already made your commits, run: + +```console +make release +``` + +follow the instructions and do the +[harlem shake](http://www.youtube.com/watch?v=8vJiSSAMNWw) + +%prep +%autosetup -n milieu-0.1.9 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-milieu -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Fri May 05 2023 Python_Bot <Python_Bot@openeuler.org> - 0.1.9-1 +- Package Spec generated @@ -0,0 +1 @@ +69107394bc3534f7968744e968e6d193 milieu-0.1.9.tar.gz |
