Struggling to understand timedelta rpesentation when applying an offset for an hour earlier - why is days = -1?

2021-08-31 Thread dcs3spp via Python-list
Hi,

I wonder if anyone can help

I am struggling to understand the representation of timedelta when used in 
conjunction with astimezone. 

Given the code below, in a python interactive interpreter, I am trying to 
calculate a resultant datetime an hour earlier from a UTC datetime

```bash
>>> dt = datetime(2021, 8, 22, 23, 59, 31, tzinfo=timezone.utc)
>>> hour_before=dt.astimezone(timezone(-timedelta(seconds=3600)))
>>> hour_before
datetime.datetime(2021, 8, 22, 22, 59, 31, 
tzinfo=datetime.timezone(datetime.timedelta(days=-1, seconds=82800)))
```

I cannot understand why the resultant datetime.timedelta is days=-1, 
seconds=82800 (23 hours) .

Why is it not an hour earlier as seconds=-3600? Why is days = -1 when the 
resultant calculated date is the same, year, day, month??
-- 
https://mail.python.org/mailman/listinfo/python-list


python package management confusion

2019-01-14 Thread dcs3spp via Python-list
Hi,

I am a newbie completely confused with python package management.

I have a setup.py file (listed below) and have setup pip and setup.cfg to 
install my own dependencies  from a local devpi repository.

Can setup.py reference a git repository so that I can install from that url?

Is this possible in newer versions of setuptools? Does anyone have any 
examples? 

Completely confused with managing packages in python


Kind regards

dcs3spp

*** setup.py **

import os
import sys

from setuptools import setup, find_packages

here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.md')) as f:
README = f.read()
with open(os.path.join(here, 'CHANGES.md')) as f:
CHANGES = f.read()

requires = [
'cryptography',
'odfpy',
'PyJWT',
'pycrypto',
'pyramid',
'pyramid_core',  # currently installed from devpi...can setup.py use 
git+ssh url like pip requirements.txt file?
'pyramid_debugtoolbar',
'pyramid_tm',
'requests==2.18.4',
'SQLAlchemy',
'transaction',
'zope.sqlalchemy',
'waitress',
'psycopg2-binary',
'python-dateutil',
'uwsgi',
'marshmallow-sqlalchemy',
]

setup_requires = [
'pytest-runner',
]

tests_require = [
'boto3',
'lovely-pytest-docker',
'pytest',
'pytest-cov',
'tuspy',
'WebTest >= 1.3.1',
]

setup(name='api',
  version='0.0',
  description='api',
  long_description=README + '\n\n' + CHANGES,
  classifiers=[
  "Programming Language :: Python",
  "Framework :: Pyramid",
  "Topic :: Internet :: WWW/HTTP",
  "Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
  ],
  author='simon pears',
  author_email='roughlea-mu...@outlook.com',
  url='',
  keywords='web wsgi bfg pylons pyramid',
  packages=find_packages('src'),
  package_dir={'': 'src'},
  include_package_data=True,
  zip_safe=False,
  extras_require={
  'testing': tests_require,
  },
  install_requires=requires,
  setup_requires=setup_requires,
  tests_require=tests_require,
  test_suite='tests',
  entry_points="""\
  [paste.app_factory]
  main = api:main
  [console_scripts]
  initialize_api_db = api.scripts.initializedb:main
  """,
  )

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python package management confusion

2019-01-15 Thread dcs3spp via Python-list
On Tuesday, 15 January 2019 07:48:57 UTC, Chris Angelico  wrote:
> On Tue, Jan 15, 2019 at 6:18 PM dieter  wrote:
> >
> > dcs3spp via Python-list  writes:
> > > I am a newbie completely confused with python package management.
> > >
> > > I have a setup.py file (listed below) and have setup pip and setup.cfg to 
> > > install my own dependencies  from a local devpi repository.
> > >
> > > Can setup.py reference a git repository so that I can install from that 
> > > url?
> >
> > I doubt it:
> > A primary goal of the Python package management is to allow users
> > to easily install prepackaged components (published in a repository
> > like PyPI) - not to integrate transparently with source code control
> > systems.
> 
> You can use pip to install from a git repo, but I don't know the details.
> 
> ChrisA

Ok cheers all for responding, appreciated

So to manage the development of private packages, e.g. wheels, I would have to 
use my own private repository (something like devpi or a an alternative cloud 
pypi subscription service) to store each private dependency that I have 
written.  Alternatively, I would rely on pip requirement files. Will have to 
investigate zbuildout...

The package source for each dependency package could be managed in source 
control (git, gitlab etc.) and tested in CI build  gitlab-runner/Jenkins.
In the local development environment, packages that use the dependency package 
could use the local devpi repository. This would work in a private bare metal 
environment. 

However, if I wanted to take a step further and run a CI build using cloud 
services(e.g. in a private gitlab.com repository) for a package that uses the 
private packages, then presumably there is no access to the devpi repository on 
my local system? So, alternatively when developing private Python packages I 
either use requirements.txt or pay subscription for a private pypi cloud 
repository and configure pip, setup.cfg on gitlab.com CI to reference it in 
config files. When the CI build completes it pushes the package to the private 
pypi repository. 

Alternatively:
1. Avoid cloud CI services when developing private Python packages and use 
private bare metal CI server, e.g. gitlab, Jenkins etc.  

2. Use one monolithic package.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python package management confusion

2019-01-16 Thread dcs3spp via Python-list
On Wednesday, 16 January 2019 07:07:29 UTC, dieter  wrote:
> dcs3spp via Python-list  writes:
> > ...
> > So to manage the development of private packages, e.g. wheels, I would have 
> > to use my own private repository (something like devpi or a an alternative 
> > cloud pypi subscription service) to store each private dependency that I 
> > have written.
> 
> No, you do not need something like "devpi" (or similar).
> Instead, you can set up a "virtualenv" (there is a Python package
> which can build "virtualenv"s), and use "setuptool"'s "develop"
> "setup" command to "install" links to the package sources you
> currently have under development. "develop" will automatically
> install external requirements via "pypi".
> 
> > ...
> > However, if I wanted to take a step further and run a CI build using cloud 
> > services(e.g. in a private gitlab.com repository) for a package that uses 
> > the private packages, then presumably there is no access to the devpi 
> > repository on my local system? So, alternatively when developing private 
> > Python packages I either use requirements.txt or pay subscription for a 
> > private pypi cloud repository and configure pip, setup.cfg on gitlab.com CI 
> > to reference it in config files. When the CI build completes it pushes the 
> > package to the private pypi repository. 
> 
> I assume that you will be able to build an appropriate "virtualenv"
> in a CI build setup.

Thankyou for responding and thanks for your patience with this newbie dieter

A, so it is possible to use a virtualenv to pull in dependencies from 
setup.py 

I have the setup.py below and the pyramid_core package surrounded by * in the 
requires list has own setup.py and virtual environment. I currently have 
pip.conf and setup.cfg etc. setup to pull this dependency from devpi repository.

How do I configure python setup.py develop to pull the pyramid_core dependent 
packages using virtualenv?


*** setup.py ** 

import os 
import sys 

from setuptools import setup, find_packages 

here = os.path.abspath(os.path.dirname(__file__)) 
with open(os.path.join(here, 'README.md')) as f: 
README = f.read() 
with open(os.path.join(here, 'CHANGES.md')) as f: 
CHANGES = f.read() 

requires = [ 
'cryptography', 
'odfpy', 
'PyJWT', 
'pycrypto', 
'pyramid', 
*   'pyramid_core',  ***   
requirements.txt file? 
'pyramid_debugtoolbar', 
'pyramid_tm', 
'requests==2.18.4', 
'SQLAlchemy', 
'transaction', 
'zope.sqlalchemy', 
'waitress', 
'psycopg2-binary', 
'python-dateutil', 
'uwsgi', 
'marshmallow-sqlalchemy', 
] 

setup_requires = [ 
'pytest-runner', 
] 

tests_require = [ 
'boto3', 
'lovely-pytest-docker', 
'pytest', 
'pytest-cov', 
'tuspy', 
'WebTest >= 1.3.1', 
] 

setup(name='api', 
  version='0.0', 
  description='api', 
  long_description=README + '\n\n' + CHANGES, 
  classifiers=[ 
  "Programming Language :: Python", 
  "Framework :: Pyramid", 
  "Topic :: Internet :: WWW/HTTP", 
  "Topic :: Internet :: WWW/HTTP :: WSGI :: Application", 
  ], 
  author='simon pears', 
  author_email='roughlea-mu...@outlook.com', 
  url='', 
  keywords='web wsgi bfg pylons pyramid', 
  packages=find_packages('src'), 
  package_dir={'': 'src'}, 
  include_package_data=True, 
  zip_safe=False, 
  extras_require={ 
  'testing': tests_require, 
  }, 
  install_requires=requires, 
  setup_requires=setup_requires, 
  tests_require=tests_require, 
  test_suite='tests', 
  entry_points="""\ 
  [paste.app_factory] 
  main = api:main 
  [console_scripts] 
  initialize_api_db = api.scripts.initializedb:main 
  """, 
  )
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python package management confusion

2019-01-17 Thread dcs3spp via Python-list
On Thursday, 17 January 2019 07:41:43 UTC, dieter  wrote:
> dcs3spp via Python-list  writes:
> > ...
> > How do I configure python setup.py develop to pull the pyramid_core 
> > dependent packages using virtualenv?
> 
> Your "setup.py" below should work (once, you have removed the "").
> If the "pyramid" package correctly declares its dependencies,
> then the "pyramid_core" is even likely unnecessary.
> 
> Try it out.
> 
> > *** setup.py ** 
> >
> > import os 
> > import sys 
> >
> > from setuptools import setup, find_packages 
> >
> > here = os.path.abspath(os.path.dirname(__file__)) 
> > with open(os.path.join(here, 'README.md')) as f: 
> > README = f.read() 
> > with open(os.path.join(here, 'CHANGES.md')) as f: 
> > CHANGES = f.read() 
> >
> > requires = [ 
> > 'cryptography', 
> > 'odfpy', 
> > 'PyJWT', 
> > 'pycrypto', 
> > 'pyramid', 
> > *   'pyramid_core',  ***   
> > requirements.txt file? 
> > 'pyramid_debugtoolbar', 
> > 'pyramid_tm', 
> > 'requests==2.18.4', 
> > 'SQLAlchemy', 
> > 'transaction', 
> > 'zope.sqlalchemy', 
> > 'waitress', 
> > 'psycopg2-binary', 
> > 'python-dateutil', 
> > 'uwsgi', 
> > 'marshmallow-sqlalchemy', 
> > ] 
> >
> > setup_requires = [ 
> > 'pytest-runner', 
> > ] 
> >
> > tests_require = [ 
> > 'boto3', 
> > 'lovely-pytest-docker', 
> > 'pytest', 
> > 'pytest-cov', 
> > 'tuspy', 
> > 'WebTest >= 1.3.1', 
> > ] 
> >
> > setup(name='api', 
> >   version='0.0', 
> >   description='api', 
> >   long_description=README + '\n\n' + CHANGES, 
> >   classifiers=[ 
> >   "Programming Language :: Python", 
> >   "Framework :: Pyramid", 
> >   "Topic :: Internet :: WWW/HTTP", 
> >   "Topic :: Internet :: WWW/HTTP :: WSGI :: Application", 
> >   ], 
> >   author='simon pears', 
> >   author_email='roughlea-mu...@outlook.com', 
> >   url='', 
> >   keywords='web wsgi bfg pylons pyramid', 
> >   packages=find_packages('src'), 
> >   package_dir={'': 'src'}, 
> >   include_package_data=True, 
> >   zip_safe=False, 
> >   extras_require={ 
> >   'testing': tests_require, 
> >   }, 
> >   install_requires=requires, 
> >   setup_requires=setup_requires, 
> >   tests_require=tests_require, 
> >   test_suite='tests', 
> >   entry_points="""\ 
> >   [paste.app_factory] 
> >   main = api:main 
> >   [console_scripts] 
> >   initialize_api_db = api.scripts.initializedb:main 
> >   """, 
> >   )

Apologies dieter, I have not explained very well. I have written the 
pyramid_core package, it is not an external pypi package. I wish to use it 
across my own private projects, including CI builds mentioned earlier.

How do I configure setuptools to pull my own private dependency package using 
virtualenv + python setup.py develop
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python package management confusion

2019-01-18 Thread dcs3spp via Python-list
On Friday, 18 January 2019 07:39:00 UTC, dieter  wrote:
> dcs3spp via Python-list  writes:
> > ...
> > How do I configure setuptools to pull my own private dependency package 
> > using virtualenv + python setup.py develop
> 
> 
> You call "python setup.py develop" for your own package
> (which the "python" from the virtualenv).
> 
> This makes your package (more precisely, the one whose "setup.py"
> you have activated) available in the virtualenv.
> The "making available" happens in a way, that Python is actually
> using your package's source tree; thus, modifications in this
> source tree are seen by Python (either the next "run" or via
> "importlib.reload").

Thanks dieter I understand that is the case if I have one project and have 
tried it and that works fine.

My situation is similar to the following

Assume the following two privately developed projects that I have written, each 
with their own setup.py:
1. parent exists in folder $HOME/project/
2. child exists in folder $HOME/a_different_project/
*child could be also be used by other projects in the future

parent has a dependency requirement on child and so child is listed as an 
install dependency in parent setup.py

if I try python setup.py develop from parent project it fails to find child 
dependency on build. 

I have created a github project to illustrate the scenario @

https://github.com/dcs3spp/setuptools_dependency_example
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python package management confusion

2019-01-19 Thread dcs3spp via Python-list
On Saturday, 19 January 2019 07:33:50 UTC, dieter  wrote:
> dcs3spp via Python-list  writes:
> > On Friday, 18 January 2019 07:39:00 UTC, dieter  wrote:
> > ...
> > My situation is similar to the following
> >
> > Assume the following two privately developed projects that I have written, 
> > each with their own setup.py:
> > 1. parent exists in folder $HOME/project/
> > 2. child exists in folder $HOME/a_different_project/
> > *child could be also be used by other projects in the future
> >
> > parent has a dependency requirement on child and so child is listed as an 
> > install dependency in parent setup.py
> >
> > if I try python setup.py develop from parent project it fails to find child 
> > dependency on build. 
> 
> Do you tell me to have a cyclic dependency structure?
> 
> If not, first install "child" in your virtualenv (by whatever
> means, maybe "python setup.py develop"), then "parent".

Thanks for your suggestion.No, no cyclic dependency structure. Child does not 
depend on parent. Child could be used by separate projects in the future. Child 
will not be cyclic, it will not import projects that import it.

Installing child first is what I tried yesterday, 
https://github.com/dcs3spp/setuptools_dependency_example/blob/master/README.md 
, when trying to understand the suggested approach of using python setup.py 
develop to pull dependencies.

The advantage of the devpi approach, adopted earlier, is that this additional 
complexity is hidden from developers. They do not need to be concerned about 
the order that they install dependencies, e.g. install child first and then 
install parent. Developers just run python setup.py develop and it 
automatically fetches the child dependency. 

However, the devpi approach requires a private repository to be setup and I am 
not sure whether it is possible to give access to it for usage in CI cloud 
technologies, such as gitlab.com. If I stuck with devpi then I would presumably 
have to follow the route of a bare metal environment for CI server (e.g. 
Jenkins). Hence, my thoughts on paying subscription to a private pypi cloud 
repository…..


My question is, can setuptools be configured to pull in child from a separate 
git repository when running python setup.py develop from parent folder? I have 
since found and tried this approach at 
https://stackoverflow.com/a/53706140/8325270 
It appears that later versions of setuptools can install via a PEP508 url. I 
currently trying to investigate this approach…..


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python package management confusion

2019-01-20 Thread dcs3spp via Python-list
On Saturday, 19 January 2019 11:17:19 UTC, dcs3spp  wrote:
> On Saturday, 19 January 2019 07:33:50 UTC, dieter  wrote:
> > dcs3spp via Python-list  writes:
> > > On Friday, 18 January 2019 07:39:00 UTC, dieter  wrote:
> > > ...
> > > My situation is similar to the following
> > >
> > > Assume the following two privately developed projects that I have 
> > > written, each with their own setup.py:
> > > 1. parent exists in folder $HOME/project/
> > > 2. child exists in folder $HOME/a_different_project/
> > > *child could be also be used by other projects in the future
> > >
> > > parent has a dependency requirement on child and so child is listed as an 
> > > install dependency in parent setup.py
> > >
> > > if I try python setup.py develop from parent project it fails to find 
> > > child dependency on build. 
> > 
> > Do you tell me to have a cyclic dependency structure?
> > 
> > If not, first install "child" in your virtualenv (by whatever
> > means, maybe "python setup.py develop"), then "parent".
> 
> Thanks for your suggestion.No, no cyclic dependency structure. Child does not 
> depend on parent. Child could be used by separate projects in the future. 
> Child will not be cyclic, it will not import projects that import it.
> 
> Installing child first is what I tried yesterday, 
> https://github.com/dcs3spp/setuptools_dependency_example/blob/master/README.md
>  , when trying to understand the suggested approach of using python setup.py 
> develop to pull dependencies.
> 
> The advantage of the devpi approach, adopted earlier, is that this additional 
> complexity is hidden from developers. They do not need to be concerned about 
> the order that they install dependencies, e.g. install child first and then 
> install parent. Developers just run python setup.py develop and it 
> automatically fetches the child dependency. 
> 
> However, the devpi approach requires a private repository to be setup and I 
> am not sure whether it is possible to give access to it for usage in CI cloud 
> technologies, such as gitlab.com. If I stuck with devpi then I would 
> presumably have to follow the route of a bare metal environment for CI server 
> (e.g. Jenkins). Hence, my thoughts on paying subscription to a private pypi 
> cloud repository…..
> 
> 
> My question is, can setuptools be configured to pull in child from a separate 
> git repository when running python setup.py develop from parent folder? I 
> have since found and tried this approach at 
> https://stackoverflow.com/a/53706140/8325270 
> It appears that later versions of setuptools can install via a PEP508 url. I 
> currently trying to investigate this approach…..

After trying PEP508 url approach my conclusions are as follows.

A PEP508 url for a git repository can be used in *install_requires* of 
*setup.py*. An example is listed below.
```
requires = [
'parent',
'kinto-http@git+https://github.com/Kinto/kinto-http.py',
]
...
install_requires=requires
```
The package can then be installed with pip, using ```pip install -e . or pip 
install .```

However, installation with setuptools is then broken, i.e. ```python setup.py 
develop``` and ```python setup.py install``` fails. setuptools looks for 
packages in pypi indexes. To install using setuptools a devpi index would have 
to be installed and configured or packages would have to installed from a paid 
for pypi repository in the cloud. Alternatively, developers could manually 
install each private package dependency individually, prior to running 
```python setup.py develop``` for the source package. Unless, there are other 
alternative(s) such as zc.buildout with mr developer plugin etc.

If I want to have a Python private project, referencing other private 
project(s), available under source control and CI via gitlab.com, it seems that 
I can use the pip approach with PEP508 or use a requirements.txt file 
containing the git projects referenced as PEP508 urls, i.e. ```pip install -r 
requirements.txt```.

Confusion, stems from the fact that pip and setuptools dependencies are then 
not synchronised, i.e. setuptools will break if PEP508 urls are listed for 
install_requires. Presumably the approach is to use either pip or setuptools 
but not both? 


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python package management confusion

2019-01-20 Thread dcs3spp via Python-list
On Sunday, 20 January 2019 20:38:30 UTC, Oscar Benjamin  wrote:
> On Sun, 20 Jan 2019 at 16:22, dcs3spp via Python-list
>  wrote:
> >
> > On Saturday, 19 January 2019 11:17:19 UTC, dcs3spp  wrote:
> > >
> > > My question is, can setuptools be configured to pull in child from a 
> > > separate git repository when running python setup.py develop from parent 
> > > folder? I have since found and tried this approach at 
> > > https://stackoverflow.com/a/53706140/8325270
> > > It appears that later versions of setuptools can install via a PEP508 
> > > url. I currently trying to investigate this approach…..
> >
> > After trying PEP508 url approach my conclusions are as follows.
> >
> > A PEP508 url for a git repository can be used in *install_requires* of 
> > *setup.py*. An example is listed below.
> > ```
> > requires = [
> > 'parent',
> > 'kinto-http@git+https://github.com/Kinto/kinto-http.py',
> > ]
> > ...
> > install_requires=requires
> > ```
> > The package can then be installed with pip, using ```pip install -e . or 
> > pip install .```
> >
> > However, installation with setuptools is then broken, i.e. ```python 
> > setup.py develop``` and ```python setup.py install``` fails. setuptools 
> > looks for packages in pypi indexes. To install using setuptools a devpi 
> > index would have to be installed and configured or packages would have to 
> > installed from a paid for pypi repository in the cloud. Alternatively, 
> > developers could manually install each private package dependency 
> > individually, prior to running ```python setup.py develop``` for the source 
> > package. Unless, there are other alternative(s) such as zc.buildout with mr 
> > developer plugin etc.
> >
> > If I want to have a Python private project, referencing other private 
> > project(s), available under source control and CI via gitlab.com, it seems 
> > that I can use the pip approach with PEP508 or use a requirements.txt file 
> > containing the git projects referenced as PEP508 urls, i.e. ```pip install 
> > -r requirements.txt```.
> >
> > Confusion, stems from the fact that pip and setuptools dependencies are 
> > then not synchronised, i.e. setuptools will break if PEP508 urls are listed 
> > for install_requires. Presumably the approach is to use either pip or 
> > setuptools but not both?
> 
> I'm not sure what you mean by pip and setuptools not being
> synchronised. Pip depends on setuptools and cannot be used without it.
> Both setuptools and pip are maintained under the PyPA. They are
> intended to work together. in fact if your setup.py uses distutils
> instead of setuptools then pip will "inject" setuptools into it to
> ensure that meets pip's needs.
> 
> You will need to be more specific about which commands you are using
> and what it is that becomes unsynchronised.
> 
> --
> Oscar

Hi, 

Have since done further testing and figured out how I can install from a 
setup.py file using both pip and python setup.py develop. Confusion was caused 
by trying to install using both pip and setuptools with PEP508 urls in 
install_requires, see note at end of post 

From what I understand setuptools offers *dependency_links* as a list of 
dependency urls. In the example below, the *pyramid_core* package is a private 
dependency that I have written. 

I am currently using pip 18.1. pip has an option *--process-dependencies* that 
issues a deprecation warning. The following *setup.py* example works with both 
setuptools (python setup develop etc.) and pip (pip install -e . and pip 
install .).

The example *setup.py* below can be installed using both setuptools and pip as 
follows:
```
python setup.py develop
python setup.py install
pip install -e . --process-dependency-links
pip install .
```

**setup.py that is compatible with both setuptools and pip 18.1**
=
```
import os

from setuptools import setup, find_packages

here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.md')) as f:
README = f.read()
with open(os.path.join(here, 'CHANGES.md')) as f:
CHANGES = f.read()

dependencies = [

'git+ssh://g...@gitlab.com/dcs3spp/plantoeducate_core.git#egg=pyramid_core-0',
]

requires = [
'parent',
'pyramid_core',
]

setup_requires = [
]

tests_require = [
'pytest',
'pytest-cov',
]

setup(name='parent',
  version='0.1',
  description='parent',
  long_description=README + '\n\n' + CHANGES,
  classif

Re: python package management confusion

2019-01-20 Thread dcs3spp via Python-list
On Sunday, 20 January 2019 21:27:53 UTC, Oscar Benjamin  wrote:
> On Sun, 20 Jan 2019 at 21:12, dcs3spp via Python-list
>  wrote:
> >
> > Pip 18.1 supports reading pep508 direct urls from install_requires. In 
> > future release there are plans to deprecate the --process-dependency-links 
> > pip install option:
> > - https://github.com/pypa/pip/issues/4187
> > - https://github.com/pypa/pip/pull/4175
> >
> > Will setuptools provide ability to use direct pep508 urls in 
> > install_requires in the future also?
> 
> Someone might answer here but if not I suggest asking this on distutils-sig:
> https://www.python.org/community/sigs/current/distutils-sig/
> 
> Also:
> https://github.com/pypa/setuptools/issues
> 
> --
> Oscar

Cheers, thanks for the resource links, will give them a go. Appreciated :)
-- 
https://mail.python.org/mailman/listinfo/python-list


Adopting semantic versioning in trunk based development with Python

2019-04-11 Thread dcs3spp via Python-list
Hi,

Hoping posting this in the correct place...Apologies if not

I am trying to understand how to use semantic versioning with trunk based 
development for a Python project. Has anyone had any experience of adopting a 
trunk based development with semantic versioning for packages?

I store the semantic version in version.py :__version__ which gets included in 
setup.py

On the trunk (main) version.py:__version__ would be 1.0.0-SNAPSHOT and on the 
CI server each build would append the build number, e.g. 1.0.0.1234-SNAPSHOT. A 
changelog would initially be empty for the semantic version number on the trunk 
(main).  

When ready to release a release branch would be created *release-1.0.x* and any 
fixes, features would be cherry-picked from main. A gitlab CI job would still 
run tests for commits on branches named *release-*. The release branch may be 
tagged, e.g. 1.0.1, 1.0.2 etc. until the release stabilises. This would bump 
the version number in version.py.

The changelog could be finalised on the release-branch, however this would mean 
that it would have to be merged back to trunk(main). version.py would also 
presumably have to be merged back to trunk after it is has been bumped 
following hotfixes on the release branch. Is a merge from release to 
trunk(main) acceptable in trunk based development for changelog and version 
files only?

The problem would be if a new release, e.g. 1.1.0-SNAPSHOT was then prepared 
for while release branch 1.0.x was still active then the version number would 
be out of synch between trunk and release??

How is this managed with trunk based development approach?

Kind regards

dcs3spp
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Adopting semantic versioning in trunk based development with Python

2019-04-12 Thread dcs3spp via Python-list
On Thursday, 11 April 2019 17:33:04 UTC+1, dcs3spp  wrote:
> Hi,
> 
> Hoping posting this in the correct place...Apologies if not
> 
> I am trying to understand how to use semantic versioning with trunk based 
> development for a Python project. Has anyone had any experience of adopting a 
> trunk based development with semantic versioning for packages?
> 
> I store the semantic version in version.py :__version__ which gets included 
> in setup.py
> 
> On the trunk (main) version.py:__version__ would be 1.0.0-SNAPSHOT and on the 
> CI server each build would append the build number, e.g. 1.0.0.1234-SNAPSHOT. 
> A changelog would initially be empty for the semantic version number on the 
> trunk (main).  
> 
> When ready to release a release branch would be created *release-1.0.x* and 
> any fixes, features would be cherry-picked from main. A gitlab CI job would 
> still run tests for commits on branches named *release-*. The release branch 
> may be tagged, e.g. 1.0.1, 1.0.2 etc. until the release stabilises. This 
> would bump the version number in version.py.
> 
> The changelog could be finalised on the release-branch, however this would 
> mean that it would have to be merged back to trunk(main). version.py would 
> also presumably have to be merged back to trunk after it is has been bumped 
> following hotfixes on the release branch. Is a merge from release to 
> trunk(main) acceptable in trunk based development for changelog and version 
> files only?
> 
> The problem would be if a new release, e.g. 1.1.0-SNAPSHOT was then prepared 
> for while release branch 1.0.x was still active then the version number would 
> be out of synch between trunk and release??
> 
> How is this managed with trunk based development approach?
> 
> Kind regards
> 
> dcs3spp

PS, error in my original question where I stated features cherry picked from 
main. Typo. Only fixes can be cherry picked from trunk(main) onto a release 
branch.
-- 
https://mail.python.org/mailman/listinfo/python-list