Comments (10)
I guess someone could argue that https://docs.python.org/3/library/datetime.html#datetime.datetime.fromtimestamp takes a POSIX timestamp (in seconds)... Maybe the timestamp
property could return a datetime
object instead of an int then?
from rattler.
That's not intentional and something I would consider a bug.
Funny note, timestamp in repodata are also not consistent, some are in milliseconds and some are in seconds.
Anyhow, yeah it would be better to return a datetime I think! Would you be able to create a PR? Could we also construct a datetime from milliseconds though?
from rattler.
$ for plat in {linux-{64,aarch64},win-64,osx-{64,arm64},noarch}; do curl -s https://conda.anaconda.org/conda-forge/$plat/repodata.json | jq '."packages.conda"[].timestamp, .packages[].timestamp' -r | awk '{print length()}' | sort -n | uniq -c; done
33149 4
441126 13
156084 13
27654 4
279888 13
32606 4
387859 13
131365 13
1660 4
192101 13
13 is milliseconds and 4 is "none", so no timestamps. Same on main:
$ for plat in {linux-{64,aarch64},win-64,osx-{64,arm64},noarch}; do curl -s https://repo.anaconda.com/pkgs/main/$plat/repodata.json | jq '."packages.conda"[].timestamp, .packages[].timestamp' -r | awk '{print length()}' | sort -n | uniq -c; done
19 4
77091 13
33129 13
15 4
69661 13
15 4
74117 13
29483 13
4 4
9380 13
So I don't see any timestamps in seconds on conda-forge and main.
from rattler.
Could we also construct a datetime from milliseconds though?
From Python no. You have to do a small dance in Python to convert a timestamps with milliseconds precision to a datetime object, something like int(latest.timestamp / 1000.0)
. But for rust > Python, I don't know. Based on https://pyo3.rs/v0.21.2/conversions/tables it seems to be doable?
from rattler.
So I don't see any timestamps in seconds on conda-forge and main.
Maybe the new conda-index is already doing the normalization :) But it was definitely a thing at some point.
from rattler.
Looking at py03, to return a datetime object to python, we would need to update to at least 0.21 and and stop using the abi3... I'm guessing that dropping abi3 would be a no go right?
from rattler.
I'm guessing that dropping abi3 would be a no go right?
Yes.
But it I understand datetime correctly we can return a float
or double
that represents the timestamp in seconds from the rust code and convert that to a datetime
in the python code.
from rattler.
@JeanChristopheMorinPerso we are actually using a "double-wrap" so you can do arbitrary stuff on the Python side before it's being handed to the user. It should be quite straightforward to get a integer from Rust and wrap it in the Python datetime object.
from rattler.
@JeanChristopheMorinPerso let me know what you think about the implementation in #706 - it returns a datetime.datetime
instead of an integer.
from rattler.
Thanks!
from rattler.
Related Issues (20)
- Solving mlflow=2.12.2=py39hb3b8efb_0 takes a lot of time HOT 5
- Cannot solve cmdstan=2.33.1=hc24a2e5_0 (linux) from osx-arm64 HOT 12
- Add `VersionSpec` python bindings
- The python bindings quick start example is out of date
- Dependency graph from a resolve HOT 7
- Use `rustc-hash` instead of `fxhash` HOT 2
- how do you feed entries from `run_constrains` to the `solver` function in py-rattler? HOT 2
- `InvalidBracket` for matchspec HOT 2
- Create repodata records from package urls HOT 1
- Matchspec::from_string gives RegexConstraintsNotSupported for X.Y.Z.*. HOT 2
- Use prefetched repodatas in `solve()`? HOT 4
- NamelessMatchSpec::from_str more strict than MatchSpec::from_str HOT 2
- Get `sha256`, `size` and `md5` from direct url package.
- Empty `repodata.json` should be valid HOT 1
- Clobbering a folder with a file is broken
- Gateway.query in Python returns all versions HOT 4
- unable to parse package name "libxgboost-0.6+218_omp_0.tar.bz2" HOT 4
- Add benchmark for lock file size HOT 1
- Investigate how to reduce lock file size
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rattler.