Re: [RELEASE] Python 3.10.0rc1 is available

2021-08-04 Thread Pablo Galindo Salgado
Hi,

Unfortunately, due to a problem that I was not aware of caused by
https://bugs.python.org/issue44756, the
release artifacts for Linux contained a "venv" folder in the "Docs"
directory.

I have uploaded a new version of the artifacts that fixed this problem and
I have corrected this for future
releases.

If you had any problem building docs with the previous release artifacts
for 3.10.0rc1, please try again.

Regards from cloudy London,

Your friendly release team,
Pablo Galindo @pablogsal
Ned Deily @nad
Steve Dower @steve.dower

On Tue, 3 Aug 2021 at 17:31, Pablo Galindo Salgado 
wrote:

> Python 3.10.0 is almost ready. This release, 3.10.0rc1, is the
> penultimate release preview. You can get it here:
>
> https://www.python.org/downloads/release/python-3100rc1/
>
>
> *This is the first release candidate of Python 3.10*
> This release, **3.10.0rc1**, is the penultimate release preview.  Entering
> the release candidate phase, only reviewed code changes which are
> clear bug fixes are allowed between this release candidate and the final
> release. The second candidate and the last planned release preview is
> currently planned for 2021-09-06 while the official release is planned for
> 2021-10-04.
>
> There will be no ABI changes from this point forward in the 3.10 series
> and the goal is that there will be as few code changes as possible.
>
> *Call to action*
> Core developers: all eyes on the docs now
>
>- Are all your changes properly documented?
>- Did you notice other changes you know of to have insufficient
>documentation?
>
> Community members
>
> We strongly encourage maintainers of third-party Python projects to
> prepare their projects for 3.10 compatibilities during this phase. As
> always, report any issues to the Python bug tracker
> .
> Please keep in mind that this is a preview release and its use is **not**
> recommended for production environments.
>
> *And now for something completely different*
>
> In theoretical physics, quantum chromodynamics (QCD) is the theory of the
> strong interaction between quarks and gluons, the fundamental particles
> that make up composite hadrons such as the proton, neutron, and pion. The
> QCD analog of electric charge is a property called color. Gluons are the
> force carrier of the theory, just as photons are for the electromagnetic
> force in quantum electrodynamics. There are three kinds of charge in QCD
> (as opposed to one in quantum electrodynamics or QED) that are usually
> referred to as "color charge" by loose analogy to the three kinds of color
> (red, green and blue) perceived by humans. Other than this nomenclature,
> the quantum parameter "color" is completely unrelated to the everyday,
> familiar phenomenon of color.
>
>
> *We hope you enjoy those new releases!*
> Thanks to all of the many volunteers who help make Python Development and
> these releases possible! Please consider supporting our efforts by
> volunteering yourself or through organization contributions to the Python
> Software Foundation.
>
> Regards from cloudy London,
>
> Your friendly release team,
> Pablo Galindo @pablogsal
> Ned Deily @nad
> Steve Dower @steve.dower
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: SQLALchemy: update with in clause from kwargs

2021-08-04 Thread Larry Martell
On Tue, Aug 3, 2021 at 7:26 PM dn via Python-list
 wrote:
>
> On 04/08/2021 13.08, Larry Martell wrote:
> > I am trying to write a function that takes kwargs as a param and
> > generates an update statement where the rows to be updated are
> > specified in an in clause.
> >
> > Something like this:
> >
> > def update_by_in(self, **kwargs):
> > filter_group = []
> > for col in kwargs['query_params']:
> > # obviously this line does not work as col is a string,
> > but this is the intent
> > filter_group.append(col.in_(tuple(kwargs['query_params'][col])))
> >
> > 
> > self._session.query(self.model_class).filter(*filter_group).update(kwargs['values'])
> >
> > self.update_by_in(
> > **{'query_params': {'companyCode': ['A', 'B', 'C']},
> > 'values': {'portfolioName': 'test'}}
> >  )
> >
> > Is there a way to do this? I think I need to use setattr in building
> > up the filter_group list, but I'm not quite sure how to do it.
>
>
> When feeling bamboozled by a problem, particularly when using
> sophisticated tools such as SQLAlchemy, the trick is often to simplify
> the problem.
>
> Step 1 (using the sample data provided)
> Write the query on paper - and as constant-values.
>
> Step 2
> Compare the two input dicts with that requirement.
>
> Step 3
> Work-out the transformation(s) required...
>
>
> One complexity is that the parameter to update_by_in() is formed by
> joining two dicts. However, the function later tries to treat them in
> distinct fashions. Why the join/why not two parameters?
>
> companyCode = ['A', 'B', 'C']
> values = {'portfolioName': 'test'}
>
> leading to:
>
> self.update_by_in( companyCode, values )
>
> and:
>
> def update_by_in(self, company_code, portfolio_type ):
> 
>
>
> As to the core of the question-asked, I'm a little confused (which may
> be my fuzzy head). Do you want the update(s) - portrayed as a list -
> like this:
>
> [('A', 'test'), ('B', 'test'), ('C', 'test')]
>
> like this:
>
> [('A', 'portfolioName'), ('B', None), ('C', None)]
>
> or only:
>
> [('A', 'portfolioName')]
>
>
> You will find a friend in the itertools (PSL) library:
>
> import itertools as it
>
> list( it.product( companyCode, values.values() ) )
> [('A', 'test'), ('B', 'test'), ('C', 'test')]
>
> list( it.zip_longest( companyCode, values.values() ) )
> [('A', 'test'), ('B', None), ('C', None)]
>
> list( zip( companyCode, values ) )
> [('A', 'portfolioName')]
>
>
> Now, have we simplified things to the point of being able to more-easily
> code the update and filter?

I appreciate the reply, but it does not address my issue, which was
how to get at the column object. Turned out that was simple enough:

for col in kwargs['query_params']:
attr = getattr(self.model_class, col)
filter_group.append(attr.in_(tuple(kwargs['query_params'][col])))

Unfortunately that is causing something to change the query_params, as
filter group ends up like:

print(type(filter_group[0]))



print(filter_group[0])

dbo."Portfolio"."companyCode" IN (:companyCode_1, :companyCode_2,
:companyCode_3)

Which then fails with:

sqlalchemy.orm.evaluator.UnevaluatableError: Cannot evaluate
clauselist with operator 

This has now become more of a sqlalchemy question than a python one.
-- 
https://mail.python.org/mailman/listinfo/python-list


Tracing in a Flask application

2021-08-04 Thread Javi D R
Hi

I would like to do some tracing in a flask. I have been able to trace
request in plain python requests using sys.settrace(), but this doesnt work
with Flask.

Moreover, what i want to trace is in a flask application, when an endpoint
is called, what was the request, which parts of the code was executed (i
think i can still do it with settrace) and what is the response sent by the
application

Can you help me to understand which services i can use to do this?

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