python projects basics Flashcards

1
Q

how to build a Python package and deploy to a GitHub repository over to a JFrog Artifactory repository enabling easy distribution and consumption of your packages within your organization.

A
  1. Build the Python Package:
    • Build the Python package using tools like setuptools, poetry, or flit. This step generates the distributable package (e.g., a .tar.gz file or a wheel file).
  2. Publish the Package to PyPI or an Artifact Repository:
    • Publish the built Python package to a Python Package Index (PyPI) or an artifact repository such as JFrog Artifactory.
    • For PyPI, you would use twine or setuptools to upload the package.
    • For JFrog Artifactory or other artifact repositories, you would use their respective APIs or CLI tools to upload the package.
  3. Version Control and GitHub:
    • Once the package is published to PyPI or an artifact repository, the package metadata (e.g., version number) should be updated in your version control system (e.g., Git).
    • This ensures that users can install the package from the correct source and version.
  4. Automate Package Deployment (Optional):
    • You can set up automation to streamline the process of deploying packages to PyPI or the artifact repository.
    • This automation can be integrated into your CI/CD pipeline, triggered by events such as code pushes or releases.
  5. Dependency Management:
    • Ensure that consumers of your package can specify it as a dependency in their projects’ requirements.txt, setup.py, or pyproject.toml files.
    • They can then install the package using pip or other dependency management tools, which will fetch the package from PyPI or the configured artifact repository.
  6. Access Control and Permissions:
    • Manage access control and permissions for the package repository in JFrog Artifactory to control who can upload, download, and manage package
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

different packaging tools

A

If the project uses Poetry, a modern Python dependency management and packaging tool, you’ll typically find a pyproject.toml file in the project root directory. Poetry uses this file to manage project dependencies, build the package, and specify other project settings.

After running the build command with setuptools, Poetry, or Flit, the built package files are typically placed in a build/ or dist/ directory within the project. You can check the contents of these directories to see if there are any built package files (e.g., .tar.gz or .whl files).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q
A
17
Q
A
18
Q
A
19
Q
A
20
Q
A
21
Q
A
22
Q
A
23
Q
A
24
Q
A
25
Q
A
26
Q
A
27
Q
A
28
Q
A
29
Q
A
30
Q
A
31
Q
A
32
Q
A
33
Q
A
34
Q
A